Deployment Overview of Percona Monitoring and Management on Server¶
Prerequisites and Basic Requirements¶
The deployment of Percona Monitoring and Management (PMM) requires a server running an Ubuntu-based operating system. The following components and privileges are necessary:
- Root or sudo privileges to execute installation commands.
- A valid domain name configured for the server, following the pattern
{{ prefix }}{{ server_id }}.{{ zone }}. - Network access to the internet to download the PMM installer and SSL certificates.
- The
nginxweb server andpython3-pippackage manager must be available on the host system. - Docker must be installed and running to host the PMM application containers.
File and Directory Structure¶
The application utilizes a specific directory structure within the Docker container and the host system for configuration and data storage:
- Host SSL Certificates: Located in
/etc/letsencrypt/live/{{ prefix }}{{ server_id }}.{{ zone }}/. This directory contains thecert.pem,privkey.pem,fullchain.pem, andssl-dhparams.pemfiles issued by Certbot. - Container Nginx Configuration: Inside the
pmm-servercontainer, SSL certificates and configuration files are stored in/srv/nginx/. certificate.crt: The public certificate.certificate.key: The private key.ca-certs.pem: The full certificate chain.dhparam.pem: Diffie-Hellman parameters.certificate.conf: The Nginx configuration file for SSL.
Application Installation Process¶
The Percona Monitoring and Management application is installed using the official Percona installer script. The installation process involves the following steps:
- Update and upgrade all APT packages on the host system.
- Install the
nginxandpython3-pippackages via the APT package manager. - Install
certbotandcertbot-nginxusingpip. - Install Docker using the managed installation role.
- Execute the PMM installation script using the following command:
Access Rights and Security¶
Security for the application is enforced through SSL/TLS encryption and specific user permissions within the container:
- SSL/TLS: Certbot is used to issue and manage SSL certificates for the domain
{{ prefix }}{{ server_id }}.{{ zone }}. The certificate is requested with the--nginxplugin to automatically configure Nginx. - User Permissions: Inside the
pmm-servercontainer, thepmmuser (UID 0 in the context of thechowncommand) owns the SSL certificate files and configuration in/srv/nginx/. - Firewall: The host system must allow incoming traffic on standard web ports (80 and 443) to facilitate the Let's Encrypt HTTP challenge and secure HTTPS access.
Docker Containers and Their Deployment¶
The PMM application runs within a Docker container named pmm-server. The deployment involves copying host-generated SSL assets into the running container:
- The container is started and managed by the PMM installer.
- SSL certificates are copied from the host to the container using the
docker cpcommand:docker cp -L /etc/letsencrypt/live/{{ prefix }}{{ server_id }}.{{ zone }}/cert.pem pmm-server:/srv/nginx/certificate.crt docker cp -L /etc/letsencrypt/live/{{ prefix }}{{ server_id }}.{{ zone }}/privkey.pem pmm-server:/srv/nginx/certificate.key docker cp -L /etc/letsencrypt/live/{{ prefix }}{{ server_id }}.{{ zone }}/fullchain.pem pmm-server:/srv/nginx/ca-certs.pem docker cp /etc/letsencrypt/ssl-dhparams.pem pmm-server:/srv/nginx/dhparam.pem - Ownership of the copied files is adjusted inside the container to ensure the application can read them:
docker exec -i -u 0 pmm-server chown pmm.pmm /srv/nginx/certificate.crt docker exec -i -u 0 pmm-server chown pmm.pmm /srv/nginx/certificate.key docker exec -i -u 0 pmm-server chown pmm.pmm /srv/nginx/ca-certs.pem docker exec -i -u 0 pmm-server chown pmm.pmm /srv/nginx/dhparam.pem docker exec -i -u 0 pmm-server chown pmm.pmm /srv/nginx/certificate.conf
Proxy Servers¶
Nginx acts as the reverse proxy for the PMM application, handling SSL termination and routing traffic to the internal services:
- Configuration: Nginx is configured within the
pmm-servercontainer to use the SSL certificates located in/srv/nginx/. - Certbot Integration: The
certbot-nginxplugin is used to automatically update Nginx configuration with the new certificates. - Service Management: The Nginx service inside the container is managed via
supervisorctl.
Permission Settings¶
File permissions within the pmm-server container are strictly set to ensure the pmm user has the necessary access to SSL assets:
- All certificate files (
certificate.crt,certificate.key,ca-certs.pem,dhparam.pem) and the configuration file (certificate.conf) in/srv/nginx/are owned by thepmmuser and group. - These permissions are applied using the
chowncommand executed with root privileges inside the container.
Starting, Stopping, and Updating¶
The Nginx proxy service within the PMM container is managed using the Supervisor control utility. To apply configuration changes or restart the web server, execute the following command:
This command restarts the Nginx service inside the pmm-server container without stopping the entire PMM application stack.