-
Notifications
You must be signed in to change notification settings - Fork 203
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
158 lines (150 loc) · 4.96 KB
/
docker-compose.yml
File metadata and controls
158 lines (150 loc) · 4.96 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
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
---
# Purpose: Spin up a fully wired PMM stack on a local machine with one command, including a monitored
# database workload, to get a sense of PMM working end-to-end without any manual configuration.
#
# Usage:
# 1. Minimal suite (server, client, mysql + sysbench), where sysbench is used to generate load on MySQL:
# docker compose -f docker-compose.yml --profile pmm up -d
# 2. Full suite (server, client, postgres, mongo, mysql + sysbench):
# docker compose -f docker-compose.yml --profile pmm --profile postgres --profile mongo up -d
# 3. Full suite + external clickhouse (server, client, postgres, mongo, mysql + sysbench, external ClickHouse):
# docker compose -f docker-compose.yml -f qan-api2/docker-compose.yml --profile pmm --profile postgres --profile mongo up -d
#
# Configuration: copy .env.example to .env and adjust variables (image tag, ports, credentials, AWS keys, etc.).
# Docker Compose loads .env automatically — no extra flags needed.
#
# Note: database ports are intentionally not mapped to the host since the communication takes place on a shared bridge network.
#
services:
pmm-server:
profiles:
- pmm
image: ${PMM_SERVER_IMAGE:-percona/pmm-server:3}
platform: linux/amd64
container_name: pmm-server
hostname: pmm-server
restart: always
environment:
- GF_SECURITY_ADMIN_USER
- GF_SECURITY_ADMIN_PASSWORD
- PMM_ENABLE_ACCESS_CONTROL
- PMM_PUBLIC_ADDRESS=${PMM_PUBLIC_ADDRESS:-localhost}
- PMM_ENABLE_INTERNAL_PG_QAN
- PMM_DEBUG
# To enable an external ClickHouse database
- PMM_CLICKHOUSE_ADDR
- PMM_CLICKHOUSE_DATABASE
- PMM_CLICKHOUSE_USER
- PMM_CLICKHOUSE_PASSWORD
- PMM_DISABLE_BUILTIN_CLICKHOUSE
# To enable an external PostgreSQL database
- PMM_POSTGRES_ADDR
- PMM_POSTGRES_DBNAME
- PMM_POSTGRES_USERNAME
- PMM_POSTGRES_DBPASSWORD
- PMM_DISABLE_BUILTIN_POSTGRES
# To discover RDS databases via UI
- AWS_ACCESS_KEY
- AWS_SECRET_KEY
ports:
- ${PMM_PORT_HTTPS:-443}:8443
volumes:
- pmm-data:/srv
pmm-client:
profiles:
- pmm
image: percona/pmm-client:3
container_name: pmm-client
depends_on:
pmm-server:
condition: service_healthy
sysbench-ps:
condition: service_started
postgres:
condition: service_started
required: false
mongo:
condition: service_started
required: false
environment:
PMM_AGENT_SERVER_ADDRESS: pmm-server:8443
PMM_AGENT_SERVER_USERNAME: admin
PMM_AGENT_SERVER_PASSWORD: admin
PMM_AGENT_SERVER_INSECURE_TLS: 1
PMM_AGENT_CONFIG_FILE: config/pmm-agent.yaml
PMM_AGENT_SETUP: 1
PMM_AGENT_SETUP_FORCE: 1
PMM_AGENT_SIDECAR: 1
PMM_AGENT_PRERUN_SCRIPT: |
pmm-admin status --wait=10s
pmm-admin add mysql --cluster=dev-cluster --environment=dev --custom-labels='app=test-app' --username=root --password=secret --query-source=perfschema mysql-dev ps:3306
pmm-admin add postgresql --username=postgres --password=secret postgres-dev postgres:5432 || true
pmm-admin add mongodb --username=mongo --password=secret mongo-dev mongo:27017 || true
ps:
profiles:
- pmm
image: percona/percona-server:latest
container_name: ps
environment:
- MYSQL_ROOT_PASSWORD=secret
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-P", "3306", "-u", "root", "-psecret"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
volumes:
- ./dev/my.cnf:/etc/my.cnf
- ./dev/mysql.logrotate:/etc/logrotate.d/mysql
ps-init:
profiles:
- pmm
image: percona/percona-server:latest
container_name: ps-init
depends_on:
ps:
condition: service_healthy
command: mysql -h ps -u root -psecret -e "CREATE DATABASE IF NOT EXISTS sbtest;"
postgres:
profiles:
- postgres
image: postgres:18
container_name: postgres
command: >
-c shared_preload_libraries=pg_stat_statements
-c track_activity_query_size=2048
-c pg_stat_statements.track=all
-c pg_stat_statements.max=10000
-c pg_stat_statements.track=all
-c pg_stat_statements.save=off
-c track_io_timing=on
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=secret
volumes:
- ./dev/init-pg.sql:/docker-entrypoint-initdb.d/init-pg.sql
mongo:
profiles:
- mongo
image: mongo:8
container_name: mongo
environment:
- MONGO_INITDB_ROOT_USERNAME=mongo
- MONGO_INITDB_ROOT_PASSWORD=secret
sysbench-ps:
profiles:
- pmm
image: perconalab/sysbench
platform: linux/amd64
container_name: sysbench-ps
depends_on:
ps-init:
condition: service_completed_successfully
pmm-server:
condition: service_healthy
command: bash /sysbench-ps.sh
volumes:
- ./dev/sysbench-ps.sh:/sysbench-ps.sh
volumes:
pmm-data:
name: pmm-data