Skip to content

Configuration

Kirill Shklyaev edited this page Apr 7, 2026 · 12 revisions

Configuration via .env

Copy .env.example to .env and edit it directly:

cp .env.example .env

All customizations go into .env. The file is well-commented — each section explains the available variables.

Service versions

By default, .env.example contains pinned versions tested together. To fetch the latest compatible set automatically:

./update-versions.sh

This updates the ANY_SYNC_*_VERSION variables in .env from the Anytype API. Re-run it whenever you want to upgrade.

External listen host

By default, services bind to 127.0.0.1 (local-only). To expose them to external clients, set EXTERNAL_LISTEN_HOSTS in .env:

EXTERNAL_LISTEN_HOSTS="<yourExternalIp1> <yourExternalIp2>"

Multiple IPs are space-separated. Restart after changes:

make restart

Custom storage directory

Clean setup

echo 'STORAGE_DIR=/path/to/your/directory' >> .env
make start

Existing setup

make stop
# transfer existing data
mv ./storage /path/to/your/directory
# update .env
sed -i 's|^STORAGE_DIR=.*|STORAGE_DIR=/path/to/your/directory|' .env
make start

Firewall

Retrieve the list of listening ports from .env:

grep 'ANY_SYNC_.*_PORT=' .env

Example output:

ANY_SYNC_NODE_1_PORT=1001
ANY_SYNC_NODE_1_QUIC_PORT=1011
ANY_SYNC_NODE_2_PORT=1002
ANY_SYNC_NODE_2_QUIC_PORT=1012
ANY_SYNC_NODE_3_PORT=1003
ANY_SYNC_NODE_3_QUIC_PORT=1013
ANY_SYNC_COORDINATOR_PORT=1004
ANY_SYNC_COORDINATOR_QUIC_PORT=1014
ANY_SYNC_FILENODE_PORT=1005
ANY_SYNC_FILENODE_QUIC_PORT=1015
ANY_SYNC_CONSENSUSNODE_PORT=1006
ANY_SYNC_CONSENSUSNODE_QUIC_PORT=1016
  • QUIC ports (ending in _QUIC_PORT) use UDP.
  • Standard ports use TCP.

iptables example

# TCP (YAMUX)
iptables -A INPUT -p tcp --dport 1001 -j ACCEPT
iptables -A INPUT -p tcp --dport 1002 -j ACCEPT
iptables -A INPUT -p tcp --dport 1003 -j ACCEPT
iptables -A INPUT -p tcp --dport 1004 -j ACCEPT
iptables -A INPUT -p tcp --dport 1005 -j ACCEPT
iptables -A INPUT -p tcp --dport 1006 -j ACCEPT

# UDP (QUIC)
iptables -A INPUT -p udp --dport 1011 -j ACCEPT
iptables -A INPUT -p udp --dport 1012 -j ACCEPT
iptables -A INPUT -p udp --dport 1013 -j ACCEPT
iptables -A INPUT -p udp --dport 1014 -j ACCEPT
iptables -A INPUT -p udp --dport 1015 -j ACCEPT
iptables -A INPUT -p udp --dport 1016 -j ACCEPT

Verify with iptables -L. Adjust port numbers if you changed defaults in .env.

Use AWS S3 (or any other cloud-based S3)

  1. make down
  2. Delete the lines "endpoint" and "forcePathStyle" from the any-sync-filenode config file.
  3. Specify your current AWS S3 region here.
  4. Set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and MINIO_BUCKET (use your S3 bucket name) in .env.
  5. Remove minio and create-bucket services from docker-compose.yml. Remove the dependency within any-sync-filenode service.
  6. make start

Files uploaded to Anytype spaces will be stored in the bucket in encrypted form.

Running as a non-privileged user (Linux only)

New setup only

git clone https://github.com/anyproto/any-sync-dockercompose.git
cd any-sync-dockercompose/
mkdir -p storage/anyStorage/any-sync-node-{1..3} storage/any-sync-node-{1..3} storage/{minio,mongo-1,redis} storage/networkStore/{any-sync-consensusnode,any-sync-coordinator,any-sync-filenode,any-sync-node-1,any-sync-node-2,any-sync-node-3}

Setup

make stop

chown -R $(id -u):$(id -g) storage/

# Append UID/GID to .env
cat <<EOF >> .env
UID=$(id -u)
GID=$(id -g)
EOF

# !!! WARNING !!! This will overwrite your docker-compose.override.yml file !!!
# If you're already using docker-compose.override.yml, merge the changes manually.

cat <<EOF > docker-compose.override.yml
x-defaults: &defaults
  user: "\${UID}:\${GID}"

services:
  generateconfig-anyconf:
    <<: *defaults
  generateconfig-processing:
    <<: *defaults
  mongo-1:
    <<: *defaults
  redis:
    <<: *defaults
  minio:
    <<: *defaults
  create-bucket:
    <<: *defaults
  any-sync-coordinator_bootstrap:
    <<: *defaults
  any-sync-coordinator:
    <<: *defaults
  any-sync-filenode:
    <<: *defaults
  any-sync-node-1:
    <<: *defaults
  any-sync-node-2:
    <<: *defaults
  any-sync-node-3:
    <<: *defaults
  any-sync-consensusnode:
    <<: *defaults
  netcheck:
    <<: *defaults
EOF

make start

Clone this wiki locally