diff --git a/.env.common b/.env.common index 213af15..bae57f2 100644 --- a/.env.common +++ b/.env.common @@ -67,3 +67,5 @@ MONGO_URL=${MONGO_CONNECT}/?replicaSet=${MONGO_REPLICA_SET} REDIS_HOST=redis REDIS_PORT=6379 REDIS_URL="redis://${REDIS_HOST}:${REDIS_PORT}?dial_timeout=3&read_timeout=6s" + +STORAGE_DIR="./storage" diff --git a/docker-compose.yml b/docker-compose.yml index d3c5a21..644a28b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,7 @@ services: dockerfile: Dockerfile-generateconfig-anyconf volumes: - ./:/code + - "${STORAGE_DIR}:/code/storage" # processing any-sync-* configs generateconfig-processing: @@ -19,6 +20,7 @@ services: dockerfile: Dockerfile-generateconfig-processing volumes: - ./:/code + - "${STORAGE_DIR}:/code/storage" mongo-1: depends_on: @@ -29,7 +31,7 @@ services: ports: - "${MONGO_1_PORT}:${MONGO_1_PORT}" volumes: - - ./storage/mongo-1/:/data/db + - "${STORAGE_DIR}/mongo-1/:/data/db" healthcheck: test: test $$(mongosh --port ${MONGO_1_PORT} --quiet --eval "try {rs.initiate({_id:'${MONGO_REPLICA_SET}',members:[{_id:0,host:\"mongo-1:${MONGO_1_PORT}\"}]})} catch(e) {rs.status().ok}") -eq 1 interval: 10s @@ -45,7 +47,7 @@ services: ports: - "${REDIS_PORT}:${REDIS_PORT}" volumes: - - ./storage/redis/:/data/ + - "${STORAGE_DIR}/redis/:/data/" healthcheck: test: [ "CMD", "redis-cli", "--raw", "-p", "${REDIS_PORT}", "incr", "ping" ] interval: 10s @@ -63,7 +65,7 @@ services: - "${EXTERNAL_MINIO_PORT}:${MINIO_PORT}" - "${EXTERNAL_MINIO_WEB_PORT}:${MINIO_WEB_PORT}" volumes: - - ./storage/minio:/data + - "${STORAGE_DIR}/minio:/data" healthcheck: test: bash -c ':> /dev/tcp/127.0.0.1/${MINIO_PORT}' || exit 1 interval: 5s @@ -113,7 +115,7 @@ services: - 8005:8000 volumes: - ./etc/any-sync-coordinator/:/etc/any-sync-coordinator/ - - ./storage/networkStore/any-sync-coordinator/:/networkStore/ + - "${STORAGE_DIR}/networkStore/any-sync-coordinator/:/networkStore/" deploy: resources: limits: @@ -136,7 +138,7 @@ services: volumes: - ./etc/any-sync-filenode/:/etc/any-sync-filenode/ - ./etc/.aws:/root/.aws:ro - - ./storage/networkStore/any-sync-filenode/:/networkStore/ + - "${STORAGE_DIR}/networkStore/any-sync-filenode/:/networkStore/" deploy: resources: limits: @@ -155,8 +157,8 @@ services: - 8001:8000 volumes: - ./etc/any-sync-node-1/:/etc/any-sync-node/ - - ./storage/any-sync-node-1/:/storage/ - - ./storage/networkStore/any-sync-node-1/:/networkStore/ + - "${STORAGE_DIR}/any-sync-node-1/:/storage/" + - "${STORAGE_DIR}/networkStore/any-sync-node-1/:/networkStore/" deploy: resources: limits: @@ -175,8 +177,8 @@ services: - 8002:8000 volumes: - ./etc/any-sync-node-2/:/etc/any-sync-node/ - - ./storage/any-sync-node-2/:/storage/ - - ./storage/networkStore/any-sync-node-2/:/networkStore/ + - "${STORAGE_DIR}/any-sync-node-2/:/storage/" + - "${STORAGE_DIR}/networkStore/any-sync-node-2/:/networkStore/" deploy: resources: limits: @@ -195,8 +197,8 @@ services: - 8003:8000 volumes: - ./etc/any-sync-node-3/:/etc/any-sync-node/ - - ./storage/any-sync-node-3/:/storage/ - - ./storage/networkStore/any-sync-node-3/:/networkStore/ + - "${STORAGE_DIR}/any-sync-node-3/:/storage/" + - "${STORAGE_DIR}/networkStore/any-sync-node-3/:/networkStore/" deploy: resources: limits: @@ -214,7 +216,7 @@ services: - 8006:8000 volumes: - ./etc/any-sync-consensusnode/:/etc/any-sync-consensusnode/ - - ./storage/networkStore/any-sync-consensusnode/:/networkStore/ + - "${STORAGE_DIR}/networkStore/any-sync-consensusnode/:/networkStore/" deploy: resources: limits: @@ -233,6 +235,7 @@ services: - any-sync-node-3 volumes: - ./:/code + - "${STORAGE_DIR}:/code/storage" command: "tail -f /dev/null" tty: true healthcheck: