Skip to content

Instantly share code, notes, and snippets.

@dbazhenov
Created March 18, 2025 14:16
Show Gist options
  • Select an option

  • Save dbazhenov/fc954c9bd7f21e2ad17dffb4acfd7142 to your computer and use it in GitHub Desktop.

Select an option

Save dbazhenov/fc954c9bd7f21e2ad17dffb4acfd7142 to your computer and use it in GitHub Desktop.
Single Instance MongoDB 8 + PMM 3
version: '3'
services:
pmm-server:
image: percona/pmm-server:3
platform: "linux/amd64" # Specifies that Docker should use the image for the amd64 architecture, which is necessary if the container doesn't support ARM and your host system is ARM (e.g., Mac with Apple Silicon).
container_name: pmm-server
ports:
- 8080:80
- 443:8443
healthcheck: # Defines a command to check the container's health and sets the timing for executions and retries.
test: ["CMD-SHELL", "curl -k -f -L https://pmm-server:8443 > /dev/null 2>&1 || exit 1"]
interval: 30s
timeout: 10s
retries: 5
mongodb:
image: "percona/percona-server-mongodb:8.0-multi"
volumes:
- mongodb-data:/data/db
environment:
MONGO_INITDB_ROOT_USERNAME: databaseAdmin
MONGO_INITDB_ROOT_PASSWORD: password
ports:
- "27017:27017"
command: ["mongod", "--port", "27017", "--bind_ip_all", "--profile", "2", "--slowms", "200", "--rateLimit", "100"]
healthcheck:
test: ["CMD-SHELL", "mongosh --eval 'db.adminCommand(\"ping\")' --quiet"]
interval: 30s
timeout: 10s
retries: 5
pmm-client:
image: percona/pmm-client:3
container_name: pmm-client
depends_on:
pmm-server:
condition: service_healthy
mongodb:
condition: service_healthy
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_PRERUN_SCRIPT: >
pmm-admin status --wait=10s &&
pmm-admin add mongodb --username=databaseAdmin --password=password --host=mongodb --port=27017 --query-source=profiler
volumes:
mongodb-data: # MongoDB data storage volume
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment