-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
89 lines (86 loc) · 2.63 KB
/
Copy pathdocker-compose.yml
File metadata and controls
89 lines (86 loc) · 2.63 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
services:
db:
image: postgres:16-bookworm@sha256:05bb94c3949035f4da16815d91b389443f3dbc5db95d65e2cb9b1abbf8565974
container_name: rustok_db
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
interval: 5s
timeout: 5s
retries: 12
db-bootstrap:
image: postgres:16-bookworm@sha256:05bb94c3949035f4da16815d91b389443f3dbc5db95d65e2cb9b1abbf8565974
container_name: rustok_db_bootstrap
environment:
PGPASSWORD: postgres
depends_on:
db:
condition: service_healthy
entrypoint: ["/bin/bash", "-euo", "pipefail", "-c"]
command:
- |
psql --host db --username postgres --dbname postgres --set ON_ERROR_STOP=1 <<'SQL'
DO $$do$$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'rustok') THEN
CREATE ROLE rustok
LOGIN
PASSWORD 'rustok'
NOSUPERUSER
NOCREATEDB
NOCREATEROLE
NOREPLICATION
NOBYPASSRLS
CONNECTION LIMIT 20;
ELSE
ALTER ROLE rustok WITH
LOGIN
PASSWORD 'rustok'
NOSUPERUSER
NOCREATEDB
NOCREATEROLE
NOREPLICATION
NOBYPASSRLS
CONNECTION LIMIT 20;
END IF;
END
$$do$$;
SQL
if ! psql --host db --username postgres --dbname postgres --tuples-only --no-align \
--command "SELECT 1 FROM pg_database WHERE datname = 'rustok_dev'" | grep -qx 1; then
createdb --host db --username postgres --owner rustok rustok_dev
fi
psql --host db --username postgres --dbname rustok_dev --set ON_ERROR_STOP=1 <<'SQL'
REVOKE CREATE ON SCHEMA public FROM PUBLIC;
GRANT ALL ON SCHEMA public TO rustok;
SQL
restart: "no"
iggy:
image: apache/iggy:0.7.0
container_name: rustok_iggy
environment:
- IGGY_ROOT_USERNAME=iggy
- IGGY_ROOT_PASSWORD=iggy
- IGGY_TCP_ENABLED=true
- IGGY_TCP_ADDRESS=0.0.0.0:8090
- IGGY_HTTP_ENABLED=false
- IGGY_QUIC_ENABLED=false
ports:
- "8090:8090"
volumes:
- iggy_data:/iggy/local_data
healthcheck:
test: ["CMD-SHELL", "iggy --tcp-server-address localhost:8090 --username iggy --password iggy ping || exit 1"]
interval: 10s
timeout: 5s
retries: 5
volumes:
postgres_data:
iggy_data: