1
0
Fork 0
mirror of https://github.com/anyproto/any-sync-dockercompose.git synced 2025-06-08 05:47:03 +09:00
any-sync-dockercompose/docker-compose.yml
2024-05-03 17:15:24 -03:00

233 lines
7.1 KiB
YAML

services:
# generate configs using the anyconf utility
generateconfig-anyconf:
image: generateconfig-anyconf
build:
context: .
dockerfile: Dockerfile-generateconfig-anyconf
volumes:
- ./:/code
# processing any-sync-* configs
generateconfig-processing:
depends_on:
generateconfig-anyconf:
condition: service_healthy
image: generateconfig-processing
build:
context: .
dockerfile: Dockerfile-generateconfig-processing
volumes:
- ./:/code
mongo-1:
depends_on:
generateconfig-processing:
condition: service_healthy
image: "mongo:${MONGO_VERSION}"
command: --replSet ${MONGO_REPLICA_SET} --port ${MONGO_1_PORT}
ports:
- "${MONGO_1_PORT}:${MONGO_1_PORT}"
volumes:
- ./storage/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
start_period: 30s
redis:
depends_on:
generateconfig-processing:
condition: service_healthy
image: "redis/redis-stack-server:${REDIS_VERSION}"
restart: always
command: redis-server --dir /data/ --appendonly yes --maxmemory 256mb --maxmemory-policy noeviction --protected-mode no --loadmodule /opt/redis-stack/lib/redisbloom.so
ports:
- "${REDIS_PORT}:${REDIS_PORT}"
volumes:
- ./storage/redis/:/data/
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
interval: 10s
timeout: 30s
retries: 3
minio:
image: "minio/minio:${MINIO_VERSION}"
restart: always
command: server /data --console-address ":${MINIO_WEB_PORT}" --address ":${MINIO_PORT}"
environment:
MINIO_ROOT_USER: "${AWS_ACCESS_KEY_ID}"
MINIO_ROOT_PASSWORD: "${AWS_SECRET_ACCESS_KEY}"
ports:
- "${EXTERNAL_MINIO_PORT}:${MINIO_PORT}"
- "${EXTERNAL_MINIO_WEB_PORT}:${MINIO_WEB_PORT}"
volumes:
- ./storage/minio:/data
healthcheck:
test: bash -c ':> /dev/tcp/127.0.0.1/${MINIO_PORT}' || exit 1
interval: 5s
timeout: 10s
retries: 3
networks:
default:
aliases:
- "${MINIO_BUCKET}.minio" # <bucket-name>.<endpoint-name>
create-bucket:
image: minio/mc:latest
environment:
MC_HOST_minio: http://${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}@minio:${MINIO_PORT}
restart: no
depends_on:
- minio
entrypoint:
- sh
- -c
- mc mb minio/${MINIO_BUCKET}
any-sync-coordinator_bootstrap:
image: "ghcr.io/anyproto/any-sync-coordinator:${ANY_SYNC_COORDINATOR_VERSION}"
depends_on:
generateconfig-processing:
condition: service_healthy
mongo-1:
condition: service_healthy
volumes:
- ./etc/any-sync-coordinator/:/etc/any-sync-coordinator/
restart: no
command: bash -c "/bin/any-sync-confapply -c /etc/any-sync-coordinator/config.yml -n /etc/any-sync-coordinator/network.yml -e"
any-sync-coordinator:
image: "ghcr.io/anyproto/any-sync-coordinator:${ANY_SYNC_COORDINATOR_VERSION}"
depends_on:
generateconfig-processing:
condition: service_healthy
mongo-1:
condition: service_healthy
any-sync-coordinator_bootstrap:
condition: service_completed_successfully
ports:
- "${ANY_SYNC_COORDINATOR_PORT}:${ANY_SYNC_COORDINATOR_PORT}"
- "${ANY_SYNC_COORDINATOR_QUIC_PORT}:${ANY_SYNC_COORDINATOR_QUIC_PORT}"
- 8005:8000
volumes:
- ./etc/any-sync-coordinator/:/etc/any-sync-coordinator/
- ./storage/networkStore/any-sync-coordinator/:/networkStore/
deploy:
resources:
limits:
memory: 500M
restart: on-failure
any-sync-filenode:
image: "ghcr.io/anyproto/any-sync-filenode:${ANY_SYNC_FILENODE_VERSION}"
depends_on:
redis:
condition: service_healthy
minio:
condition: service_healthy
any-sync-coordinator:
condition: service_started
ports:
- "${ANY_SYNC_FILENODE_PORT}:${ANY_SYNC_FILENODE_PORT}"
- "${ANY_SYNC_FILENODE_QUIC_PORT}:${ANY_SYNC_FILENODE_QUIC_PORT}"
- 8004:8000
volumes:
- ./etc/any-sync-filenode/:/etc/any-sync-filenode/
- ./etc/.aws:/root/.aws:ro
- ./storage/networkStore/any-sync-filenode/:/networkStore/
deploy:
resources:
limits:
memory: 500M
restart: on-failure
any-sync-node-1:
image: "ghcr.io/anyproto/any-sync-node:${ANY_SYNC_NODE_VERSION}"
depends_on:
any-sync-coordinator:
condition: service_started
ports:
- "${ANY_SYNC_NODE_1_PORT}:${ANY_SYNC_NODE_1_PORT}"
- "${ANY_SYNC_NODE_1_QUIC_PORT}:${ANY_SYNC_NODE_1_QUIC_PORT}"
- 8081:8080
- 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/
deploy:
resources:
limits:
memory: 500M
restart: on-failure
any-sync-node-2:
image: "ghcr.io/anyproto/any-sync-node:${ANY_SYNC_NODE_VERSION}"
depends_on:
any-sync-coordinator:
condition: service_started
ports:
- "${ANY_SYNC_NODE_2_PORT}:${ANY_SYNC_NODE_2_PORT}"
- "${ANY_SYNC_NODE_2_QUIC_PORT}:${ANY_SYNC_NODE_2_QUIC_PORT}"
- 8082:8080
- 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/
deploy:
resources:
limits:
memory: 500M
restart: on-failure
any-sync-node-3:
image: "ghcr.io/anyproto/any-sync-node:${ANY_SYNC_NODE_VERSION}"
depends_on:
any-sync-coordinator:
condition: service_started
ports:
- "${ANY_SYNC_NODE_3_PORT}:${ANY_SYNC_NODE_3_PORT}"
- "${ANY_SYNC_NODE_3_QUIC_PORT}:${ANY_SYNC_NODE_3_QUIC_PORT}"
- 8083:8080
- 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/
deploy:
resources:
limits:
memory: 500M
restart: on-failure
any-sync-consensusnode:
image: "ghcr.io/anyproto/any-sync-consensusnode:${ANY_SYNC_CONSENSUSNODE_VERSION}"
depends_on:
any-sync-coordinator:
condition: service_started
ports:
- "${ANY_SYNC_CONSENSUSNODE_PORT}:${ANY_SYNC_CONSENSUSNODE_PORT}"
- "${ANY_SYNC_CONSENSUSNODE_QUIC_PORT}:${ANY_SYNC_CONSENSUSNODE_QUIC_PORT}"
- 8006:8000
volumes:
- ./etc/any-sync-consensusnode/:/etc/any-sync-consensusnode/
- ./storage/networkStore/any-sync-consensusnode/:/networkStore/
deploy:
resources:
limits:
memory: 500M
restart: on-failure
any-sync-admin:
image: "ghcr.io/anyproto/any-sync-admin:${ANY_SYNC_ADMIN_VERSION}"
depends_on:
- redis
- mongo-1
ports:
- "${EXTERNAL_ANY_SYNC_ADMIN_PORT}:${ANY_SYNC_ADMIN_PORT}"
volumes:
- ./etc/any-sync-admin/:/etc/any-sync-admin/
restart: on-failure