Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
113 lines (108 loc) · 3.06 KB
/
Copy pathdocker-compose.yml
File metadata and controls
113 lines (108 loc) · 3.06 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
services:
postgres:
image: postgres:15-alpine
container_name: postgres_db
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- app-network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER}"]
interval: 10s
timeout: 5s
retries: 5
backend:
build:
context: . # Build from current root directory
dockerfile: Dockerfile.backend # Dockerfile.dev for prod
container_name: go_backend
ports:
- "8000:8000"
environment:
DB_HOST: postgres
DB_PORT: 5432
DB_NAME: ${DB_NAME}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
SSL_MODE: disable
AWS_REGION: ${AWS_REGION}
S3_BUCKET: ${S3_BUCKET}
AWS_OIDC_AUDIENCE: ${AWS_OIDC_AUDIENCE}
AWS_ROLE_ARN: ${AWS_ROLE_ARN}
PORT: ${PORT}
LOCATION: ${LOCATION}
FRONTEND_URL: ${FRONTEND_URL}
GO_ENV: ${GO_ENV}
BACKEND_DOMAIN: ${BACKEND_DOMAIN}
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
GOOGLE_REDIRECT_URL: ${GOOGLE_REDIRECT_URL}
JWT_SECRET: ${JWT_SECRET}
GMAIL_USER: ${GMAIL_USER}
GMAIL_APP_PASSWORD: ${GMAIL_APP_PASSWORD}
OTEL_EXPORTER_OTLP_ENDPOINT: "jaeger:4317"
# GOOGLE_APPLICATION_CREDENTIALS: /app/sa.json # for local
depends_on:
jaeger:
condition: service_started
postgres:
condition: service_healthy
networks:
- app-network
restart: unless-stopped
# For development with hot-reload (optional)
volumes:
# - ./gcp-service-account.json:/app/sa.json # for local
- ./:/app # Mount entire root for development
- /go/pkg/mod # Prevents re-downloading modules if you restart
- /app/tmp # Exclude temp folder if using air for hot-reload
nginx:
image: nginx:alpine
container_name: nginx_proxy
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
- /etc/letsencrypt:/etc/letsencrypt:ro
depends_on:
- backend
networks:
- app-network
# Jaeger: The Tracing Backend
jaeger:
image: jaegertracing/all-in-one:1.51
container_name: jaeger
environment:
- COLLECTOR_OTLP_ENABLED=true
networks:
- app-network
ports:
- "16686:16686" # Jaeger UI
- "4317:4317" # OTLP gRPC (Where Go sends traces)
- "4318:4318" # OTLP HTTP
# Prometheus: The Metrics Store
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
extra_hosts:
# This maps the name "backend_host" to whatever IP you provide.
# If BACKEND_IP is empty, it defaults to host.docker.internal.
- "backend_host:${BACKEND_IP:-host-gateway}"
networks:
- app-network
ports:
- "9090:9090"
volumes:
postgres_data:
networks:
app-network:
driver: bridge