diff --git a/.env b/.env index 3c63642..73e2746 100644 --- a/.env +++ b/.env @@ -8,6 +8,7 @@ ANY_SYNC_NODE_VERSION=latest ANY_SYNC_FILENODE_VERSION=latest ANY_SYNC_COORDINATOR_VERSION=latest ANY_SYNC_CONSENSUSNODE_VERSION=latest +ANY_SYNC_ADMIN_VERSION=latest MONGO_VERSION=7.0.2 REDIS_VERSION=7.2.0-v6 @@ -58,5 +59,9 @@ MONGO_1_PORT=27001 MONGO_2_PORT=27002 MONGO_3_PORT=27003 MONGO_CONNECT=mongodb://mongo-1:${MONGO_1_PORT},mongo-2:${MONGO_2_PORT},mongo-3:${MONGO_3_PORT} +REDIS_HOST=redis REDIS_PORT=6379 -REDIS_URL="redis://redis:${REDIS_PORT}?dial_timeout=3&read_timeout=6s" +REDIS_URL="redis://${REDIS_HOST}:${REDIS_PORT}?dial_timeout=3&read_timeout=6s" + +ANY_SYNC_ADMIN_HOST=0.0.0.0 +ANY_SYNC_ADMIN_PORT=5000 diff --git a/.gitignore b/.gitignore index d08ede8..1733f9a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -etc/ -storage/ -docker-compose.override.yml +/etc/ +/storage/ +/docker-compose.override.yml diff --git a/docker-compose.yml b/docker-compose.yml index aeb86ee..9cb2bd7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -204,3 +204,13 @@ services: memory: 500M restart: on-failure command: bash -c "sleep 15; /bin/any-sync-consensusnode -c /etc/any-sync-consensusnode/config.yml" + + any-sync-admin: + image: "ghcr.io/anyproto/any-sync-admin:${ANY_SYNC_ADMIN_VERSION}" + depends_on: + - any-sync-coordinator + ports: + - "80:${ANY_SYNC_ADMIN_PORT}" + volumes: + - ./etc/any-sync-admin/:/etc/any-sync-admin/ + restart: on-failure diff --git a/docker-generateconfig/etc/admin.yml b/docker-generateconfig/etc/admin.yml new file mode 100644 index 0000000..cd86a49 --- /dev/null +++ b/docker-generateconfig/etc/admin.yml @@ -0,0 +1,9 @@ +--- +listen: + host: %ANY_SYNC_ADMIN_HOST% + port: %ANY_SYNC_ADMIN_PORT% +mongo: + url: %MONGO_CONNECT% +redis: + host: %REDIS_HOST% + port: %REDIS_PORT% diff --git a/docker-generateconfig/processing.sh b/docker-generateconfig/processing.sh index f82d02c..1b25a43 100755 --- a/docker-generateconfig/processing.sh +++ b/docker-generateconfig/processing.sh @@ -39,6 +39,10 @@ cat "${network_file}" tmp-etc/common.yml generateconfig/account5.yml tmp-etc/con # Copy network file to coordinator directory cp "generateconfig/nodes.yml" "${dest_path}/any-sync-coordinator/network.yml" +# Generate any-sync-admin config +mkdir -p ${dest_path}/any-sync-admin +cp "tmp-etc/admin.yml" ${dest_path}/any-sync-admin/config.yml + # Replace placeholders in config files for node_type in node_1 node_2 node_3 coordinator filenode consensusnode; do addresses="ANY_SYNC_${node_type^^}_ADDRESSES" @@ -56,6 +60,10 @@ placeholders=( "ANY_SYNC_COORDINATOR_FILE_LIMIT_DEFAULT" "ANY_SYNC_COORDINATOR_FILE_LIMIT_ALPHA_USERS" "ANY_SYNC_COORDINATOR_FILE_LIMIT_NIGHTLY_USERS" + "ANY_SYNC_ADMIN_HOST" + "ANY_SYNC_ADMIN_PORT" + "REDIS_HOST" + "REDIS_PORT" ) for placeholder in "${placeholders[@]}"; do perl -i -pe "s|%${placeholder}%|${!placeholder}|g" "${network_file}" "${dest_path}/"/*/*.yml