-
Notifications
You must be signed in to change notification settings - Fork 12
/
docker-compose.yml
99 lines (94 loc) · 2.35 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
version: '3.0'
services:
postgres:
image: $DOCKER_IMAGE
environment:
POSTGRES_PASSWORD: $DATABASE_PASSWORD
POSTGRES_USER: $DATABASE_USER
POSTGRES_DB: $DATABASE_NAME
command: [
"postgres",
## Concurrency
"-c", "superuser_reserved_connections=0",
"-c", "max_wal_senders=0", # disables replication, it's ok
"-c", "max_connections=100",
## Logging
"-c", "logging_collector=off",
"-c", "log_destination=stderr",
"-c", "log_min_messages=error",
# what to log
"-c", "log_statement=none", # 'all', 'none'
"-c", "log_duration=off",
"-c", "log_connections=off",
"-c", "log_disconnections=off",
"-c", "log_statement_stats=off",
]
wait-for-db:
image: $DOCKER_IMAGE
environment:
PGAPPNAME: wait-for-db
PGHOST: $DATABASE_HOST
PGUSER: $DATABASE_USER
PGPASSWORD: $DATABASE_PASSWORD
PGDATABASE: $DATABASE_NAME
volumes:
- $PWD:/code
depends_on:
- postgres
command: ["/code/wait-for-db.sh"]
pgbench-init:
image: $DOCKER_IMAGE
environment:
PGAPPNAME: pgbench-init
PGHOST: $DATABASE_HOST
PGUSER: $DATABASE_USER
PGPASSWORD: $DATABASE_PASSWORD
PGDATABASE: $DATABASE_NAME
command: [
"pgbench",
"-i", # initialize
"-s", $PGBENCH_SCALE # scale
]
pgbench:
image: $DOCKER_IMAGE
environment:
PGAPPNAME: pgbench
PGHOST: $DATABASE_HOST
PGUSER: $DATABASE_USER
PGPASSWORD: $DATABASE_PASSWORD
PGDATABASE: $DATABASE_NAME
command: [
"pgbench",
"-c", $PGBENCH_CLIENTS,
"-s", $PGBENCH_SCALE,
"-R", $PGBENCH_RATE,
"-j", $PGBENCH_THREADS,
"-T", $PGBENCH_DURATION,
"-b", $PGBENCH_SCRIPT,
"-P", "1", # show progress every 1 sec
"--report-latencies",
"pgbench" # database name
]
pgdump:
image: $DOCKER_IMAGE
environment:
PGAPPNAME: pgdump
PGHOST: $DATABASE_HOST
PGUSER: $DATABASE_USER
PGPASSWORD: $DATABASE_PASSWORD
PGDATABASE: $DATABASE_NAME
command: [
"pg_dump",
"-F", $PG_DUMP_FORMAT
]
psql:
image: $DOCKER_IMAGE
environment:
PGAPPNAME: psql
PGHOST: $DATABASE_HOST
PGUSER: $DATABASE_USER
PGPASSWORD: $DATABASE_PASSWORD
PGDATABASE: $DATABASE_NAME
command: [
"psql"
]