Monorepo for Tangled
tangled.org
1services:
2 redis:
3 image: redis:7-alpine
4 restart: unless-stopped
5 networks: [tngl]
6
7 postgres:
8 image: postgres:14-alpine
9 restart: unless-stopped
10 environment:
11 POSTGRES_USER: tnglr
12 POSTGRES_PASSWORD: tnglr
13 volumes:
14 - postgres-data:/var/lib/postgresql/data
15 - ./localinfra/postgres-init.sql:/docker-entrypoint-initdb.d/init.sql
16 healthcheck:
17 test: ["CMD-SHELL", "pg_isready -U tnglr -d plc"]
18 interval: 2s
19 timeout: 2s
20 retries: 30
21 start_period: 5s
22 networks: [tngl]
23
24 pds:
25 image: ghcr.io/bluesky-social/pds:0.4.219
26 restart: unless-stopped
27 env_file: localinfra/pds.env
28 environment:
29 PDS_DID_PLC_URL: http://plc:8080
30 NODE_EXTRA_CA_CERTS: /caddy-ca/root.crt
31 volumes:
32 - pds-data:/pds
33 - ./localinfra/certs/root.crt:/caddy-ca/root.crt:ro
34 healthcheck:
35 test: ["CMD", "wget", "-qO-", "http://localhost:3000/xrpc/_health"]
36 interval: 2s
37 timeout: 2s
38 retries: 30
39 start_period: 5s
40 depends_on:
41 plc:
42 condition: service_started
43 networks: [tngl]
44
45 init-accounts:
46 image: alpine:3.22
47 restart: "no"
48 env_file: localinfra/pds.env
49 environment:
50 PDS_URL: http://pds:3000
51 OWNER_USER: alice
52 KNOT_HOSTNAME: knot.tngl.boltless.dev
53 SPINDLE_HOSTNAME: spindle.tngl.boltless.dev
54 volumes:
55 - ./localinfra/scripts/init-accounts.sh:/init.sh:ro
56 - init-state:/shared
57 command: sh -c "apk add --no-cache curl jq >/dev/null && sh /init.sh"
58 depends_on:
59 pds:
60 condition: service_healthy
61 networks: [tngl]
62
63 plc:
64 platform: linux/amd64
65 image: ghcr.io/bluesky-social/did-method-plc:plc-f2ab7516bac5bc0f3f86842fa94e996bd1b3815b
66 restart: unless-stopped
67 environment:
68 DEBUG_MODE: "1"
69 LOG_ENABLED: "true"
70 LOG_LEVEL: debug
71 LOG_DESTINATION: "1"
72 PLC_VERSION: 0.0.1
73 PORT: "8080"
74 DB_CREDS_JSON: &DB_CREDS_JSON '{"username":"tnglr","password":"tnglr","host":"postgres","port":5432}'
75 DB_MIGRATE_CREDS_JSON: *DB_CREDS_JSON
76 depends_on: [postgres]
77 networks: [tngl]
78
79 jetstream:
80 platform: linux/amd64
81 image: ghcr.io/bluesky-social/jetstream:sha-d5a3b62
82 restart: unless-stopped
83 environment:
84 JETSTREAM_DATA_DIR: /data
85 JETSTREAM_LIVENESS_TTL: 300s
86 JETSTREAM_WS_URL: wss://pds.tngl.boltless.dev/xrpc/com.atproto.sync.subscribeRepos
87 volumes:
88 - jetstream-data:/data
89 - ./localinfra/certs/root.crt:/etc/ssl/certs/ca-certificates.crt:ro
90 depends_on:
91 pds:
92 condition: service_healthy
93 networks: [tngl]
94
95 knot:
96 build:
97 context: .
98 dockerfile: localinfra/knot.Dockerfile
99 restart: unless-stopped
100 environment:
101 KNOT_SERVER_HOSTNAME: knot.tngl.boltless.dev
102 KNOT_SERVER_LISTEN_ADDR: 0.0.0.0:5555
103 KNOT_SERVER_INTERNAL_LISTEN_ADDR: 127.0.0.1:5444
104 KNOT_SERVER_DB_PATH: /home/git/knotserver.db
105 KNOT_SERVER_PLC_URL: https://plc.tngl.boltless.dev
106 KNOT_SERVER_JETSTREAM_ENDPOINT: wss://jetstream.tngl.boltless.dev/subscribe
107 KNOT_SERVER_DEV: "false"
108 KNOT_REPO_SCAN_PATH: /home/git/repositories
109 APPVIEW_ENDPOINT: https://tangled.org
110 KNOT_MIRRORS: https://mirror.tngl.boltless.dev
111 ports:
112 - "2222:22"
113 volumes:
114 - knot-data:/home/git
115 - knot-ssh-keys:/etc/ssh/keys
116 - init-state:/shared:ro
117 - ./localinfra/certs/root.crt:/usr/local/share/ca-certificates/caddy.crt:ro
118 healthcheck:
119 test: ["CMD", "wget", "-qO-", "http://localhost:5555/"]
120 interval: 2s
121 timeout: 2s
122 retries: 60
123 start_period: 30s
124 depends_on:
125 plc:
126 condition: service_started
127 jetstream:
128 condition: service_started
129 knotmirror:
130 condition: service_healthy
131 init-accounts:
132 condition: service_completed_successfully
133 networks: [tngl]
134
135 spindle:
136 build:
137 context: .
138 dockerfile: localinfra/spindle.Dockerfile
139 restart: unless-stopped
140 environment:
141 SPINDLE_SERVER_HOSTNAME: spindle.tngl.boltless.dev
142 SPINDLE_SERVER_LISTEN_ADDR: 0.0.0.0:6555
143 SPINDLE_SERVER_DB_PATH: /var/lib/spindle/spindle.db
144 SPINDLE_SERVER_PLC_URL: https://plc.tngl.boltless.dev
145 SPINDLE_SERVER_JETSTREAM_ENDPOINT: wss://jetstream.tngl.boltless.dev/subscribe
146 SPINDLE_SERVER_DEV: "true"
147 SPINDLE_SERVER_DEV_EXTRA_HOSTS: knot.tngl.boltless.dev,mirror.tngl.boltless.dev
148 SPINDLE_SERVER_TAP_DB_PATH: /var/lib/spindle/tap.db
149 SPINDLE_SERVER_TAP_RELAY_URL: https://pds.tngl.boltless.dev
150 SPINDLE_MICROVM_PIPELINES_IMAGE_DIR: /var/lib/spindle/images
151 SPINDLE_MICROVM_PIPELINES_OVERLAY_DIR: /var/lib/spindle/overlays
152 SPINDLE_MICROVM_PIPELINES_AGENT_PORT: "11240"
153 SPINDLE_S3_LOG_BUCKET: ""
154 SPINDLE_MICROVM_PIPELINES_ENABLE_CGROUPS: "false"
155 # these two are required for cgroups, uncomment if testing
156 # privileged: true
157 # cgroup: host
158 devices:
159 - /dev/vsock:/dev/vsock
160 - /dev/kvm:/dev/kvm
161 - /dev/vhost-vsock:/dev/vhost-vsock
162 - /dev/net/tun:/dev/net/tun
163 cap_add:
164 - NET_ADMIN
165 - SYS_ADMIN
166 security_opt:
167 - label=disable
168 - seccomp=unconfined
169 volumes:
170 - spindle-data:/var/lib/spindle
171 - spindle-logs:/var/log/spindle
172 - ./out/localinfra-spindle-images:/var/lib/spindle/images:ro
173 - init-state:/shared:ro
174 - ./localinfra/certs/root.crt:/usr/local/share/ca-certificates/caddy.crt:ro
175 healthcheck:
176 test: ["CMD", "wget", "-qO-", "http://localhost:6555/"]
177 interval: 2s
178 timeout: 2s
179 retries: 30
180 start_period: 5s
181 depends_on:
182 plc:
183 condition: service_started
184 jetstream:
185 condition: service_started
186 init-accounts:
187 condition: service_completed_successfully
188 networks: [tngl]
189
190 knotmirror-tap:
191 image: ghcr.io/bluesky-social/indigo/tap:sha-4f47add43060c27e8a37d9d76482ecddf001fcd8 # 0.1.10
192 restart: unless-stopped
193 environment:
194 TAP_BIND: ":2480"
195 TAP_PLC_URL: https://plc.tngl.boltless.dev
196 TAP_RELAY_URL: https://pds.tngl.boltless.dev # PDS can be used as basic relay without collectiondir.
197 TAP_DATABASE_URL: postgres://tnglr:tnglr@postgres:5432/mirror_tap?sslmode=disable
198 TAP_COLLECTION_FILTERS: sh.tangled.repo
199 TAP_SIGNAL_COLLECTION: sh.tangled.repo
200 TAP_RESYNC_PARALLELISM: "10"
201 TAP_RETRY_TIMEOUT: 60s
202 volumes:
203 - ./localinfra/certs/root.crt:/etc/ssl/certs/ca-certificates.crt:ro
204 depends_on:
205 postgres:
206 condition: service_started
207 pds:
208 condition: service_healthy
209 networks: [tngl]
210
211 knotmirror:
212 build:
213 context: .
214 dockerfile: localinfra/knotmirror.Dockerfile
215 restart: unless-stopped
216 environment:
217 MIRROR_LISTEN: 0.0.0.0:7000
218 MIRROR_ADMIN_LISTEN: 0.0.0.0:7200
219 MIRROR_HOSTNAME: mirror.tngl.boltless.dev
220 MIRROR_TAP_URL: http://knotmirror-tap:2480
221 MIRROR_DB_URL: postgres://tnglr:tnglr@postgres:5432/mirror?sslmode=disable
222 MIRROR_REDIS_ADDR: redis:6379
223 MIRROR_PLC_URL: https://plc.tngl.boltless.dev
224 MIRROR_GIT_BASEPATH: /data/repos
225 MIRROR_KNOT_USE_SSL: "true"
226 MIRROR_KNOT_SSRF: "true"
227 MIRROR_RESYNC_PARALLELISM: "4"
228 volumes:
229 - knotmirror-data:/data
230 - ./localinfra/certs/root.crt:/usr/local/share/ca-certificates/caddy.crt:ro
231 healthcheck:
232 test: ["CMD", "wget", "-qO-", "http://localhost:7000/"]
233 interval: 2s
234 timeout: 2s
235 retries: 30
236 start_period: 5s
237 ports:
238 - "7201:7200"
239 depends_on:
240 postgres:
241 condition: service_started
242 knotmirror-tap:
243 condition: service_started
244 networks: [tngl]
245
246 tailwind:
247 image: d3fk/tailwindcss:v3
248 restart: unless-stopped
249 working_dir: /build
250 init: true
251 environment:
252 BROWSERSLIST_IGNORE_OLD_DATA: "true"
253 volumes:
254 - ./tailwind.config.js:/build/tailwind.config.js:ro
255 - ./input.css:/build/input.css:ro
256 - ./appview/pages/templates:/build/appview/pages/templates:ro
257 - ./docs:/build/docs:ro
258 - ./blog/templates:/build/blog/templates:ro
259 - ./blog/posts:/build/blog/posts:ro
260 - ./appview/pages/static:/build/appview/pages/static
261 command:
262 ["-i", "input.css", "-o", "appview/pages/static/tw.css", "--watch=always"]
263 network_mode: none
264
265 appview:
266 build:
267 context: .
268 dockerfile: localinfra/appview.Dockerfile
269 restart: unless-stopped
270 environment:
271 TANGLED_DEV: "true"
272 TANGLED_APPVIEW_HOST: 127.0.0.1:3000
273 TANGLED_DB_PATH: /var/lib/appview/appview.db
274 TANGLED_PLC_URL: https://plc.tngl.boltless.dev
275 TANGLED_JETSTREAM_ENDPOINT: wss://jetstream.tngl.boltless.dev/subscribe
276 TANGLED_REDIS_ADDR: redis:6379
277 TANGLED_KNOTMIRROR_URL: https://mirror.tngl.boltless.dev
278 ports:
279 - "3000:3000"
280 volumes:
281 - .:/src:cached
282 - go-cache:/go/cache
283 - go-mod-cache:/go/mod
284 - appview-data:/var/lib/appview
285 - init-state:/shared:ro
286 - ./localinfra/certs/root.crt:/usr/local/share/ca-certificates/caddy.crt:ro
287 depends_on:
288 redis:
289 condition: service_started
290 pds:
291 condition: service_healthy
292 init-accounts:
293 condition: service_completed_successfully
294 networks: [tngl]
295
296 caddy:
297 image: caddy:2-alpine
298 restart: unless-stopped
299 ports:
300 - "80:80"
301 - "443:443"
302 volumes:
303 - ./localinfra/Caddyfile:/etc/caddy/Caddyfile
304 - ./localinfra/certs:/etc/caddy/certs:ro
305 - caddy-data:/data
306 networks:
307 tngl:
308 aliases:
309 - plc.tngl.boltless.dev
310 - pds.tngl.boltless.dev
311 - alice.pds.tngl.boltless.dev
312 - bob.pds.tngl.boltless.dev
313 - jetstream.tngl.boltless.dev
314 - knot.tngl.boltless.dev
315 - spindle.tngl.boltless.dev
316 - tngl.boltless.dev
317 - mirror.tngl.boltless.dev
318
319volumes:
320 caddy-data:
321 postgres-data:
322 pds-data:
323 jetstream-data:
324 knot-data:
325 knot-ssh-keys:
326 knotmirror-data:
327 spindle-data:
328 spindle-logs:
329 init-state:
330 go-cache:
331 go-mod-cache:
332 appview-data:
333
334networks:
335 tngl:
336 driver: bridge
337 # Public-looking subnet so SSRF checks see container IPs as "public".
338 # RFC1918 + doc/benchmark ranges are blocklisted; 11.x is unrouted on
339 # the public internet, so it passes the check and won't collide.
340 ipam:
341 config:
342 - subnet: 11.0.0.0/24