-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
167 lines (161 loc) · 5.78 KB
/
docker-compose.yaml
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
version: "3.8"
services:
postgresdb:
image: postgres:latest
container_name: postgresdb
ports:
- ${PGDB_PORT:-5432}:5432
volumes:
- pgdb-volume:/data/postgres
environment:
POSTGRES_USER: ${PGDB_USER:-admin}
POSTGRES_PASSWORD: ${PGDB_PASSWORD:-12345678}
POSTGRES_DB: ${PGDB_NAME:-pgdb}
PGDATA: /data/postgres
networks:
- netproxy
healthcheck:
test: [ "CMD", "pg_isready", "-h", "postgresdb","-p","5432","-d","${PGDB_NAME:-pgdb}","-U","${PGDB_USER:-admin}", "-q" ]
timeout: 20s
interval: 3s
retries: 15
restart: always
migrations:
image: gotodotask/migrations:latest
container_name: todotask-migrations
build:
context: ./internal/migrations
dockerfile: Dockerfile
environment:
GOOSE_DRIVER: postgres
GOOSE_DBSTRING: postgres://${PGDB_USER:-admin}:${PGDB_PASSWORD:-12345678}@postgresdb:5432/${PGDB_NAME:-pgdb}?sslmode=disable
command: [ "-v","--dir","sqls","up" ]
depends_on:
- postgresdb
networks:
- netproxy
labels:
- traefik.enable=false
user:
image: gotodotask:latest
container_name: gotodotask-user
build:
context: .
dockerfile: Dockerfile
args:
GO_VERSION: "1.20"
ports:
- ${USER_GRPC_PORT:-6060}:3000
- ${USER_HTTP_PORT:-7070}:4000
environment:
DOMAIN: todotask.server
LOG_REQUEST: true
JWT_SECRET: DF6806F10F45D95ACF44
DATABASE_URL: postgres://${PGDB_USER:-admin}:${PGDB_PASSWORD:-12345678}@postgresdb:5432/${PGDB_NAME:-pgdb}?sslmode=disable
command:
- user
networks:
- netproxy
depends_on:
- postgresdb
restart: always
labels:
- "traefik.enable=true"
- "traefik.http.routers.user.entrypoints=web"
- "traefik.http.routers.user.rule=PathPrefix(`/v1/user`)"
- "traefik.http.services.user.loadbalancer.server.port=4000"
- "traefik.docker.network=netproxy"
- "traefik.http.middlewares.cors.headers.customResponseHeaders.Access-Control-Allow-Headers=Origin,X-Requested-With,Content-Type,Accept,Authorization,token"
- "traefik.http.middlewares.cors.headers.customResponseHeaders.Access-Control-Allow-Origin=*"
- "traefik.http.middlewares.cors.headers.customResponseHeaders.Access-Control-Allow-Methods=GET,POST,DELETE,OPTIONS,PUT"
- "traefik.http.middlewares.cors.headers.accessControlAllowMethods=GET,POST,DELETE,OPTIONS,PUT"
- "traefik.http.middlewares.cors.headers.accessControlAllowHeaders=Origin,X-Requested-With,Content-Type,Accept,Authorization,token"
- "traefik.http.middlewares.cors.headers.accessControlAllowOriginList=*"
- "traefik.http.middlewares.cors.headers.accessControlMaxAge=100"
- "traefik.http.middlewares.cors.headers.addVaryHeader=true"
- "traefik.http.routers.user.middlewares=cors"
taskmanager:
image: gotodotask:latest
container_name: gotodotask-taskmanager
build:
context: .
dockerfile: Dockerfile
args:
GO_VERSION: "1.20"
ports:
- ${TASK_MANAGER_GRPC_PORT:-3030}:3000
- ${TASK_MANAGER_HTTP_PORT:-4040}:4000
environment:
DOMAIN: todotask.server
LOG_REQUEST: true
JWT_SECRET: DF6806F10F45D95ACF44
DATABASE_URL: postgres://${PGDB_USER:-admin}:${PGDB_PASSWORD:-12345678}@postgresdb:5432/${PGDB_NAME:-pgdb}?sslmode=disable
command:
- taskmanager
networks:
- netproxy
depends_on:
- postgresdb
- user
restart: always
labels:
- "traefik.enable=true"
- "traefik.http.routers.taskmanager.entrypoints=web"
- "traefik.http.routers.taskmanager.rule=PathPrefix(`/v1/todotask`)"
- "traefik.http.services.taskmanager.loadbalancer.server.port=4000"
- "traefik.docker.network=netproxy"
- "traefik.http.middlewares.cors.headers.customResponseHeaders.Access-Control-Allow-Headers=Origin,X-Requested-With,Content-Type,Accept,Authorization,token"
- "traefik.http.middlewares.cors.headers.customResponseHeaders.Access-Control-Allow-Origin=*"
- "traefik.http.middlewares.cors.headers.customResponseHeaders.Access-Control-Allow-Methods=GET,POST,DELETE,OPTIONS,PUT"
- "traefik.http.middlewares.cors.headers.accessControlAllowMethods=GET,POST,DELETE,OPTIONS,PUT"
- "traefik.http.middlewares.cors.headers.accessControlAllowHeaders=Origin,X-Requested-With,Content-Type,Accept,Authorization,token"
- "traefik.http.middlewares.cors.headers.accessControlAllowOriginList=*"
- "traefik.http.middlewares.cors.headers.accessControlMaxAge=100"
- "traefik.http.middlewares.cors.headers.addVaryHeader=true"
- "traefik.http.routers.taskmanager.middlewares=cors"
webserver:
image: gotodotask:latest
container_name: gotodotask-webserver
build:
context: .
dockerfile: Dockerfile
args:
GO_VERSION: "1.20"
ports:
- ${WEB_SERVER_PORT:-7575}:4000
environment:
DOMAIN: http://todotask.server
command:
- webserver
networks:
- netproxy
restart: always
labels:
- "traefik.enable=true"
- "traefik.http.routers.webserver.entrypoints=web"
- "traefik.http.routers.webserver.rule=PathPrefix(`/`)"
- "traefik.http.services.webserver.loadbalancer.server.port=4000"
- "traefik.docker.network=netproxy"
traefik:
image: "traefik:2.9.8"
container_name: gotodotask-traefik
ports:
- "80:80"
- "443:443"
- "8080:8080"
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
# - "--providers.docker.useBindPortIP=true"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: always
networks:
- netproxy
networks:
netproxy:
driver: bridge
volumes:
pgdb-volume: