-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.local.yml
170 lines (160 loc) · 4.14 KB
/
docker-compose.local.yml
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
version: "3.8"
services:
watchtower:
image: containrrr/watchtower:i386-1.7.1
container_name: watchtower
command:
- "--label-enable"
- "--interval"
- "86400"
- "--cleanup"
- "--rolling-restart"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ~/app/.docker/config.json:/root/.docker/config.json
environment:
- DOCKER_CONFIG=/root/.docker
- TZ=UTC
networks:
- gotiny-network
traefik:
image: traefik:v3.0
container_name: traefik
command:
- "--providers.docker"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- gotiny-network
postgres:
image: postgres:17.2-alpine
container_name: postgres
environment:
POSTGRES_USER: username
POSTGRES_PASSWORD: password
POSTGRES_DB: alloc
volumes:
- ./data/postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U username -d alloc"]
interval: 5s
timeout: 5s
retries: 5
networks:
- gotiny-network
labels:
- "traefik.enable=false"
mongodb:
image: mongo:8.0.3-alpine
container_name: mongodb
volumes:
- ./data/mongodb:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.stats()"]
interval: 5s
timeout: 5s
retries: 5
networks:
- gotiny-network
labels:
- "traefik.enable=false"
redis:
image: redis:7.4.1-alpine
container_name: redis
volumes:
- ./data/redis:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
networks:
- gotiny-network
labels:
- "traefik.enable=false"
range-allocator:
image: registry.utho.io/bitnaysh/rajnykdhulapkar/gotiny-range-allocator:main
container_name: range-allocator
environment:
RANGE_ALLOCATOR_DATABASE_URL: postgres://username:password@postgres:5432/alloc?sslmode=disable
RANGE_ALLOCATOR_GRPC_PORT: 50051
RANGE_ALLOCATOR_RANGE_DEFAULT_SIZE: 999
RANGE_ALLOCATOR_RANGE_MIN_SIZE: 100
RANGE_ALLOCATOR_RANGE_MAX_SIZE: 10000
depends_on:
postgres:
condition: service_healthy
healthcheck:
test:
[
"CMD",
"grpcurl",
"-plaintext",
"localhost:50051",
"rangeallocator.v1.RangeAllocator/GetHealth",
]
interval: 5s
timeout: 5s
retries: 5
networks:
- gotiny-network
labels:
- "traefik.enable=false"
- "com.centurylinklabs.watchtower.enable=true"
gotiny:
image: registry.utho.io/bitnaysh/rajnykdhulapkar/gotiny:main
container_name: gotiny
environment:
GOTINY_PORT: 8080
REDIS_URL: redis:6379
REDIS_PASSWORD: ""
RANGE_ALLOCATOR_ADDRESS: range-allocator:50051
SERVICE_ID: url-shortener
MONGODB_URI: mongodb://mongodb:27017
MONGODB_DATABASE: urlshortener
depends_on:
redis:
condition: service_healthy
mongodb:
condition: service_healthy
range-allocator:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 1h
timeout: 5s
retries: 3
networks:
- gotiny-network
labels:
- "traefik.enable=false"
- "com.centurylinklabs.watchtower.enable=true"
app:
image: registry.utho.io/bitnaysh/rajnykdhulapkar/gotiny-app:main
container_name: app
environment:
SHORT_URL_SERVICE_URL: "http://gotiny:8080"
NODE_ENV: "production"
SESSION_SECRET: "secret"
depends_on:
gotiny:
condition: service_healthy
networks:
- gotiny-network
labels:
- "traefik.enable=true"
- "traefik.http.routers.frontend.rule=Host(`localhost`)"
- "traefik.http.services.frontend.loadbalancer.server.port=3000"
- "com.centurylinklabs.watchtower.enable=true"
networks:
gotiny-network:
name: gotiny-network
driver: bridge
volumes:
postgres_data:
mongodb_data:
redis_data: