-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.swarm.dev.yml
More file actions
1227 lines (1196 loc) · 46 KB
/
docker-compose.swarm.dev.yml
File metadata and controls
1227 lines (1196 loc) · 46 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 - Development Docker Swarm Configuration
# This setup uses Swarm mode for development and delegates DNS to the main deployment
# This file requires docker-compose.base.yml to be merged before use
# Usage: cat docker-compose.base.yml docker-compose.swarm.dev.yml | docker stack deploy -c - obiente
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: Use ingress mode for Swarm compatibility (host mode conflicts with overlay networks)
# To change binding, set POSTGRES_EXPOSE_PORT and POSTGRES_PORT_MODE environment variables
# Note: In Docker Swarm, services on overlay networks must use ingress mode for ports
# Examples:
# - POSTGRES_EXPOSE_PORT=5433 # Default port
# - POSTGRES_PORT_MODE=ingress # Use ingress mode (required for overlay networks)
# Note: Port 5432 is reserved for databases-service proxy ingress.
# Note: If you need host mode, the service must use network_mode: host (not compatible with overlay networks)
ports:
- target: 5432
published: ${POSTGRES_EXPOSE_PORT:-5433}
protocol: tcp
mode: ${POSTGRES_PORT_MODE:-ingress}
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: "2"
memory: 512M
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: Use ingress mode for Swarm compatibility (host mode conflicts with overlay networks)
# To change binding, set METRICS_DB_EXPOSE_PORT and METRICS_DB_PORT_MODE environment variables
# Note: In Docker Swarm, services on overlay networks must use ingress mode for ports
# Examples:
# - METRICS_DB_EXPOSE_PORT=5434 # Default port
# - METRICS_DB_PORT_MODE=ingress # Use ingress mode (required for overlay networks)
# Note: Keep distinct from POSTGRES_EXPOSE_PORT and databases-service proxy ports.
# Note: If you need host mode, the service must use network_mode: host (not compatible with overlay networks)
ports:
- target: 5432
published: ${METRICS_DB_EXPOSE_PORT:-5434}
protocol: tcp
mode: ${METRICS_DB_PORT_MODE:-ingress}
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: "2"
memory: 2G
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: Use ingress mode for Swarm compatibility (host mode conflicts with overlay networks)
# To change binding, set REDIS_EXPOSE_PORT and REDIS_PORT_MODE environment variables
# Note: In Docker Swarm, services on overlay networks must use ingress mode for ports
# Examples:
# - REDIS_EXPOSE_PORT=6379 # Default port
# - REDIS_PORT_MODE=ingress # Use ingress mode (required for overlay networks)
# Note: If you need host mode, the service must use network_mode: host (not compatible with overlay networks)
ports:
- target: 6379
published: ${REDIS_EXPOSE_PORT:-6379}
protocol: tcp
mode: ${REDIS_PORT_MODE:-ingress}
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
build:
context: .
dockerfile: apps/api-gateway/Dockerfile
environment:
PORT: 3001
<<: [*common-auth, *common-api-gateway]
ports:
- target: 3001
published: ${API_GATEWAY_PORT:-3001}
protocol: tcp
mode: ingress # Use ingress mode for Swarm compatibility (host mode conflicts with overlay networks)
deploy:
mode: replicated
replicas: 1
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.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"
- "traefik.http.routers.api-gateway.middlewares=api-gateway-retry"
- "traefik.http.services.api-gateway.loadbalancer.server.port=3001"
- "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=3s"
- "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"
# Circuit breaker removed from API gateway - gateway should always be accessible
- "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
build:
context: .
dockerfile: apps/auth-service/Dockerfile
environment:
PORT: 3002
<<: [*common-database, *common-metrics-db, *common-auth, *common-dashboard, *common-github]
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
labels:
- "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
build:
context: .
dockerfile: apps/organizations-service/Dockerfile
environment:
PORT: 3003
<<: [*common-database, *common-metrics-db, *common-auth, *common-smtp, *common-dashboard, *common-notifications]
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
labels:
- "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
build:
context: .
dockerfile: apps/billing-service/Dockerfile
environment:
PORT: 3004
<<: [*common-database, *common-metrics-db, *common-auth, *common-stripe, *common-dashboard, *common-notifications]
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
labels:
- "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
build:
context: .
dockerfile: apps/deployments-service/Dockerfile
environment:
PORT: 3005
<<: [*common-database, *common-metrics-db, *common-auth, *common-redis, *common-github, *common-orchestrator, *common-dns-delegation, *common-notifications]
ENABLE_SWARM: ${ENABLE_SWARM:-true} # Override to enable Swarm mode (default: true for Swarm deployment)
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.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"
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
# Game Servers Service - Microservice for game server management
gameservers-service:
image: ghcr.io/obiente/cloud-gameservers-service:latest
build:
context: .
dockerfile: apps/gameservers-service/Dockerfile
environment:
PORT: 3006
<<: [*common-database, *common-metrics-db, *common-auth, *common-notifications]
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/obiente/volumes:/var/lib/obiente/volumes
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
labels:
- "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
# Orchestrator Service - Microservice for container orchestration and metrics
orchestrator-service:
image: ghcr.io/obiente/cloud-orchestrator-service:latest
build:
context: .
dockerfile: apps/orchestrator-service/Dockerfile
environment:
PORT: 3007
<<: [*common-database, *common-metrics-db, *common-redis, *common-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: 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: "2"
memory: 512M
reservations:
cpus: "0.25"
memory: 128M
labels:
- "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
build:
context: .
dockerfile: apps/vps-service/Dockerfile
environment:
PORT: 3008
<<: [*common-database, *common-metrics-db, *common-auth, *common-orchestrator, *common-vps, *common-notifications, *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
labels:
- "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
build:
context: .
dockerfile: apps/support-service/Dockerfile
environment:
PORT: 3009
<<: [*common-database, *common-metrics-db, *common-auth]
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
labels:
- "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
build:
context: .
dockerfile: apps/audit-service/Dockerfile
environment:
PORT: 3010
<<: [*common-database, *common-metrics-db, *common-auth]
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
labels:
- "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
build:
context: .
dockerfile: apps/notifications-service/Dockerfile
environment:
PORT: 3012
<<: [*common-database, *common-metrics-db, *common-auth, *common-smtp, *common-dashboard, *common-notifications]
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
labels:
- "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
build:
context: .
dockerfile: apps/superadmin-service/Dockerfile
environment:
PORT: 3011
<<: [*common-database, *common-metrics-db, *common-auth, *common-stripe, *common-orchestrator, *common-vps, *common-notifications]
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
labels:
- "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
build:
context: .
dockerfile: apps/dns-service/Dockerfile
environment:
<<: [*common-database, *common-redis, *common-orchestrator, *common-dns]
HTTP_PORT: ${DNS_HTTP_PORT:-8053}
ports:
# Use host mode publishing to expose DNS port directly on the host
# DNS only runs on nodes labeled with dns.enabled=true
# Published port uses DNS_PORT environment variable (default: 53)
- target: 53
published: ${DNS_PORT:-53}
protocol: udp
mode: host
- target: 53
published: ${DNS_PORT:-53}
protocol: tcp
mode: host
cap_add:
- NET_BIND_SERVICE
deploy:
mode: replicated
replicas: ${DNS_REPLICAS:-1}
placement:
constraints:
- node.labels.dns.enabled == true
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
labels:
- "cloud.obiente.service=dns-service"
- "cloud.obiente.traefik=true"
- "traefik.enable=true"
- "traefik.http.routers.dns-service.rule=Host(`dns-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.dns-service.entrypoints=web"
- "traefik.http.services.dns-service.loadbalancer.server.port=8053"
- "traefik.http.routers.dns-service-secure.rule=Host(`dns-service.${DOMAIN:-localhost}`)"
- "traefik.http.routers.dns-service-secure.entrypoints=websecure"
- "traefik.http.routers.dns-service-secure.tls.certresolver=letsencrypt"
- "traefik.http.routers.dns-service-secure.service=dns-service"
- "traefik.docker.network=obiente_obiente-network" # Use overlay network IP, not ingress network
healthcheck:
test: ["CMD-SHELL", "if command -v nc >/dev/null 2>&1; then nc -z localhost ${DNS_PORT:-53} || exit 1; else (apk add --no-cache netcat-openbsd >/dev/null 2>&1 || apt-get update -qq && apt-get install -y -qq netcat-openbsd >/dev/null 2>&1 || yum install -y -q nc >/dev/null 2>&1) && nc -z localhost ${DNS_PORT:-53} || exit 1; fi"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
dns_search: []
networks:
- obiente-network
# VPS Gateway - gRPC gateway for VPS operations (optional)
vps-gateway:
image: ghcr.io/obiente/cloud-vps-gateway:latest
build:
context: .
dockerfile: apps/vps-gateway/Dockerfile
ports:
- target: 1537
published: 1537
protocol: tcp
mode: ingress # Use ingress mode for Swarm compatibility (host mode conflicts with overlay networks)
- target: 9091
published: 9091
protocol: tcp
mode: ingress # Use ingress mode for Swarm compatibility (host mode conflicts with overlay networks)
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.labels.vps-gateway.enabled == true
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
dns_search: []
networks:
- obiente-network
traefik:
image: traefik:v3.6.1
command:
- --api.dashboard=true
- --api.insecure=true # Enable API on port 8080 directly
- --providers.swarm=true # Use Swarm provider for Docker Swarm mode (v3.0)
- --providers.swarm.exposedbydefault=false
- --providers.swarm.watch=true # Watch for service changes
- --providers.swarm.refreshSeconds=5 # Poll Docker Swarm every 5 seconds for faster service discovery
- --providers.swarm.constraints=Label(`cloud.obiente.traefik`,`true`) # Only discover services with this label
# Timeout configuration to fail faster on unreachable backends
# dialTimeout: time to establish connection (increased to 10s to handle network delays)
- --serversTransport.forwardingTimeouts.dialTimeout=10s
# responseHeaderTimeout: time to wait for response headers
- --serversTransport.forwardingTimeouts.responseHeaderTimeout=15s
# idleConnTimeout: time to keep idle connections open
- --serversTransport.forwardingTimeouts.idleConnTimeout=90s
- --entryPoints.web.address=:80
- --entryPoints.web.forwardedHeaders.trustedIPs=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
- --entryPoints.websecure.address=:443
- --entryPoints.websecure.forwardedHeaders.trustedIPs=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
- --entryPoints.deployments.address=:8000
- --entryPoints.deployments.forwardedHeaders.trustedIPs=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
- --entryPoints.ssh.address=:${SSH_PROXY_PORT:-2222}
- --entryPoints.ssh.proxyProtocol.trustedIPs=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
# Database TCP ports are handled by databases-service proxy (not Traefik)
# Port 8080 is used by Traefik API (--api.insecure=true)
# Grafana is accessible via port 80/443 at /grafana
# Let's Encrypt
- --certificatesresolvers.letsencrypt.acme.email=${ACME_EMAIL:-admin@example.com}
- --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
- --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web
# Use Let's Encrypt staging environment if ACME_CA_SERVER is set to staging URL
# Set ACME_CA_SERVER=https://acme-staging-v02.api.letsencrypt.org/directory to avoid rate limits during testing
# Default: production (https://acme-v02.api.letsencrypt.org/directory)
- --certificatesresolvers.letsencrypt.acme.caserver=${ACME_CA_SERVER:-https://acme-v02.api.letsencrypt.org/directory}
# Metrics
- --metrics.prometheus=true
# Logging
- --accesslog=true
- --log.level=DEBUG # Enable debug logging to see service discovery
ports:
- target: 80
published: ${TRAEFIK_HTTP_PORT:-80}
protocol: tcp
mode: host # host mode preserves real client IPs (ingress mode causes SNAT)
- target: 443
published: ${TRAEFIK_HTTPS_PORT:-443}
protocol: tcp
mode: host # host mode preserves real client IPs (ingress mode causes SNAT)
- target: 8000
published: ${TRAEFIK_DEPLOYMENTS_PORT:-8000}
protocol: tcp
mode: host # host mode preserves real client IPs (ingress mode causes SNAT)
- target: 8080
published: ${TRAEFIK_DASHBOARD_PORT:-8080}
protocol: tcp
mode: host # Traefik dashboard accessible on port 8080
- target: ${SSH_PROXY_PORT:-2222}
published: ${TRAEFIK_SSH_PORT:-2222}
protocol: tcp
mode: host # host mode preserves real client IPs for SSH connections
# Database ports are handled by databases-service proxy
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- traefik_letsencrypt:/letsencrypt
deploy:
mode: global # Run one instance on each manager node
update_config:
parallelism: 1
order: start-first
placement:
constraints:
- node.role == manager # Only run on manager nodes
- node.labels.traefik.exclude != true # Exclude nodes labeled with traefik.exclude=true
resources:
limits:
cpus: "1"
memory: 512M
reservations:
cpus: "0.1"