Repository navigation
Expand file tree
/
Copy pathdocker-compose.swarm.yml
More file actions
1400 lines (1365 loc) · 53.1 KB
/
Copy pathdocker-compose.swarm.yml
File metadata and controls
1400 lines (1365 loc) · 53.1 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Obiente Cloud - Docker Swarm Deployment
# This is a simplified setup. For high availability, use docker-compose.swarm.ha.yml
# This file requires docker-compose.base.yml to be merged before use.
# Use scripts/deploy-swarm.sh so required node ownership labels are preserved.
# Usage: ./scripts/deploy-swarm.sh obiente docker-compose.swarm.yml
# Swarm-specific common environment variables
# Override ENABLE_SWARM to default to true for Swarm deployments
x-common-swarm-orchestrator: &common-swarm-orchestrator
<<: [*common-orchestrator]
ENABLE_SWARM: ${ENABLE_SWARM:-true} # Default to true for Swarm stack deployments
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-obiente_postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-obiente_postgres}
POSTGRES_DB: ${POSTGRES_DB:-obiente}
# Configure PostgreSQL to listen on all interfaces (required for Docker Swarm overlay network)
POSTGRES_HOST_AUTH_METHOD: md5
# Overlay network subnet for pg_hba.conf configuration
OVERLAY_SUBNET: ${OVERLAY_SUBNET:-10.15.3.0/24}
# Allowed hosts for pg_hba.conf (comma-separated IPs or subnets, e.g., "10.10.10.1,10.0.0.0/8")
POSTGRES_ALLOWED_HOSTS: ${POSTGRES_ALLOWED_HOSTS:-}
command:
- postgres
- -c
- listen_addresses=*
- -c
- max_connections=200
# Port exposure configuration for Netbird VPN access
# Default: Exposed on localhost only (127.0.0.1) for security
# To change binding, set POSTGRES_EXPOSE_PORT and POSTGRES_PORT_MODE environment variables
# For localhost-only binding, use host mode (default) and configure firewall rules
# Examples:
# - POSTGRES_EXPOSE_PORT=5433 # Default: localhost only (requires firewall rules)
# - POSTGRES_PORT_MODE=host # Default: host mode for localhost binding
# Note: Port 5432 is reserved for databases-service proxy ingress.
# Note: Docker Swarm host mode binds to all interfaces by default
# Configure iptables/firewall to restrict to localhost: iptables -A INPUT -p tcp --dport 5433 -s 127.0.0.1 -j ACCEPT
ports:
- target: 5432
published: ${POSTGRES_EXPOSE_PORT:-5433}
protocol: tcp
mode: ${POSTGRES_PORT_MODE:-host}
volumes:
- postgres_data:/var/lib/postgresql/data
configs:
# Mount custom pg_hba.conf file and init script
- source: postgres_hba_conf
target: /docker-entrypoint-initdb.d/pg_hba.conf
mode: 0644
- source: postgres_hba_init
target: /docker-entrypoint-initdb.d/01-init-pg-hba.sh
mode: 0755
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-obiente_postgres} -d ${POSTGRES_DB:-obiente}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
deploy:
replicas: 1
placement:
constraints:
- node.labels.postgres.enabled == true
resources:
limits:
cpus: "4"
memory: 4G
reservations:
cpus: "0.25"
memory: 128M
dns_search: []
networks:
- obiente-network
timescaledb:
image: timescale/timescaledb:latest-pg16
environment:
POSTGRES_USER: ${METRICS_DB_USER:-obiente_postgres}
POSTGRES_PASSWORD: ${METRICS_DB_PASSWORD:-obiente_postgres}
POSTGRES_DB: ${METRICS_DB_NAME:-obiente_metrics}
# Configure PostgreSQL to listen on all interfaces (required for Docker Swarm overlay network)
POSTGRES_HOST_AUTH_METHOD: md5
# Overlay network subnet for pg_hba.conf configuration
OVERLAY_SUBNET: ${OVERLAY_SUBNET:-10.15.3.0/24}
# Allowed hosts for pg_hba.conf (comma-separated IPs or subnets, e.g., "10.10.10.1,10.0.0.0/8")
# Falls back to POSTGRES_ALLOWED_HOSTS if not set
POSTGRES_ALLOWED_HOSTS: ${METRICS_DB_ALLOWED_HOSTS:-${POSTGRES_ALLOWED_HOSTS:-}}
command:
- postgres
- -c
- listen_addresses=*
- -c
- max_connections=200
# Port exposure configuration for Netbird VPN access
# Default: Exposed on localhost only (127.0.0.1) for security
# To change binding, set METRICS_DB_EXPOSE_PORT and METRICS_DB_PORT_MODE environment variables
# For localhost-only binding, use host mode (default) and configure firewall rules
# Examples:
# - METRICS_DB_EXPOSE_PORT=5434 # Default: localhost only (requires firewall rules)
# - METRICS_DB_PORT_MODE=host # Default: host mode for localhost binding
# Note: Keep distinct from POSTGRES_EXPOSE_PORT and databases-service proxy ports.
# Note: Docker Swarm host mode binds to all interfaces by default
# Configure iptables/firewall to restrict to localhost: iptables -A INPUT -p tcp --dport 5434 -s 127.0.0.1 -j ACCEPT
ports:
- target: 5432
published: ${METRICS_DB_EXPOSE_PORT:-5434}
protocol: tcp
mode: ${METRICS_DB_PORT_MODE:-host}
volumes:
- timescaledb_data:/var/lib/postgresql/data
configs:
# Mount custom pg_hba.conf file and init script
- source: postgres_hba_conf
target: /docker-entrypoint-initdb.d/pg_hba.conf
mode: 0644
- source: postgres_hba_init
target: /docker-entrypoint-initdb.d/01-init-pg-hba.sh
mode: 0755
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${METRICS_DB_USER:-obiente_postgres} -d ${METRICS_DB_NAME:-obiente_metrics}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
deploy:
replicas: 1
placement:
constraints:
- node.labels.metrics.enabled == true
resources:
limits:
cpus: "4"
memory: 4G
reservations:
cpus: "0.25"
memory: 128M
dns_search: []
networks:
- obiente-network
redis:
image: redis:8-alpine
environment:
# Redis password authentication (required if port is exposed)
# If REDIS_PASSWORD is set, Redis will require authentication
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
command:
- sh
- -c
- |
if [ -n "$$REDIS_PASSWORD" ]; then
exec redis-server --appendonly yes --requirepass "$$REDIS_PASSWORD"
else
exec redis-server --appendonly yes
fi
# Port exposure configuration for Netbird VPN access
# Default: Exposed on localhost only (127.0.0.1) for security
# To change binding, set REDIS_EXPOSE_PORT and REDIS_PORT_MODE environment variables
# For localhost-only binding, use host mode (default) and configure firewall rules
# Examples:
# - REDIS_EXPOSE_PORT=6379 # Default: localhost only (requires firewall rules)
# - REDIS_PORT_MODE=host # Default: host mode for localhost binding
# Note: Docker Swarm host mode binds to all interfaces by default
# Configure iptables/firewall to restrict to localhost: iptables -A INPUT -p tcp --dport 6379 -s 127.0.0.1 -j ACCEPT
ports:
- target: 6379
published: ${REDIS_EXPOSE_PORT:-6379}
protocol: tcp
mode: ${REDIS_PORT_MODE:-host}
volumes:
- redis_data:/data
healthcheck:
# Health check with password support
# If REDIS_PASSWORD is set, use AUTH command
test: ["CMD-SHELL", "if [ -n \"$$REDIS_PASSWORD\" ]; then redis-cli -a \"$$REDIS_PASSWORD\" ping; else redis-cli ping; fi || exit 1"]
interval: 10s
timeout: 3s
retries: 5
start_period: 10s
deploy:
replicas: 1
placement:
constraints:
- node.labels.redis.enabled == true
resources:
limits:
cpus: "1"
memory: 512M
reservations:
cpus: "0.1"
memory: 128M
dns_search: []
networks:
- obiente-network
# ============================================================================
# MICROSERVICES
# ============================================================================
# All functionality has been moved from the monolithic API to microservices
# API Gateway (port 3001) is the primary entry point and routes to microservices
# API Gateway - Routes requests to all microservices
api-gateway:
image: ghcr.io/obiente/cloud-api-gateway:latest
environment:
PORT: 3001
<<: [*common-auth, *common-api-gateway]
ports:
- target: 3001
published: ${API_GATEWAY_PORT:-3001}
protocol: tcp
mode: ingress
deploy:
mode: replicated
replicas: 2
update_config:
parallelism: 1
delay: 10s
order: start-first
failure_action: rollback
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "1"
memory: 512M
reservations:
cpus: "0.1"
memory: 128M
labels:
- "cloud.obiente.service=api-gateway"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.api-gateway.rule=Host(`api.${DOMAIN:-localhost}`)"
- "traefik.http.routers.api-gateway.entrypoints=web"
- "traefik.http.routers.api-gateway.service=api-gateway"
# Retry middleware for transient failures
- "traefik.http.middlewares.api-gateway-retry.retry.attempts=3"
- "traefik.http.middlewares.api-gateway-retry.retry.initialInterval=100ms"
# Circuit breaker removed from API gateway - gateway should always be accessible
# Circuit breaker is applied to backend services, not the gateway itself
- "traefik.http.routers.api-gateway.middlewares=api-gateway-retry"
- "traefik.http.services.api-gateway.loadbalancer.server.port=3001"
- "traefik.docker.network=obiente_obiente-network" # Use overlay network IP, not ingress network
- "traefik.http.services.api-gateway.loadbalancer.passHostHeader=true"
- "traefik.http.services.api-gateway.loadbalancer.healthcheck.path=/health"
- "traefik.http.services.api-gateway.loadbalancer.healthcheck.interval=10s"
- "traefik.http.services.api-gateway.loadbalancer.healthcheck.timeout=8s"
- "traefik.http.services.api-gateway.loadbalancer.healthcheck.scheme=http"
- "traefik.http.services.api-gateway.loadbalancer.healthcheck.followRedirects=true"
- "traefik.http.routers.api-gateway-secure.rule=Host(`api.${DOMAIN:-localhost}`)"
- "traefik.http.routers.api-gateway-secure.entrypoints=websecure"
- "traefik.http.routers.api-gateway-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.api-gateway-secure.service=api-gateway"
- "traefik.http.routers.api-gateway-secure.middlewares=api-gateway-retry"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3001/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
# Auth Service - Microservice for authentication
auth-service:
image: ghcr.io/obiente/cloud-auth-service:latest
environment:
PORT: 3002
<<: [*common-database, *common-metrics-db, *common-auth, *common-dashboard, *common-github]
deploy:
mode: replicated
replicas: 2
update_config:
parallelism: 1
delay: 10s
order: start-first
restart_policy:
condition: any
delay: 10s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "1"
memory: 512M
reservations:
cpus: "0.1"
memory: 128M
labels:
- "cloud.obiente.service=auth-service"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.auth-service.rule=Host(`auth-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.auth-service.entrypoints=web"
- "traefik.http.services.auth-service.loadbalancer.server.port=3002"
- "traefik.http.routers.auth-service-secure.rule=Host(`auth-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.auth-service-secure.entrypoints=websecure"
- "traefik.http.routers.auth-service-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.auth-service-secure.service=auth-service"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3002/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
# Organizations Service - Microservice for organization management
organizations-service:
image: ghcr.io/obiente/cloud-organizations-service:latest
environment:
PORT: 3003
<<: [*common-database, *common-metrics-db, *common-auth, *common-smtp, *common-dashboard, *common-notifications]
deploy:
mode: replicated
replicas: 2
update_config:
parallelism: 1
delay: 10s
order: start-first
restart_policy:
condition: any
delay: 10s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "1"
memory: 512M
reservations:
cpus: "0.1"
memory: 128M
labels:
- "cloud.obiente.service=organizations-service"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.organizations-service.rule=Host(`organizations-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.organizations-service.entrypoints=web"
- "traefik.http.services.organizations-service.loadbalancer.server.port=3003"
- "traefik.http.routers.organizations-service-secure.rule=Host(`organizations-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.organizations-service-secure.entrypoints=websecure"
- "traefik.http.routers.organizations-service-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.organizations-service-secure.service=organizations-service"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3003/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
# Billing Service - Microservice for billing and Stripe integration
billing-service:
image: ghcr.io/obiente/cloud-billing-service:latest
environment:
PORT: 3004
<<: [*common-database, *common-metrics-db, *common-auth, *common-stripe, *common-dashboard, *common-notifications]
deploy:
mode: replicated
replicas: 2
update_config:
parallelism: 1
delay: 10s
order: start-first
restart_policy:
condition: any
delay: 10s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "1"
memory: 512M
reservations:
cpus: "0.1"
memory: 128M
labels:
- "cloud.obiente.service=billing-service"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.billing-service.rule=Host(`billing-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.billing-service.entrypoints=web"
- "traefik.http.services.billing-service.loadbalancer.server.port=3004"
- "traefik.http.routers.billing-service-secure.rule=Host(`billing-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.billing-service-secure.entrypoints=websecure"
- "traefik.http.routers.billing-service-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.billing-service-secure.service=billing-service"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3004/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
# Deployments Service - Microservice for deployment management
deployments-service:
image: ghcr.io/obiente/cloud-deployments-service:latest
environment:
PORT: 3005
STACK_NAME: __STACK_NAME__
DEPLOYMENTS_INTERNAL_SERVICE_SECRET: ${DEPLOYMENTS_INTERNAL_SERVICE_SECRET:-}
PREVIEW_STATUS_BASE_URL: ${PREVIEW_STATUS_BASE_URL:-}
<<: [*common-database, *common-metrics-db, *common-auth, *common-redis, *common-github, *common-swarm-orchestrator, *common-dns-delegation, *common-notifications, *common-dashboard]
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/obiente:/var/lib/obiente
- /var/obiente/tmp/obiente-volumes:/tmp/obiente-volumes
- /var/obiente/tmp/obiente-deployments:/tmp/obiente-deployments
deploy:
mode: global # One instance per node for local Docker access
update_config:
parallelism: 1
delay: 10s
order: start-first
failure_action: rollback
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "2"
memory: 2G
reservations:
cpus: "0.25"
memory: 128M
labels:
- "cloud.obiente.service=deployments-service"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.deployments-service.rule=Host(`deployments-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.deployments-service.entrypoints=web"
- "traefik.http.services.deployments-service.loadbalancer.server.port=3005"
- "traefik.http.routers.deployments-service-secure.rule=Host(`deployments-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.deployments-service-secure.entrypoints=websecure"
- "traefik.http.routers.deployments-service-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.deployments-service-secure.service=deployments-service"
- "traefik.http.routers.preview-status.rule=Host(`${DOMAIN:-localhost}`) && PathPrefix(`/previews/`)"
- "traefik.http.routers.preview-status.entrypoints=web"
- "traefik.http.routers.preview-status.priority=300"
- "traefik.http.routers.preview-status.service=deployments-service"
- "traefik.http.routers.preview-status-secure.rule=Host(`${DOMAIN:-localhost}`) && PathPrefix(`/previews/`)"
- "traefik.http.routers.preview-status-secure.entrypoints=websecure"
- "traefik.http.routers.preview-status-secure.priority=300"
- "traefik.http.routers.preview-status-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.preview-status-secure.service=deployments-service"
- "traefik.http.routers.preview-domain-fallback.rule=HostRegexp(`^pr-[a-z0-9-]+[.]my[.]obiente[.]cloud$$`)"
- "traefik.http.routers.preview-domain-fallback.entrypoints=web"
- "traefik.http.routers.preview-domain-fallback.priority=1"
- "traefik.http.routers.preview-domain-fallback.service=deployments-service"
- "traefik.http.routers.preview-domain-fallback-secure.rule=HostRegexp(`^pr-[a-z0-9-]+[.]my[.]obiente[.]cloud$$`)"
- "traefik.http.routers.preview-domain-fallback-secure.entrypoints=websecure"
- "traefik.http.routers.preview-domain-fallback-secure.priority=1"
- "traefik.http.routers.preview-domain-fallback-secure.tls=true"
- "traefik.http.routers.preview-domain-fallback-secure.service=deployments-service"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3005/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
# Databases Service - Microservice for managed database management
databases-service:
image: ghcr.io/obiente/cloud-databases-service:latest
environment:
PORT: 3014
ENABLE_SWARM: ${ENABLE_SWARM:-true}
DATABASES_SERVICE_MODE: control-plane
<<: [*common-database, *common-metrics-db, *common-auth, *common-redis]
deploy:
mode: replicated
replicas: 1
update_config:
parallelism: 1
delay: 10s
order: start-first
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "1"
memory: 512M
reservations:
cpus: "0.1"
memory: 128M
placement:
constraints:
# Keep all node-local provisioning/lifecycle calls on the same Docker
# daemon that owns managed database containers.
- node.labels.databases.enabled == true
labels:
- "cloud.obiente.service=databases-service"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.databases-service.rule=Host(`databases-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.databases-service.entrypoints=web"
- "traefik.http.services.databases-service.loadbalancer.server.port=3014"
- "traefik.docker.network=obiente_obiente-network" # Ensure Traefik targets the shared overlay network
- "traefik.http.routers.databases-service-secure.rule=Host(`databases-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.databases-service-secure.entrypoints=websecure"
- "traefik.http.routers.databases-service-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.databases-service-secure.service=databases-service"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3014/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
- obiente-databases
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# Global data-plane proxy. Every possible database owner node exposes the
# host-mode listeners used by owner-specific database DNS records.
databases-proxy:
image: ghcr.io/obiente/cloud-databases-service:latest
environment:
PORT: 3014
ENABLE_SWARM: ${ENABLE_SWARM:-true}
DATABASES_SERVICE_MODE: proxy
<<: [*common-database, *common-metrics-db, *common-auth, *common-redis]
deploy:
mode: global
update_config:
parallelism: 1
delay: 10s
order: stop-first
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "1"
memory: 512M
reservations:
cpus: "0.1"
memory: 128M
labels:
- "cloud.obiente.service=databases-proxy"
- "cloud.obiente.traefik=false"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3014/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
- obiente-databases
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ports:
- target: 5432
published: 5432
protocol: tcp
mode: host
- target: 3306
published: 3306
protocol: tcp
mode: host
- target: 27017
published: 27017
protocol: tcp
mode: host
# Redis uses port-per-instance in range 16379-16478 (host mode)
# Game Servers Service - Microservice for game server management
gameservers-service:
image: ghcr.io/obiente/cloud-gameservers-service:latest
environment:
PORT: 3006
DOMAIN: ${DOMAIN:-localhost}
FILE_TRANSFER_PUBLIC_HOST: ${FILE_TRANSFER_PUBLIC_HOST:-}
FILE_TRANSFER_SFTP_PUBLIC_PORT: ${FILE_TRANSFER_SFTP_PUBLIC_PORT:-2223}
<<: [*common-database, *common-metrics-db, *common-auth, *common-swarm-orchestrator, *common-notifications, *common-redis]
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/obiente/volumes:/var/lib/obiente/volumes
deploy:
mode: replicated
replicas: 2
update_config:
parallelism: 1
delay: 10s
order: start-first
restart_policy:
condition: any
delay: 10s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "2"
memory: 10G
reservations:
cpus: "0.1"
memory: 128M
labels:
- "cloud.obiente.service=gameservers-service"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.gameservers-service.rule=Host(`gameservers-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.gameservers-service.entrypoints=web"
- "traefik.http.services.gameservers-service.loadbalancer.server.port=3006"
- "traefik.http.routers.gameservers-service-secure.rule=Host(`gameservers-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.gameservers-service-secure.entrypoints=websecure"
- "traefik.http.routers.gameservers-service-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.gameservers-service-secure.service=gameservers-service"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3006/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
file-transfer-service:
image: ghcr.io/obiente/cloud-file-transfer-service:latest
environment:
PORT: 3022
SFTP_PORT: 2222
FILE_TRANSFER_VOLUME_ROOT: /var/lib/obiente/volumes
SFTP_HOST_KEY_PATH: /var/lib/obiente/file-transfer/ssh_host_key
<<: [*common-database, *common-auth, *common-redis]
volumes:
- /var/lib/obiente/volumes:/var/lib/obiente/volumes
- file_transfer_host_key:/var/lib/obiente/file-transfer
ports:
- target: 2222
published: ${FILE_TRANSFER_SFTP_PUBLIC_PORT:-2223}
protocol: tcp
mode: host
deploy:
mode: global
update_config:
parallelism: 1
order: start-first
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "1"
memory: 512M
reservations:
cpus: "0.05"
memory: 64M
labels:
- "cloud.obiente.service=file-transfer-service"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.file-transfer-service.rule=Host(`file-transfer-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.file-transfer-service.entrypoints=web"
- "traefik.http.services.file-transfer-service.loadbalancer.server.port=3022"
- "traefik.http.routers.file-transfer-service-secure.rule=Host(`file-transfer-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.file-transfer-service-secure.entrypoints=websecure"
- "traefik.http.routers.file-transfer-service-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.file-transfer-service-secure.service=file-transfer-service"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3022/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
# Orchestrator Service - Microservice for container orchestration and metrics
orchestrator-service:
image: ghcr.io/obiente/cloud-orchestrator-service:latest
environment:
PORT: 3007
<<: [*common-database, *common-metrics-db, *common-redis, *common-swarm-orchestrator, *common-vps, *common-dns-delegation, *common-notifications]
ORCHESTRATOR_SYNC_INTERVAL: ${ORCHESTRATOR_SYNC_INTERVAL:-30s}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
mode: replicated
replicas: 2
update_config:
parallelism: 1
delay: 10s
order: start-first
restart_policy:
condition: any
delay: 10s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "2"
memory: 512M
reservations:
cpus: "0.25"
memory: 128M
labels:
- "cloud.obiente.service=orchestrator-service"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.orchestrator-service.rule=Host(`orchestrator-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.orchestrator-service.entrypoints=web"
- "traefik.http.services.orchestrator-service.loadbalancer.server.port=3007"
- "traefik.http.routers.orchestrator-service-secure.rule=Host(`orchestrator-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.orchestrator-service-secure.entrypoints=websecure"
- "traefik.http.routers.orchestrator-service-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.orchestrator-service-secure.service=orchestrator-service"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3007/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
# VPS Service - Microservice for VPS management
vps-service:
image: ghcr.io/obiente/cloud-vps-service:latest
environment:
PORT: 3008
<<: [*common-database, *common-metrics-db, *common-auth, *common-swarm-orchestrator, *common-vps, *common-notifications, *common-redis]
secrets:
- ssh_proxy_host_key
deploy:
mode: replicated
replicas: 2
update_config:
parallelism: 1
delay: 10s
order: start-first
restart_policy:
condition: any
delay: 10s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "1"
memory: 512M
reservations:
cpus: "0.1"
memory: 128M
labels:
- "cloud.obiente.service=vps-service"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.vps-service.rule=Host(`vps-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.vps-service.entrypoints=web"
- "traefik.http.services.vps-service.loadbalancer.server.port=3008"
- "traefik.http.routers.vps-service-secure.rule=Host(`vps-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.vps-service-secure.entrypoints=websecure"
- "traefik.http.routers.vps-service-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.vps-service-secure.service=vps-service"
# SSH TCP routing through Traefik (SSH proxy runs in vps-service)
- "traefik.tcp.routers.ssh.rule=HostSNI(`*`)"
- "traefik.tcp.routers.ssh.entrypoints=ssh"
- "traefik.tcp.routers.ssh.service=ssh"
- "traefik.tcp.services.ssh.loadbalancer.server.port=${SSH_PROXY_PORT:-2222}"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3008/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
# Support Service - Microservice for support ticket management
support-service:
image: ghcr.io/obiente/cloud-support-service:latest
environment:
PORT: 3009
<<: [*common-database, *common-metrics-db, *common-auth]
deploy:
mode: replicated
replicas: 2
update_config:
parallelism: 1
delay: 10s
order: start-first
restart_policy:
condition: any
delay: 10s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "1"
memory: 512M
reservations:
cpus: "0.1"
memory: 128M
labels:
- "cloud.obiente.service=support-service"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.support-service.rule=Host(`support-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.support-service.entrypoints=web"
- "traefik.http.services.support-service.loadbalancer.server.port=3009"
- "traefik.http.routers.support-service-secure.rule=Host(`support-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.support-service-secure.entrypoints=websecure"
- "traefik.http.routers.support-service-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.support-service-secure.service=support-service"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3009/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
# Audit Service - Microservice for audit log management
audit-service:
image: ghcr.io/obiente/cloud-audit-service:latest
environment:
PORT: 3010
<<: [*common-database, *common-metrics-db, *common-auth]
deploy:
mode: replicated
replicas: 2
update_config:
parallelism: 1
delay: 10s
order: start-first
restart_policy:
condition: any
delay: 10s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "1"
memory: 512M
reservations:
cpus: "0.1"
memory: 128M
labels:
- "cloud.obiente.service=audit-service"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.audit-service.rule=Host(`audit-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.audit-service.entrypoints=web"
- "traefik.http.services.audit-service.loadbalancer.server.port=3010"
- "traefik.http.routers.audit-service-secure.rule=Host(`audit-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.audit-service-secure.entrypoints=websecure"
- "traefik.http.routers.audit-service-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.audit-service-secure.service=audit-service"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3010/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
notifications-service:
image: ghcr.io/obiente/cloud-notifications-service:latest
environment:
PORT: 3012
<<: [*common-database, *common-metrics-db, *common-auth, *common-smtp, *common-dashboard, *common-notifications]
deploy:
mode: replicated
replicas: 2
update_config:
parallelism: 1
delay: 10s
order: start-first
restart_policy:
condition: any
delay: 10s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "1"
memory: 512M
reservations:
cpus: "0.1"
memory: 128M
labels:
- "cloud.obiente.service=notifications-service"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.notifications-service.rule=Host(`notifications-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.notifications-service.entrypoints=web"
- "traefik.http.services.notifications-service.loadbalancer.server.port=3012"
- "traefik.http.routers.notifications-service-secure.rule=Host(`notifications-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.notifications-service-secure.entrypoints=websecure"
- "traefik.http.routers.notifications-service-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.notifications-service-secure.service=notifications-service"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3012/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
# Superadmin Service - Microservice for superadmin operations
superadmin-service:
image: ghcr.io/obiente/cloud-superadmin-service:latest
environment:
PORT: 3011
<<: [*common-database, *common-metrics-db, *common-auth, *common-stripe, *common-swarm-orchestrator, *common-vps, *common-notifications]
deploy:
mode: replicated
replicas: 1
update_config:
parallelism: 1
delay: 10s
order: start-first
restart_policy:
condition: any
delay: 10s
max_attempts: 10
window: 60s
resources:
limits:
cpus: "1"
memory: 512M
reservations:
cpus: "0.1"
memory: 128M
labels:
- "cloud.obiente.service=superadmin-service"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.superadmin-service.rule=Host(`superadmin-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.superadmin-service.entrypoints=web"
- "traefik.http.services.superadmin-service.loadbalancer.server.port=3011"
- "traefik.http.routers.superadmin-service-secure.rule=Host(`superadmin-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.superadmin-service-secure.entrypoints=websecure"
- "traefik.http.routers.superadmin-service-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.superadmin-service-secure.service=superadmin-service"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3011/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
# DNS Service - Microservice for DNS resolution
# Set ENABLE_DNS=false to disable this service when using DNS delegation
dns-service:
image: ghcr.io/obiente/cloud-dns-service:latest
environment:
<<: [*common-database, *common-redis, *common-swarm-orchestrator, *common-dns, *common-dns-delegation]
HTTP_PORT: ${DNS_HTTP_PORT:-8053}
ports:
# Use host mode publishing to expose DNS port directly on the host