-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
docker-compose.yml
152 lines (144 loc) · 3.85 KB
/
docker-compose.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
version: '3'
x-postgres:
&postgres-common
image: "ankane/pgvector:v0.5.1"
user: postgres
healthcheck:
test: "exit 0"
interval: 2s
timeout: 12s
retries: 3
services:
postgres:
<<: *postgres-common
container_name: "omnivore-postgres"
expose:
- 5432
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: omnivore
PG_POOL_MAX: 20
POSTGRES_HOST_AUTH_METHOD: "scram-sha-256\nhost replication all 0.0.0.0/0 md5"
POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256
command: |
postgres
-c wal_level=replica
-c hot_standby=on
-c max_wal_senders=10
-c max_replication_slots=10
-c hot_standby_feedback=on
postgres-replica:
<<: *postgres-common
container_name: "omnivore-postgres-replica"
expose:
- 5433
ports:
- "5433:5432"
environment:
PGUSER: replicator
PGPASSWORD: replicator_password
command: |
bash -c "
until pg_basebackup --pgdata=/var/lib/postgresql/data -R --slot=replication_slot --host=postgres --port=5432
do
echo 'Waiting for primary to connect...'
sleep 1s
done
echo 'Backup done, starting replica...'
chmod 0700 /var/lib/postgresql/data
postgres
"
depends_on:
- postgres
migrate:
build:
context: .
dockerfile: ./packages/db/Dockerfile
container_name: "omnivore-migrate"
command: '/bin/sh ./packages/db/setup.sh' # Also create a demo user with email: [email protected], password: demo_password
environment:
- PGPASSWORD=postgres
- POSTGRES_USER=postgres
- PG_HOST=postgres
- PG_PASSWORD=app_pass
- PG_DB=omnivore
depends_on:
postgres:
condition: service_healthy
api:
build:
context: .
dockerfile: ./packages/api/Dockerfile
container_name: "omnivore-api"
ports:
- "4000:8080"
healthcheck:
test: ["CMD-SHELL", "nc -z 0.0.0.0 8080 || exit 1"]
interval: 15s
timeout: 90s
environment:
- API_ENV=local
- PG_HOST=postgres
- PG_USER=app_user
- PG_PASSWORD=app_pass
- PG_DB=omnivore
- PG_PORT=5432
- PG_POOL_MAX=20
- JAEGER_HOST=jaeger
- IMAGE_PROXY_SECRET=some-secret
- JWT_SECRET=some_secret
- SSO_JWT_SECRET=some_sso_secret
- CLIENT_URL=http://localhost:3000
- GATEWAY_URL=http://localhost:8080/api
- CONTENT_FETCH_URL=http://content-fetch:8080/?token=some_token
- REDIS_URL='redis://redis:6379'
depends_on:
migrate:
condition: service_completed_successfully
web:
build:
context: .
dockerfile: ./packages/web/Dockerfile
args:
- APP_ENV=prod
- BASE_URL=http://localhost:3000
- SERVER_BASE_URL=http://localhost:4000
- HIGHLIGHTS_BASE_URL=http://localhost:3000
container_name: "omnivore-web"
ports:
- "3000:8080"
environment:
- NEXT_PUBLIC_APP_ENV=prod
- NEXT_PUBLIC_BASE_URL=http://localhost:3000
- NEXT_PUBLIC_SERVER_BASE_URL=http://localhost:4000
- NEXT_PUBLIC_HIGHLIGHTS_BASE_URL=http://localhost:3000
depends_on:
api:
condition: service_healthy
content-fetch:
build:
context: .
dockerfile: ./packages/content-fetch/Dockerfile
container_name: "omnivore-content-fetch"
ports:
- "9090:8080"
environment:
- JWT_SECRET=some_secret
- VERIFICATION_TOKEN=some_token
- REST_BACKEND_ENDPOINT=http://api:8080/api
- REDIS_URL=redis://redis:6379
depends_on:
redis:
condition: service_healthy
api:
condition: service_healthy
redis:
image: "redis:7.2.4"
container_name: "omnivore-redis"
ports:
- "6379:6379"
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]