diff --git a/.env.example b/.env.example index 23c5ba92fce..c69f0c308fa 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,78 @@ -# Percona PMM dev container -#PMM_CONTAINER=perconalab/pmm-server:3-dev-container +# This is a sample file with environment variables for PMM Server. +# You can copy it to .env and modify the values as needed: `cp .env.example .env`. +# Uncomment and set the environment variables below to configure PMM Server. -CH_IMAGE=clickhouse/clickhouse-server:22.6.9.11-alpine -CH_PORT=9000 -CH_HOSTNAME=ch +# The latest PMM Server image is alsways published as percona/pmm-server:3. +# A specific version can be used by changing the tag, e.g., percona/pmm-server:3.7.0. +PMM_SERVER_IMAGE=percona/pmm-server:3 +# Label-based access control for PMM Server. Set to 1 to enable. +PMM_ENABLE_ACCESS_CONTROL=1 +# Good for development, but not recommended for production environments. +PMM_ENABLE_INTERNAL_PG_QAN=1 +# Enable Nomad integration for PMM Server. +PMM_ENABLE_NOMAD=0 +# Controls the log verbosity of PMM Server. Set to 1 to enable debug logging, which can be helpful for troubleshooting. +PMM_DEBUG=0 +# Https port for PMM Server API and UI. +PMM_PORT_HTTPS=443 +# Set the admin username for PMM Server. +GF_SECURITY_ADMIN_USER=admin +# Set a strong admin password for PMM Server in production environments. +GF_SECURITY_ADMIN_PASSWORD=admin +# Public address for PMM Server, required by Nomad integration. +PMM_PUBLIC_ADDRESS=localhost +# Https port for PMM Server API and UI. Web UI: https://localhost:443 +PMM_PORT_HTTPS=443 + +# Use an external ClickHouse database +# PMM_CLICKHOUSE_ADDR=127.0.0.1:9000 +# PMM_CLICKHOUSE_DATABASE=pmm +# PMM_CLICKHOUSE_USER=default +# PMM_CLICKHOUSE_PASSWORD= +# PMM_CLICKHOUSE_IS_CLUSTER=1 +# PMM_CLICKHOUSE_CLUSTER_NAME=pmmclickhouse +# PMM_DISABLE_BUILTIN_CLICKHOUSE=1 + +# Use an external PostgreSQL database +# PMM_POSTGRES_ADDR=pg:5432 +# PMM_POSTGRES_DBNAME=pmm-managed +# PMM_POSTGRES_USERNAME=pmm-managed +# PMM_POSTGRES_DBPASSWORD= +# PMM_POSTGRES_SSL_MODE=verify-full +# PMM_POSTGRES_SSL_CA_PATH=/tmp/certs/root.crt +# PMM_POSTGRES_SSL_KEY_PATH=/tmp/certs/pmm-managed.key +# PMM_POSTGRES_SSL_CERT_PATH=/tmp/certs/pmm-managed.crt +# PMM_DISABLE_BUILTIN_POSTGRES=1 + +# Use SSL certificates for PMM Server's internal database connection (PostgreSQL) +# GF_DATABASE_SSL_MODE=verify-full +# GF_DATABASE_CA_CERT_PATH=/tmp/certs/root.crt +# GF_DATABASE_CLIENT_KEY_PATH=/tmp/certs/grafana.key +# GF_DATABASE_CLIENT_CERT_PATH=/tmp/certs/grafana.crt + +# Specify a custom file with Advisor checks for development purposes. +# PMM_DEV_ADVISOR_CHECKS_FILE=/srv/checks/local-checks.yml + +# Configure SMTP settings for Grafana to enable email notifications. +# --profile=mail-server must be enabled in docker-compose.dev.yml for these settings to take effect. +# GF_EMAILS_WELCOME_EMAIL_ON_SIGN_UP=1 +# GF_SMTP_ENABLED=1 +# GF_SMTP_HOST=mail-server:1025 +# GF_SMTP_FROM_NAME=Percona +# GF_SMTP_FROM_ADDRESS=admin@percona.com + +# Watchtower configuration for automatic updates of PMM Server and its components. +# --profile=watchtower must be enabled in docker-compose.dev.yml for these settings to take effect. +# WATCHTOWER_IMAGE=perconalab/watchtower +# PMM_WATCHTOWER_HOST=http://watchtower:8080 +# PMM_WATCHTOWER_TOKEN=INSECURE_TOKEN +# PMM_DEV_UPDATE_DOCKER_IMAGE=percona/pmm-server:3 +# WATCHTOWER_HTTP_LISTEN_PORT=8080 +# WATCHTOWER_HTTP_API_UPDATE=1 +# WATCHTOWER_NO_RESTART=0 +# WATCHTOWER_DOCKER_PATH=/var/run/docker.sock + +# Grafana Image Renderer configuration for rendering Grafana panels as images. +# --profile=renderer must be enabled in docker-compose.dev.yml for these settings to take effect +# GF_RENDERING_SERVER_URL=http://renderer:8081/render +# GF_RENDERING_CALLBACK_URL=https://pmm-server:8443/graph/ diff --git a/.github/workflows/api-tests.yml b/.github/workflows/api-tests.yml index d2d378efcea..213519a3fbe 100644 --- a/.github/workflows/api-tests.yml +++ b/.github/workflows/api-tests.yml @@ -13,7 +13,7 @@ on: inputs: PMM_SERVER_IMAGE: description: "PMM Server image version" - default: "perconalab/pmm-server:3-dev-latest" + default: "ghcr.io/percona/pmm:3-dev-container" required: true type: string @@ -26,7 +26,7 @@ on: type: string PMM_SERVER_IMAGE: description: "PMM Server image version" - default: "perconalab/pmm-server:3-dev-latest" + default: "ghcr.io/percona/pmm:3-dev-container" required: true type: string @@ -40,7 +40,7 @@ jobs: env: PMM_URL: https://admin:admin@127.0.0.1 BRANCH: ${{ github.event.inputs.BRANCH || 'v3' }} - PMM_SERVER_IMAGE: ${{ github.event.inputs.PMM_SERVER_IMAGE || 'perconalab/pmm-server:3-dev-latest' }} + PMM_SERVER_IMAGE: ${{ github.event.inputs.PMM_SERVER_IMAGE }} steps: - name: Check out code @@ -98,7 +98,8 @@ jobs: - name: Run API tests shell: bash run: | - docker run -e PMM_SERVER_URL=${{env.PMM_URL}} \ + docker run \ + -e PMM_SERVER_URL=${{env.PMM_URL}} \ -e PMM_RUN_UPDATE_TEST=0 \ -e PMM_RUN_ADVISOR_TESTS=0 \ -e PMM_SERVER_INSECURE_TLS=1 \ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d6061a094f..afcd4672b36 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -131,21 +131,8 @@ jobs: go env | sort git status - - spell-check: - name: Spell check - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Check spelling of md files - uses: crate-ci/typos@02ea592e44b3a53c302f697cddca7641cd051c3d # v1.45.0 - with: - files: "**/*.md ./documentation/**/*.md" - merge-gatekeeper: - needs: [ check, spell-check ] + needs: [ check ] name: Merge Gatekeeper if: ${{ always() }} runs-on: ubuntu-22.04 diff --git a/.github/workflows/managed.yml b/.github/workflows/managed.yml index 20997ce9afb..8b53a209628 100644 --- a/.github/workflows/managed.yml +++ b/.github/workflows/managed.yml @@ -28,7 +28,7 @@ permissions: read-all jobs: test: - name: Managed tests + name: Unit tests runs-on: ubuntu-22.04 timeout-minutes: 30 @@ -36,8 +36,6 @@ jobs: PMM_SERVER_IMAGE: perconalab/pmm-server:3-dev-latest AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} - PMM_DEV_OAUTH_CLIENT_ID: ${{ secrets.OAUTH_PMM_CLIENT_ID }} - PMM_DEV_OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_PMM_CLIENT_SECRET }} PMM_CONTAINER: ghcr.io/percona/pmm:3-dev-container steps: @@ -66,7 +64,7 @@ jobs: -e PMM_RELEASE_PATH=/root/go/bin \ -e PMM_ENABLE_ACCESS_CONTROL=1 \ -e PMM_ENABLE_TELEMETRY=0 \ - -e PMM_RELEASE_VERSION=3.0.0 \ + -e PMM_RELEASE_VERSION=3.7.0 \ -e GOMODCACHE=/home/pmm/.cache/go/mod \ -e GOCACHE=/home/pmm/.cache/go-build \ -w /root/go/src/github.com/percona/pmm \ diff --git a/.typos.toml b/.typos.toml deleted file mode 100644 index 2f7002d330a..00000000000 --- a/.typos.toml +++ /dev/null @@ -1,6 +0,0 @@ -[default] -extend-ignore-identifiers-re = [ - "LKE", - "ue", - "ba" -] \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md index f1629fcdd42..0e6cf266df5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -230,7 +230,8 @@ All long-running daemons expose on `127.0.0.1`: ## Key Files to Reference - `Makefile`, `Makefile.include` — build and development targets -- `docker-compose.yml` — development environment (PMM Server, renderer, watchtower) +- `docker-compose.dev.yml` — development environment (PMM Server, renderer, watchtower) +- `docker-compose.yml` — community/quickstart compose (stable image, minimal config) - `go.mod` — Go module definition - `.golangci.yml` — linter configuration - `.mockery.yaml` — mock generation configuration diff --git a/README.md b/README.md index 3de1c8a6a52..f4f41a608b6 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ See the [PMM Documentation](https://docs.percona.com/percona-monitoring-and-mana * Spot critical performance issues faster, understand the root cause of incidents better and troubleshoot them more efficiently. * Zoom-in, drill-down database performance from node to single query levels. Perform in-depth troubleshooting and performance optimization. * Built-in Advisors run regular checks of the databases connected to PMM. The checks identify and alert you of potential security threats, performance degradation, data loss and data corruption. -* Backup and restore databases up to a specific moment with Point-in-Time-Recovery. ## Architecture @@ -41,7 +40,7 @@ See the [PMM Documentation](https://docs.percona.com/percona-monitoring-and-mana ## Installation -There are numbers of installation methods, please check our [About PMM installation](https://docs.percona.com/percona-monitoring-and-management/3/install-pmm/index.html) documentation page. +There are different installation methods, please check our [About PMM installation](https://docs.percona.com/percona-monitoring-and-management/3/install-pmm/index.html) documentation page. But in a nutshell: @@ -61,7 +60,7 @@ $ docker run --detach --restart always \ --name pmm-server \ percona/pmm-server:3 ``` -4. Start a web browser and in the address bar enter the server name or IP address of the PMM server host. +4. Start a web browser and type the server name or IP address of the PMM server host (defaults to https://localhost). PMM Login Page diff --git a/agent/cmd/pmm-agent-entrypoint/main.go b/agent/cmd/pmm-agent-entrypoint/main.go index ea878c55609..0d82e1f6004 100644 --- a/agent/cmd/pmm-agent-entrypoint/main.go +++ b/agent/cmd/pmm-agent-entrypoint/main.go @@ -40,9 +40,9 @@ It is configured entirely by environment variables. Arguments or flags are not u The following environment variables are recognized by the Docker entrypoint: * PMM_AGENT_SETUP - if true, 'pmm-agent setup' is called before 'pmm-agent run'. -* PMM_AGENT_PRERUN_FILE - if non-empty, runs given file with 'pmm-agent run' running in the background. -* PMM_AGENT_PRERUN_SCRIPT - if non-empty, runs given shell script content with 'pmm-agent run' running in the background. -* PMM_AGENT_SIDECAR - if true, 'pmm-agent' will be restarted in case of it's failed. +* PMM_AGENT_PRERUN_FILE - if non-empty, runs given file while 'pmm-agent run' is running in the background. +* PMM_AGENT_PRERUN_SCRIPT - if non-empty, runs given shell script content while 'pmm-agent run' is running in the background. +* PMM_AGENT_SIDECAR - if true, 'pmm-agent' will be restarted in case it fails. * PMM_AGENT_SIDECAR_SLEEP - time to wait before restarting pmm-agent if PMM_AGENT_SIDECAR is true. 1 second by default. Additionally, the many environment variables are recognized by pmm-agent itself. diff --git a/agent/docker-compose.yml b/agent/docker-compose.yml index 5adf0b51518..9cc92e424e8 100644 --- a/agent/docker-compose.yml +++ b/agent/docker-compose.yml @@ -11,7 +11,6 @@ services: - PMM_DEV_ADVISOR_CHECKS_FILE=/srv/checks/custom-checks.yml # for check-dev # - PMM_DEV_PERCONA_PLATFORM_ADDRESS=check-dev.percona.com:443 - # - PMM_DEV_PERCONA_PLATFORM_PUBLIC_KEY=RWTg+ZmCCjt7O8eWeAmTLAqW+1ozUbpRSKSwNTmO+exlS5KEIPYWuYdX volumes: - ./testdata/checks:/srv/checks @@ -45,7 +44,7 @@ services: - ./testdata/mysql:/mysql mongo: - image: ${MONGO_IMAGE:-percona/percona-server-mongodb:5.0} + image: ${MONGO_IMAGE:-percona/percona-server-mongodb:6.0} container_name: pmm-agent_mongo command: - --profile=2 @@ -60,7 +59,7 @@ services: - ./testdata/mongo/var/log/mongodb:/var/log/mongodb mongo_with_tls: - image: ${MONGO_IMAGE:-percona/percona-server-mongodb:5.0} + image: ${MONGO_IMAGE:-percona/percona-server-mongodb:6.0} container_name: pmm-agent_mongo_with_tls command: - --profile=2 @@ -78,17 +77,17 @@ services: - ./testdata/mongo/var/log/mongodb:/var/log/mongodb mongonoauth: - image: ${MONGO_IMAGE:-percona/percona-server-mongodb:5.0} + image: ${MONGO_IMAGE:-percona/percona-server-mongodb:6.0} container_name: pmm-agent_mongonoauth command: --profile=2 -bind_ip=0.0.0.0 --noauth ports: - "127.0.0.1:27019:27017" mongo_repl: - image: ${MONGO_IMAGE:-percona/percona-server-mongodb:5.0} + image: ${MONGO_IMAGE:-percona/percona-server-mongodb:6.0} container_name: pmm-agent_mongorepl environment: - - MONGO_IMAGE=${MONGO_IMAGE:-percona/percona-server-mongodb:5.0} + - MONGO_IMAGE=${MONGO_IMAGE:-percona/percona-server-mongodb:6.0} volumes: - ./testscripts/:/scripts command: /scripts/mongo_repl.sh @@ -97,11 +96,11 @@ services: - "127.0.0.1:27021:27021" mongo_repl_with_tls: - image: ${MONGO_IMAGE:-percona/percona-server-mongodb:5.0} + image: ${MONGO_IMAGE:-percona/percona-server-mongodb:6.0} container_name: pmm-agent_mongorepl_with_tls command: /scripts/mongo_repl_with_tls.sh environment: - - MONGO_IMAGE=${MONGO_IMAGE:-percona/percona-server-mongodb:5.0} + - MONGO_IMAGE=${MONGO_IMAGE:-percona/percona-server-mongodb:6.0} ports: - "127.0.0.1:27022:27022" - "127.0.0.1:27023:27023" @@ -110,7 +109,7 @@ services: - ${PWD}/utils/tests/testdata/mongodb:/etc/tls/certificates postgres: - image: ${POSTGRES_IMAGE:-postgres:11} + image: ${POSTGRES_IMAGE:-postgres:14} container_name: pmm-agent_postgres command: > -c shared_preload_libraries='${PG_PRELOADED_LIBS:-pg_stat_statements}' diff --git a/api-tests/docker-compose.yml b/api-tests/docker-compose.yml index e75134789a5..464fdd6ae71 100644 --- a/api-tests/docker-compose.yml +++ b/api-tests/docker-compose.yml @@ -11,7 +11,6 @@ services: # - PMM_DEV_ADVISOR_CHECKS_FILE=/srv/checks/custom-checks.yml # for check-dev - PMM_DEV_PERCONA_PLATFORM_ADDRESS=check-dev.percona.com - - PMM_DEV_PERCONA_PLATFORM_PUBLIC_KEY=RWTg+ZmCCjt7O8eWeAmTLAqW+1ozUbpRSKSwNTmO+exlS5KEIPYWuYdX volumes: - ./testdata/checks:/srv/checks diff --git a/dashboards/pmm-app/docker-compose.yaml b/dashboards/pmm-app/docker-compose.yaml index 22e05157edf..fb1815b6a91 100644 --- a/dashboards/pmm-app/docker-compose.yaml +++ b/dashboards/pmm-app/docker-compose.yaml @@ -8,9 +8,7 @@ services: - './dist:/srv/grafana/plugins/pmm-app/dist' environment: - PMM_DEBUG=1 - - PMM_DEV_PORTAL_URL=https://portal-dev.percona.com - PMM_DEV_PERCONA_PLATFORM_ADDRESS=https://check-dev.percona.com:443 - - PMM_DEV_PERCONA_PLATFORM_PUBLIC_KEY=RWTkF7Snv08FCboTne4djQfN5qbrLfAjb8SY3/wwEP+X5nUrkxCEvUDJ ports: - 80:8080 - 443:8443 diff --git a/dev/init-pg.sql b/dev/init-pg.sql new file mode 100644 index 00000000000..841ff0c4b19 --- /dev/null +++ b/dev/init-pg.sql @@ -0,0 +1 @@ +CREATE EXTENSION IF NOT EXISTS pg_stat_statements; diff --git a/dev/my.cnf b/dev/my.cnf new file mode 100644 index 00000000000..6f4f4977ba2 --- /dev/null +++ b/dev/my.cnf @@ -0,0 +1,7 @@ +[mysqld] +slow_query_log = ON +slow_query_log_file = /var/log/mysql/mysql-slow.log +slow_query_log_always_write_time = 0 +long_query_time = 0 +log_slow_admin_statements = ON +log_slow_extra = ON diff --git a/dev/mysql.logrotate b/dev/mysql.logrotate new file mode 100644 index 00000000000..2dfa7190962 --- /dev/null +++ b/dev/mysql.logrotate @@ -0,0 +1,14 @@ +/var/log/mysql/mysql-slow.log { + daily + missingok + rotate 7 + compress + delaycompress + notifempty + sharedscripts + postrotate + if [ -f /var/run/mysqld/mysqld.pid ]; then + kill -HUP $(cat /var/run/mysqld/mysqld.pid) + fi + endscript +} diff --git a/dev/sysbench-ps.sh b/dev/sysbench-ps.sh new file mode 100644 index 00000000000..8f2007ee981 --- /dev/null +++ b/dev/sysbench-ps.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -o xtrace + +sysbench \ + --db-driver=mysql \ + --mysql-host=ps \ + --mysql-port=3306 \ + --mysql-user=root \ + --mysql-password=secret \ + --mysql-db=sbtest \ + --table-size=1000000 \ + oltp_read_write \ + prepare + +sysbench \ + --rate=200 \ + --threads=64 \ + --report-interval=10 \ + --time=0 \ + --events=0 \ + --rand-type=pareto \ + --db-driver=mysql \ + --mysql-host=ps \ + --mysql-port=3306 \ + --mysql-user=root \ + --mysql-password=secret \ + --mysql-db=sbtest \ + --table-size=1000000 \ + oltp_read_only \ + run diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 00000000000..cc5bf2846fe --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,126 @@ +--- +services: + pmm-server: + profiles: + - pmm + image: ${PMM_SERVER_IMAGE:-perconalab/pmm-server:3-dev-container} + platform: linux/amd64 + container_name: pmm-server + hostname: pmm-server + environment: + - AWS_ACCESS_KEY=${AWS_ACCESS_KEY:-} + - AWS_SECRET_KEY=${AWS_SECRET_KEY:-} + - PMM_ENABLE_ACCESS_CONTROL=${PMM_ENABLE_ACCESS_CONTROL:-} + - PMM_ENABLE_NOMAD=${PMM_ENABLE_NOMAD:-} + - PMM_ENABLE_INTERNAL_PG_QAN=${PMM_ENABLE_INTERNAL_PG_QAN:-} + - PMM_PUBLIC_ADDRESS=${PMM_PUBLIC_ADDRESS:-localhost} + - PMM_RELEASE_PATH=${PMM_RELEASE_PATH:-/root/go/bin} + - PMM_DEV_UPDATE_DOCKER_IMAGE=${PMM_DEV_UPDATE_DOCKER_IMAGE:-} + - PMM_RELEASE_VERSION=${PMM_RELEASE_VERSION:-} + - GO_VERSION=${GO_VERSION:-} + - PMM_DEV_PERCONA_PLATFORM_ADDRESS=${PMM_DEV_PERCONA_PLATFORM_ADDRESS:-} + - PMM_DEV_PERCONA_PLATFORM_INSECURE=${PMM_DEV_PERCONA_PLATFORM_INSECURE:-} + - PMM_DEV_TELEMETRY_INTERVAL=${PMM_DEV_TELEMETRY_INTERVAL:-} + - PMM_DEV_TELEMETRY_DISABLE_START_DELAY=${PMM_DEV_TELEMETRY_DISABLE_START_DELAY:-} + - PMM_DEV_TELEMETRY_DISABLE_SEND=${PMM_DEV_TELEMETRY_DISABLE_SEND:-} + - PMM_DEV_TELEMETRY_RETRY_BACKOFF=${PMM_DEV_TELEMETRY_RETRY_BACKOFF:-} + - PMM_DEBUG=${PMM_DEBUG:-} + - PMM_DEV_ADVISOR_CHECKS_FILE=${PMM_DEV_ADVISOR_CHECKS_FILE:-} + - PMM_POSTGRES_ADDR=${PMM_POSTGRES_ADDR:-} + - PMM_POSTGRES_DBNAME=${PMM_POSTGRES_DBNAME:-} + - PMM_POSTGRES_USERNAME=${PMM_POSTGRES_USERNAME:-} + - PMM_POSTGRES_DBPASSWORD=${PMM_POSTGRES_DBPASSWORD:-} + - PMM_POSTGRES_SSL_MODE=${PMM_POSTGRES_SSL_MODE:-} + - PMM_POSTGRES_SSL_CA_PATH=${PMM_POSTGRES_SSL_CA_PATH:-} + - PMM_POSTGRES_SSL_KEY_PATH=${PMM_POSTGRES_SSL_KEY_PATH:-} + - PMM_POSTGRES_SSL_CERT_PATH=${PMM_POSTGRES_SSL_CERT_PATH:-} + - PMM_DISABLE_BUILTIN_POSTGRES=${PMM_DISABLE_BUILTIN_POSTGRES:-} + - PMM_WATCHTOWER_HOST=${PMM_WATCHTOWER_HOST:-} + - PMM_WATCHTOWER_TOKEN=${PMM_WATCHTOWER_TOKEN:-} + - GF_SECURITY_ADMIN_USER=${PMM_ADMIN_USER:-} + - GF_SECURITY_ADMIN_PASSWORD=${PMM_ADMIN_PASSWORD:-} + - GF_RENDERING_SERVER_URL=${GF_RENDERING_SERVER_URL:-} + - GF_RENDERING_CALLBACK_URL=${GF_RENDERING_CALLBACK_URL:-} + - GF_EMAILS_WELCOME_EMAIL_ON_SIGN_UP=${GF_EMAILS_WELCOME_EMAIL_ON_SIGN_UP:-} + - GF_SMTP_ENABLED=${GF_SMTP_ENABLED:-} + - GF_SMTP_HOST=${GF_SMTP_HOST:-} + - GF_SMTP_FROM_NAME=${GF_SMTP_FROM_NAME:-} + - GF_SMTP_FROM_ADDRESS=${GF_SMTP_FROM_ADDRESS:-} + + # enable for delve + # cap_add: + # - SYS_PTRACE + # security_opt: + # - seccomp:unconfined + + # see https://github.com/golang/go/wiki/LinuxKernelSignalVectorBug#what-to-do + ulimits: + memlock: 67108864 + + ports: + - ${PMM_PORT_HTTPS:-443}:8443 + # For headless delve + - ${PMM_PORT_DELVE:-2345}:2345 + # PG + - ${PMM_PORT_PG:-5432}:5432 + # VM + - ${PMM_PORT_VM:-9090}:9090 + # CH + - ${PMM_PORT_CH_TCP:-9000}:9000 + - ${PMM_PORT_CH_HTTP:-8123}:8123 + volumes: + - ./:/root/go/src/github.com/percona/pmm + - ./managed/testdata/updater/:/home/pmm/.config/systemd/user/ + # Dev clickhouse config for backup/restore + - ./dev/clickhouse-config.xml:/etc/clickhouse-server/config.xml:ro + # caching + - go-modules:/root/go/pkg/mod + - go-cache:/root/.cache + - pmm-data:/srv + # mount advisor files for easy development + - ./managed/data/advisors/:/usr/local/percona/advisors/ + - ./managed/data/checks/:/usr/local/percona/checks/ + - ./managed/data/alerting-templates/:/usr/local/percona/alerting-templates/ + + mail-server: + profiles: + - mail-server + image: axllent/mailpit + container_name: mail-server + hostname: mail-server + ports: + - 8025:8025 # Web UI - http://localhost:8025 + + renderer: + profiles: + - renderer + image: grafana/grafana-image-renderer:latest + environment: + - RENDERING_VERBOSE_LOGGING=true + - RENDERING_DUMPIO=true + - IGNORE_HTTPS_ERRORS=true + - LOG_LEVEL=debug + ports: + - 8081:8081 + + watchtower: + profiles: + - watchtower + image: ${WATCHTOWER_IMAGE:-perconalab/watchtower} + container_name: watchtower + hostname: watchtower + environment: + - WATCHTOWER_HTTP_LISTEN_PORT=${WATCHTOWER_HTTP_LISTEN_PORT:-8080} + - WATCHTOWER_HTTP_API_UPDATE=${WATCHTOWER_HTTP_API_UPDATE:-1} + - WATCHTOWER_HTTP_API_TOKEN=${PMM_WATCHTOWER_TOKEN:-INSECURE_TOKEN} + - WATCHTOWER_NO_RESTART=${WATCHTOWER_NO_RESTART:-0} + volumes: + - ${WATCHTOWER_DOCKER_PATH:-/var/run/docker.sock}:/var/run/docker.sock + +volumes: + go-modules: + name: go-modules + go-cache: + name: go-cache + pmm-data: + name: pmm-data diff --git a/docker-compose.yml b/docker-compose.yml index 5af8ee99faf..cb836b6b741 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,133 +1,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_CONTAINER:-perconalab/pmm-server:3-dev-container} + image: ${PMM_SERVER_IMAGE:-percona/pmm-server:3} platform: linux/amd64 container_name: pmm-server hostname: pmm-server - networks: - - ${NETWORK:-default} + restart: always environment: - - AWS_ACCESS_KEY=${AWS_ACCESS_KEY:-} - - AWS_SECRET_KEY=${AWS_SECRET_KEY:-} - - REVIEWDOG_GITHUB_API_TOKEN=${REVIEWDOG_GITHUB_API_TOKEN:-} - - PMM_RELEASE_PATH=/root/go/bin - - PMM_ENABLE_ACCESS_CONTROL=${PMM_ENABLE_ACCESS_CONTROL:-0} - - PMM_WATCHTOWER_HOST=${PMM_WATCHTOWER_HOST:-http://watchtower:8080} - - PMM_WATCHTOWER_TOKEN=${PMM_WATCHTOWER_TOKEN:-INSECURE_TOKEN} - - PMM_ENABLE_NOMAD=${PMM_ENABLE_NOMAD:-0} + - GF_SECURITY_ADMIN_USER + - GF_SECURITY_ADMIN_PASSWORD + - PMM_ENABLE_ACCESS_CONTROL - PMM_PUBLIC_ADDRESS=${PMM_PUBLIC_ADDRESS:-localhost} - - PMM_RELEASE_VERSION=3.6.0 - - GO_VERSION=1.25.x - # - PMM_ENABLE_INTERNAL_PG_QAN=${PMM_ENABLE_INTERNAL_PG_QAN:-1} - # - PMM_DISTRIBUTION_METHOD=${PMM_DISTRIBUTION_METHOD:-docker} - # - PMM_DEV_UPDATE_DOCKER_IMAGE=${PMM_DEV_UPDATE_DOCKER_IMAGE:-} - # - PMM_DEV_PERCONA_PLATFORM_ADDRESS=https://check.localhost - # - PMM_DEV_PERCONA_PLATFORM_INSECURE=1 - # - PMM_DEV_PERCONA_PLATFORM_PUBLIC_KEY= - # - PMM_DEV_TELEMETRY_INTERVAL=10s - # - PMM_DEV_TELEMETRY_DISABLE_START_DELAY=1 - # - PMM_DEV_TELEMETRY_RETRY_BACKOFF=10s - # - PMM_CLICKHOUSE_ADDR=127.0.0.1:9000 - # - PMM_CLICKHOUSE_DATABASE=pmm - # - PMM_CLICKHOUSE_USER=default - # - PMM_CLICKHOUSE_PASSWORD= - # - PMM_CLICKHOUSE_IS_CLUSTER=1 - # - PMM_CLICKHOUSE_CLUSTER_NAME=pmmclickhouse - # - PMM_DEBUG=1 - # - PMM_DEV_ADVISOR_CHECKS_FILE=/srv/checks/local-checks.yml - # - PMM_POSTGRES_ADDR=pg - # - PMM_POSTGRES_DBNAME=pmm-managed - # - PMM_POSTGRES_USERNAME=pmm-managed - # - PMM_POSTGRES_DBPASSWORD= - # - PMM_POSTGRES_SSL_MODE=verify-full - # - PMM_POSTGRES_SSL_CA_PATH=/tmp/certs/root.crt - # - PMM_POSTGRES_SSL_KEY_PATH=/tmp/certs/pmm-managed.key - # - PMM_POSTGRES_SSL_CERT_PATH=/tmp/certs/pmm-managed.crt - # - PMM_DISABLE_BUILTIN_POSTGRES=1 - - GF_RENDERING_SERVER_URL=http://renderer:8081/render - - GF_RENDERING_CALLBACK_URL=https://pmm-server:8443/graph/ - # - GF_DATABASE_SSL_MODE=verify-full - # - GF_DATABASE_CA_CERT_PATH=/tmp/certs/root.crt - # - GF_DATABASE_CLIENT_KEY_PATH=/tmp/certs/grafana.key - # - GF_DATABASE_CLIENT_CERT_PATH=/tmp/certs/grafana.crt - - # for delve - cap_add: - - SYS_PTRACE - security_opt: - - seccomp:unconfined - - # see https://github.com/golang/go/wiki/LinuxKernelSignalVectorBug#what-to-do - ulimits: - memlock: 67108864 - + - 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 - # For headless delve - - ${PMM_PORT_DELVE:-2345}:2345 - # PG - - ${PMM_PORT_PG:-5432}:5432 - # VM - - ${PMM_PORT_VM:-9090}:9090 - # CH - - ${PMM_PORT_CH_TCP:-19000}:9000 - - ${PMM_PORT_CH_HTTP:-8123}:8123 volumes: - - ./:/root/go/src/github.com/percona/pmm - - ./Makefile.devcontainer:/root/go/src/github.com/percona/pmm/Makefile:ro # substitute Makefile in devcontainer - - ./managed/testdata/updater/:/home/pmm/.config/systemd/user/ - - ./dev/clickhouse-config.xml:/etc/clickhouse-server/config.xml:ro # Dev clickhouse config for backups/restore - # caching - - go-modules:/root/go/pkg/mod - - go-cache:/root/.cache - - srv:/srv - # mount advisor files for easy development - - ./managed/data/advisors/:/usr/local/percona/advisors/ - - ./managed/data/checks/:/usr/local/percona/checks/ - - ./managed/data/alerting-templates/:/usr/local/percona/alerting-templates/ - # grafana - # - "../grafana:/workspace" - # - "../grafana/public:/usr/share/grafana/public" - # - "../grafana/conf/grafana.local-dev.ini:/usr/share/grafana/conf/defaults.ini" - # command: > - # bash -c " - # # script you want to run before entrypoint, e.g. - # bash /tmp/wait-for-it.sh -t 30 some-service:some-port -- - # /opt/entrypoint.sh - # " + - pmm-data:/srv - renderer: - image: grafana/grafana-image-renderer:latest + 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: - - RENDERING_VERBOSE_LOGGING=true - - RENDERING_DUMPIO=true - - IGNORE_HTTPS_ERRORS=true - - LOG_LEVEL=debug - networks: - - ${NETWORK:-default} - ports: - - 8081:8081 + 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 - watchtower: + ps-init: profiles: - pmm - image: ${WATCHTOWER_IMAGE:-perconalab/watchtower} - container_name: watchtower + 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: - - WATCHTOWER_HTTP_LISTEN_PORT=8080 - - WATCHTOWER_HTTP_API_UPDATE=1 - - WATCHTOWER_HTTP_API_TOKEN=${PMM_WATCHTOWER_TOKEN:-INSECURE_TOKEN} - - WATCHTOWER_NO_RESTART=${WATCHTOWER_NO_RESTART:-0} - hostname: watchtower - networks: - - ${NETWORK:-default} + - 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: - - ${DOCKER_PATH:-/var/run/docker.sock}:/var/run/docker.sock + - ./dev/sysbench-ps.sh:/sysbench-ps.sh volumes: - go-modules: - go-cache: - srv: + pmm-data: + name: pmm-data diff --git a/docs/process/v2_to_v3_environment_variables.md b/docs/process/v2_to_v3_environment_variables.md index f95ad9ff4e4..6d255d60ab8 100644 --- a/docs/process/v2_to_v3_environment_variables.md +++ b/docs/process/v2_to_v3_environment_variables.md @@ -17,8 +17,8 @@ Below is a list of affected variables and their new names. | `METRICS_RESOLUTION_HR` | `PMM_METRICS_RESOLUTION_HR` | | | `METRICS_RESOLUTION_LR` | `PMM_METRICS_RESOLUTION_LR` | | | `METRICS_RESOLUTION_MR` | `PMM_METRICS_RESOLUTION_MR` | | -| `OAUTH_PMM_CLIENT_ID` | `PMM_DEV_OAUTH_CLIENT_ID` | | -| `OAUTH_PMM_CLIENT_SECRET` | `PMM_DEV_OAUTH_CLIENT_SECRET` | | +| `OAUTH_PMM_CLIENT_ID` | `PMM_DEV_OAUTH_CLIENT_ID` | Removed in PMM v3 | +| `OAUTH_PMM_CLIENT_SECRET` | `PMM_DEV_OAUTH_CLIENT_SECRET` | Removed in PMM v3 | | `PERCONA_TEST_AUTH_HOST` | | Removed in PMM v3, use `PMM_DEV_PERCONA_PLATFORM_ADDRESS` | | `PERCONA_TEST_CHECKS_FILE` | `PMM_DEV_ADVISOR_CHECKS_FILE` | | | `PERCONA_TEST_CHECKS_HOST` | | Removed in PMM v3, use `PMM_DEV_PERCONA_PLATFORM_ADDRESS` | diff --git a/documentation/Makefile b/documentation/Makefile index e86de908724..910b086004a 100644 --- a/documentation/Makefile +++ b/documentation/Makefile @@ -1,12 +1,6 @@ # Documentation Makefile. -DOCDIR := documentation - -ifeq ($(shell basename $(CURDIR)),$(DOCDIR)) - DIR := $(CURDIR) -else - DIR := $(CURDIR)/$(DOCDIR) -endif +DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) doc-check-images: ## Check if all images are used in documentation @$(DIR)/resources/bin/check-images.sh diff --git a/documentation/docs/admin/security/ssl_encryption.md b/documentation/docs/admin/security/ssl_encryption.md index 994435f0a87..cc139582f4c 100644 --- a/documentation/docs/admin/security/ssl_encryption.md +++ b/documentation/docs/admin/security/ssl_encryption.md @@ -18,7 +18,7 @@ Configure both the Server and Client to implement SSL/TLS encryption in your PMM - [Copy certificates](#copy-certificates) directly into the PMM Server container 2. **Restart PMM Server** to apply the new certificates 3. **Configure client trust**: Ensure PMM Clients can verify the server certificate: - - Add the CA certificate to the system trust store ([Ubuntu guide](https://ubuntu.com/server/docs/install-a-root-ca-certificate-in-the-trust-store) | [Red Hat guide](https://www.redhat.com/sysadmin/configure-ca-trust-list)) + - Add the CA certificate to the system trust store ([Ubuntu guide](https://ubuntu.com/server/docs/how-to/security/install-a-root-ca-certificate-in-the-trust-store/) | [Red Hat guide](https://www.redhat.com/sysadmin/configure-ca-trust-list)) - **Or use the `SSL_CERT_FILE` environment variable** for [custom CA certificates](#use-custom-ca-certificates-with-pmm-client) ### Certificate storage location diff --git a/documentation/docs/reference/third-party/clickhouse.md b/documentation/docs/reference/third-party/clickhouse.md index 0f49f49116f..a65196fd6b9 100644 --- a/documentation/docs/reference/third-party/clickhouse.md +++ b/documentation/docs/reference/third-party/clickhouse.md @@ -37,21 +37,21 @@ To use ClickHouse as an external database instance, provide the following enviro To use ClickHouse as an external database instance, run PMM in docker or podman with the specified variables for external ClickHouse: ```sh --e PMM_CLICKHOUSE_ADDR=$CH_HOST:$CH_PORT --e PMM_CLICKHOUSE_DATABASE=$CH_DATABASE --e PMM_CLICKHOUSE_USER=$CH_USER --e PMM_CLICKHOUSE_PASSWORD=$CH_PASSWORD +-e PMM_CLICKHOUSE_ADDR=: +-e PMM_CLICKHOUSE_DATABASE= +-e PMM_CLICKHOUSE_USER= +-e PMM_CLICKHOUSE_PASSWORD= -e PMM_DISABLE_BUILTIN_CLICKHOUSE=1 ``` Alternatively, you can use the `PMM_CLICKHOUSE_HOST` and `PMM_CLICKHOUSE_PORT` variables instead of `PMM_CLICKHOUSE_ADDR`. ```sh --e PMM_CLICKHOUSE_HOST=$CH_HOST --e PMM_CLICKHOUSE_PORT=$CH_PORT --e PMM_CLICKHOUSE_DATABASE=$CH_DATABASE --e PMM_CLICKHOUSE_USER=$CH_USER --e PMM_CLICKHOUSE_PASSWORD=$CH_PASSWORD +-e PMM_CLICKHOUSE_HOST= +-e PMM_CLICKHOUSE_PORT= +-e PMM_CLICKHOUSE_DATABASE= +-e PMM_CLICKHOUSE_USER= +-e PMM_CLICKHOUSE_PASSWORD= -e PMM_DISABLE_BUILTIN_CLICKHOUSE=1 ``` diff --git a/get-pmm.sh b/get-pmm.sh index 62c0060fc87..992acebbaf0 100755 --- a/get-pmm.sh +++ b/get-pmm.sh @@ -338,10 +338,8 @@ ENV_MAPPING=( "PERCONA_TEST_AUTH_HOST=PMM_DEV_PERCONA_PLATFORM_ADDRESS" "PERCONA_TEST_CHECKS_FILE=PMM_DEV_ADVISOR_CHECKS_FILE" "PERCONA_TEST_CHECKS_HOST=PMM_DEV_PERCONA_PLATFORM_ADDRESS" - "PERCONA_TEST_CHECKS_PUBLIC_KEY=PMM_DEV_PERCONA_PLATFORM_PUBLIC_KEY" "PERCONA_TEST_PLATFORM_ADDRESS=PMM_DEV_PERCONA_PLATFORM_ADDRESS" "PERCONA_TEST_PLATFORM_INSECURE=PMM_DEV_PERCONA_PLATFORM_INSECURE" - "PERCONA_TEST_PLATFORM_PUBLIC_KEY=PMM_DEV_PERCONA_PLATFORM_PUBLIC_KEY" "PERCONA_TEST_SAAS_HOST=PMM_DEV_PERCONA_PLATFORM_ADDRESS" "PERCONA_TEST_POSTGRES_ADDR=PMM_POSTGRES_ADDR" "PERCONA_TEST_POSTGRES_DBNAME=PMM_POSTGRES_DBNAME" @@ -380,6 +378,8 @@ ENV_TO_DROP=( "PERCONA_TEST_NICER_API" "PERCONA_TEST_PMM_CLICKHOUSE_BLOCK_SIZE" "PERCONA_TEST_PMM_CLICKHOUSE_POOL_SIZE" +"PMM_DEV_OAUTH_CLIENT_ID" +"PMM_DEV_OAUTH_CLIENT_SECRET" ) # Function to get the new key from the mapping diff --git a/managed/cmd/pmm-managed-init/main.go b/managed/cmd/pmm-managed-init/main.go index b7c18fd59a0..ea4ed7f9042 100644 --- a/managed/cmd/pmm-managed-init/main.go +++ b/managed/cmd/pmm-managed-init/main.go @@ -37,10 +37,10 @@ func main() { } envSettings, errs, warns := envvars.ParseEnvVars(os.Environ()) for _, warn := range warns { - logrus.Warnf("Configuration warning: %s.", warn) + logrus.Warnf("Configuration warning: %s", warn) } for _, err := range errs { - logrus.Errorf("Configuration error: %s.", err) + logrus.Errorf("Configuration error: %s", err) } if len(errs) != 0 { os.Exit(1) diff --git a/managed/utils/envvars/parser.go b/managed/utils/envvars/parser.go index c50be5c1003..d5c93c957ce 100644 --- a/managed/utils/envvars/parser.go +++ b/managed/utils/envvars/parser.go @@ -396,7 +396,7 @@ func GetInterfaceToBind() string { // GetEnv returns env with fallback option. func GetEnv(key, fallback string) string { - if value, ok := os.LookupEnv(key); ok { + if value, ok := os.LookupEnv(key); ok && value != "" { return value } return fallback diff --git a/qan-api2/CONTRIBUTING.md b/qan-api2/CONTRIBUTING.md index ace5bd5a524..c6660fdb8e8 100644 --- a/qan-api2/CONTRIBUTING.md +++ b/qan-api2/CONTRIBUTING.md @@ -18,7 +18,3 @@ where PMM_CONTAINER is a name of PMM-Server container. ## Testing Run `make test-env-up` to set-up environment for tests Run `make test` to run tests. - -## Vendoring - -We use [dep](https://github.com/golang/dep) to vendor dependencies. diff --git a/qan-api2/docker-compose.yaml b/qan-api2/docker-compose.yaml deleted file mode 100644 index 1a45a46649b..00000000000 --- a/qan-api2/docker-compose.yaml +++ /dev/null @@ -1,148 +0,0 @@ ---- -services: - - pmm-server: - container_name: pmm-server - image: perconalab/pmm-server:3-dev-latest - ports: - - 443:8443 - - 19000:9000 - - 9933:9933 - restart: always - - ch: - image: clickhouse/clickhouse-server:25.3.6.56 - platform: linux/amd64 - container_name: ch-server - environment: - - CLICKHOUSE_USER=default - - CLICKHOUSE_PASSWORD=clickhouse - ulimits: - nofile: - soft: 262144 - hard: 262144 - ports: - - 9000:9000 - - pmm-client: - container_name: pmm-client - image: centos - depends_on: - - pmm-server - - sysbench-ps - command: > - bash -c " - yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm -y - percona-release disable all - percona-release enable pmm3-client testing - yum update -y - yum install pmm-client -y - pmm-agent setup --config-file=/usr/local/percona/pmm/config/pmm-agent.yaml --server-address=pmm-server:443 --server-insecure-tls --server-username=admin --server-password=admin - nohup pmm-agent --config-file=/usr/local/percona/pmm/config/pmm-agent.yaml & - sleep 60 - pmm-admin add mysql --cluster=cl1 --environment=dev --custom-labels='app=wp1' --username=root --password=secret --query-source=slowlog MySQLSlowLog ps:3306 - pmm-admin add mysql --cluster=cl2 --environment=prod --custom-labels='app=wp2' --username=root --password=secret --query-source=perfschema MySQLPerfSchema ps:3306 - tail -f /dev/null - " - volumes: - - logs-directory:/var/log/mysql - - ps: - image: percona/percona-server:latest - container_name: ps - environment: - - MYSQL_ROOT_PASSWORD=secret - ports: - - 3306:3306 - volumes: - - logs-directory:/var/log/mysql - - ${PWD}/my.cnf:/etc/my.cnf - - ${PWD}/mysql.logrotate:/etc/logrotate.d/mysql - - postgres: - image: postgres - environment: - - POSTGRES_USER=postgres - - POSTGRES_PASSWORD=secret - ports: - - "5432:5432" - - mongo: - image: mongo - environment: - - MONGO_INITDB_ROOT_USERNAME=mongo - - MONGO_INITDB_ROOT_PASSWORD=secret - ports: - - "27017:27017" - - sysbench-ps: - container_name: sysbench-ps - image: perconalab/sysbench - depends_on: - - ps - command: > - bash -c " - set -o xtrace - sleep 120 - mysql \ - --host=ps \ - --port=3306 \ - --user=root \ - --password=secret \ - -e 'CREATE DATABASE IF NOT EXISTS sbtest; SET GLOBAL slow_query_log_file = \"/var/log/mysql/mysql-slow.log\"; SET GLOBAL slow_query_log = \"ON\"; SET GLOBAL slow_query_log_always_write_time = 0;' - sysbench \ - --db-driver=mysql \ - --mysql-host=ps \ - --mysql-port=3306 \ - --mysql-user=root \ - --mysql-password=secret \ - --mysql-db=sbtest \ - --mysql-table-engine=innodb \ - --oltp-table-size=1000000 \ - /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua \ - prepare - sysbench \ - --rate=200 \ - --threads=64 \ - --report-interval=10 \ - --time=0 \ - --events=0 \ - --rand-type=pareto \ - --db-driver=mysql \ - --mysql-host=ps \ - --mysql-port=3306 \ - --mysql-user=root \ - --mysql-password=secret \ - --mysql-db=sbtest \ - --mysql-table-engine=innodb \ - --oltp-reconnect \ - --oltp-table-size=1000000 \ - /usr/share/sysbench/tests/include/oltp_legacy/select.lua \ - run - " - - sysbench-pstpcc: - image: perconalab/sysbench - depends_on: - - ps - command: > - bash -c " - set -o xtrace - sleep 200 - mysql \ - --host=ps \ - --port=3306 \ - --user=root \ - --password=secret \ - -e 'CREATE DATABASE IF NOT EXISTS sbtest; SET GLOBAL slow_query_log_file = \"/var/log/mysql/mysql-slow.log\"; SET GLOBAL slow_query_log = \"ON\"; SET GLOBAL slow_query_log_always_write_time = 0;' - cd /sysbench/sysbench-tpcc - ./tpcc.lua --mysql-host=ps --mysql-port=3306 --mysql-user=root --mysql-password=secret --mysql-db=sbtest --time=300 --threads=64 --report-interval=1 --tables=10 --scale=100 --db-driver=mysql prepare - ./tpcc.lua --mysql-host=ps --mysql-port=3306 --mysql-user=root --mysql-password=secret --mysql-db=sbtest --time=300 --threads=64 --report-interval=1 --tables=10 --scale=100 --db-driver=mysql run - " - -volumes: - logs-directory: - driver_opts: - type: volume - device: ${PWD}/logs - o: bind diff --git a/qan-api2/docker-compose.yml b/qan-api2/docker-compose.yml new file mode 100644 index 00000000000..a5cd0e1ef90 --- /dev/null +++ b/qan-api2/docker-compose.yml @@ -0,0 +1,40 @@ +--- +# See usage instructions in the root docker-compose.yml. +services: + + pmm-server: + profiles: + - pmm + container_name: pmm-server + image: percona/pmm-server:3 + restart: always + depends_on: + clickhouse: + condition: service_healthy + environment: + - PMM_CLICKHOUSE_ADDR=clickhouse:9000 + - PMM_CLICKHOUSE_DATABASE=pmm + - PMM_CLICKHOUSE_USER=default + - PMM_CLICKHOUSE_PASSWORD=clickhouse + - PMM_DISABLE_BUILTIN_CLICKHOUSE=1 + + clickhouse: + profiles: + - pmm + image: clickhouse/clickhouse-server:25.3.6.56 + container_name: clickhouse + environment: + - CLICKHOUSE_USER=default + - CLICKHOUSE_PASSWORD=clickhouse + ulimits: + nofile: + soft: 262144 + hard: 262144 + healthcheck: + test: ["CMD", "wget", "--spider", "-q", "http://localhost:8123/ping"] + interval: 5s + timeout: 5s + retries: 10 + start_period: 10s + ports: + - 9000:9000 diff --git a/ui/docker-compose.yml b/ui/docker-compose.yml index 19b1e57b568..8ce29da168b 100644 --- a/ui/docker-compose.yml +++ b/ui/docker-compose.yml @@ -32,9 +32,7 @@ services: environment: - PMM_DEBUG=1 - GF_DEFAULT_APP_MODE=development - - PMM_DEV_PORTAL_URL=https://portal-dev.percona.com - PMM_DEV_PERCONA_PLATFORM_ADDRESS=https://check-dev.percona.com:443 - - PMM_DEV_PERCONA_PLATFORM_PUBLIC_KEY=RWTkF7Snv08FCboTne4djQfN5qbrLfAjb8SY3/wwEP+X5nUrkxCEvUDJ - PMM_WATCHTOWER_HOST=http://watchtower:8080 - PMM_WATCHTOWER_TOKEN=123 # Uncomment to specify to which docker image to update