-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathcompose.external.yml
More file actions
110 lines (106 loc) · 3.44 KB
/
Copy pathcompose.external.yml
File metadata and controls
110 lines (106 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Example: Any-Sync-Bundle with external MongoDB and Redis services
#
# Usage:
# docker compose -f compose.external.yml up -d
#
# The bundle container runs alongside dedicated MongoDB and Redis instances.
services:
mongo:
image: docker.io/mongo:8.0.4
container_name: any-sync-bundle-mongo
command:
- "--replSet"
- "rs0"
- "--port"
- "27017"
restart: unless-stopped
volumes:
- ./data/mongo:/data
healthcheck:
test:
- CMD-SHELL
- |
test $$(mongosh --quiet --host localhost:27017 --eval "try { rs.initiate({_id:'rs0', members:[{_id:0, host:'mongo:27017'}]}).ok } catch (e) { rs.status().ok }") -eq 1
interval: 5s
timeout: 5s
retries: 12
start_period: 10s
redis:
image: docker.io/redis/redis-stack-server:7.4.0-v7
container_name: any-sync-bundle-redis
command:
- "redis-server"
- "--port"
- "6379"
- "--dir"
- "/data/"
- "--appendonly"
- "yes"
- "--maxmemory"
- "256mb"
- "--maxmemory-policy"
- "noeviction"
- "--protected-mode"
- "no"
- "--loadmodule"
- "/opt/redis-stack/lib/redisbloom.so"
restart: unless-stopped
volumes:
- ./data/redis:/data
healthcheck:
test: ["CMD", "redis-cli", "-h", "localhost", "-p", "6379", "ping"]
interval: 5s
timeout: 5s
retries: 12
start_period: 5s
any-sync-bundle:
image: ghcr.io/grishy/any-sync-bundle:1.4.3-2026-04-21-minimal
container_name: any-sync-bundle
restart: unless-stopped
depends_on:
mongo:
condition: service_healthy
redis:
condition: service_healthy
ports:
- "33010:33010"
- "33020:33020/udp"
volumes:
- ./data/bundle:/data
environment:
# Advertise addresses clients should use. Replace with server's hostname/IP.
ANY_SYNC_BUNDLE_INIT_EXTERNAL_ADDRS: "192.168.100.9"
ANY_SYNC_BUNDLE_INIT_MONGO_URI: "mongodb://mongo:27017/?replicaSet=rs0"
ANY_SYNC_BUNDLE_INIT_REDIS_URI: "redis://redis:6379/"
# Storage limit per space in bytes (default: 1 TiB)
# Examples: 1 GiB = 1073741824
# 10 GiB = 10737418240
# 150 GiB = 161061273600
# 1 TiB = 1099511627776 (default)
# 2 TiB = 2199023255552
# ANY_SYNC_BUNDLE_INIT_FILENODE_DEFAULT_LIMIT: "1099511627776"
# MongoDB 4.4 for CPUs without AVX instruction support (required by MongoDB 5.0+).
# More info: https://github.com/grishy/any-sync-bundle/pull/39
# Official recommendation: https://github.com/anyproto/any-sync-dockercompose/wiki/Troubleshooting-&-FAQ
# Uncomment the following block and comment out the MongoDB 8.0 block above.
# mongo:
# image: docker.io/mongo:4.4
# container_name: any-sync-bundle-mongo
# command:
# - "--replSet"
# - "rs0"
# - "--port"
# - "27017"
# restart: unless-stopped
# volumes:
# - ./data/mongo:/data/db
# healthcheck:
# test:
# - CMD-SHELL
# - |
# RESULT=$$(mongo --quiet --host 127.0.0.1:27017 --eval 'try { if (rs.status().ok === 1) 1; else { rs.initiate({_id:"rs0", members:[{_id:0, host:"mongo:27017"}]}); rs.status().ok; } } catch (e) { rs.initiate({_id:"rs0", members:[{_id:0, host:"mongo:27017"}]}); rs.status().ok; }')
# test "$$RESULT" = "1"
# interval: 5s
# timeout: 5s
# retries: 12
# start_period: 10s