-
Notifications
You must be signed in to change notification settings - Fork 183
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
77 lines (71 loc) · 1.9 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
77 lines (71 loc) · 1.9 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
version: '3.1'
services:
db:
image: postgres:16
restart: always
environment:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_USER: $USER
POSTGRES_PASSWORD: 123
command: -d postgres
volumes:
- postgres:/var/lib/postgresql/data
ports:
- 5432:5432
adminer:
image: adminer
restart: always
ports:
- 7402:8080
migrations:
build:
context: .
target: migrations
restart: on-failure
command: migrate
environment:
FLYWAY_URL: jdbc:postgresql://db/?user=$USER&password=
volumes:
- type: bind
source: ./database/sql/
target: /flyway/sql
- type: bind
source: ./database/conf/
target: /flyway/conf
# Flyway can't create databases, so provision the pool-indexer's own DB first.
# Idempotent (mirrors .devcontainer/setup-e2e.sh), so it's safe on an existing
# volume too — no fresh-volume init script required.
create-pool-indexer-db:
image: postgres:16
restart: on-failure
depends_on:
- db
environment:
PGHOST: db
PGUSER: $USER
command:
- sh
- -c
- "psql -tc \"SELECT 1 FROM pg_database WHERE datname='pool_indexer'\" | grep -q 1 || psql -c \"CREATE DATABASE pool_indexer\""
# Same flyway image as `migrations`, but applies the pool-indexer's own
# migration set to its own database (mirrors the per-network prod DB).
migrations-pool-indexer:
build:
context: .
target: migrations
restart: on-failure
command: migrate
depends_on:
create-pool-indexer-db:
condition: service_completed_successfully
environment:
FLYWAY_URL: jdbc:postgresql://db/pool_indexer?user=$USER&password=
volumes:
- type: bind
source: ./database/sql-pool-indexer/
target: /flyway/sql
- type: bind
source: ./database/conf/
target: /flyway/conf
volumes:
postgres: