Skip to content

Podman

How to run PMM Server with Podman on our Docker image

The tags used here are for the current release (PMM 2.33.0). Other tags are available.

See also

Docker

Podman is an open-source project available on most Linux platforms and resides on GitHub. Podman is a daemonless container engine for developing, managing, and running Open Container Initiative (OCI) containers and container images on your Linux System.

Non-privileged users could run containers under the control of Podman.

It could be just aliased (alias docker=podman) with docker and work with the same way. All instructions from Docker section also apply here.

Percona recommends running PMM as a non-privileged user and running it as part of the SystemD service provided. SystemD service ensures that the service is running and maintains logs and other management features (start, stop, etc.).

Before you start

Run as non-privileged user to start PMM

Availability

This feature is available starting with PMM 2.29.0.

Summary

  • Install.
  • Configure.
  • Enable and Start.
  • Open the PMM UI in a browser.

  1. Install.

    Create ~/.config/systemd/user/pmm-server.service file:

    mkdir -p ~/.config/systemd/user/
    cat << "EOF" > ~/.config/systemd/user/pmm-server.service
    [Unit]
    Description=pmm-server
    Wants=network-online.target
    After=network-online.target
    After=nss-user-lookup.target nss-lookup.target
    After=time-sync.target
    
    [Service]
    Type=simple
    
    # set environment for this unit
    Environment=PMM_PUBLIC_PORT=8443
    Environment=PMM_VOLUME_NAME=%N
    Environment=PMM_TAG=2.33.0
    Environment=PMM_IMAGE=docker.io/percona/pmm-server
    Environment=PMM_ENV_FILE=%h/.config/pmm-server/pmm-server.env
    
    # optional env file that could override previous env settings for this unit
    EnvironmentFile=-%h/.config/pmm-server/env
    
    ExecStart=/usr/bin/podman run --rm --replace=true --name=%N -p ${PMM_PUBLIC_PORT}:443/tcp --ulimit=host --volume=${PMM_VOLUME_NAME}:/srv --env-file=${PMM_ENV_FILE} --health-cmd=none --health-interval=disable ${PMM_IMAGE}:${PMM_TAG}
    ExecStop=/usr/bin/podman stop -t 10 %N
    Restart=on-failure
    RestartSec=20
    
    [Install]
    Alias=%N
    WantedBy=default.target
    
    EOF
    

    Create ~/.config/pmm-server/pmm-server.env file:

    mkdir -p ~/.config/pmm-server/
    cat << "EOF" > ~/.config/pmm-server/pmm-server.env
    # env file passed to the container
    # full list of environment variables:
    # https://www.percona.com/doc/percona-monitoring-and-management/2.x/setting-up/server/docker.html#environment-variables
    
    # keep updates disabled
    # do image replacement instead (update the tag and restart the service)
    DISABLE_UPDATES=1
    
    # Enable DBaaS feature
    #ENABLE_DBAAS=1
    EOF
    
  2. Configure.

    There are 2 configuration files: 1. ~/.config/pmm-server/pmm-server.env defines environment variables for PMM Server (PMM parameters like DBaaS feature and etc) 2. ~/.config/pmm-server/env defines environment variables for SystemD service (image tags, repo and etc)

    SystemD service passes the environment parameters from the pmm-server.envfile (in ~/.config/pmm-server/pmm-server.env) to PMM. For more information about container environment variables, check Docker Environment.

    SystemD service uses some environment variables that could be customized if needed:

    Environment=PMM_PUBLIC_PORT=8443
    Environment=PMM_VOLUME_NAME=%N
    Environment=PMM_TAG=2.33.0
    Environment=PMM_IMAGE=docker.io/percona/pmm-server
    

    You can override the environment variables by defining them in the file ~/.config/pmm-server/env. For example, to override the path to a custom registry ~/.config/pmm-server/env:

    mkdir -p ~/.config/pmm-server/
    cat << "EOF" > ~/.config/pmm-server/env
    PMM_TAG=2.31.0
    PMM_IMAGE=docker.io/percona/pmm-server
    PMM_PUBLIC_PORT=8443
    EOF
    

    Important

    Ensure that you modify PMM_TAG in ~/.config/pmm-server/env and update it regularly as Percona cannot update it. It needs to be done by you.

  3. Enable and Start.

    systemctl --user enable --now pmm-server
    
  4. Visit https://localhost:8443 to see the PMM user interface in a web browser. (If you are accessing host remotely, replace localhost with the IP or server name of the host.)

Backup

Summary

  • Stop PMM server.
  • Backup the data.

Important

Grafana plugins have been moved to the data volume /srv since the 2.23.0 version. So if you are upgrading PMM from any version before 2.23.0 and have installed additional plugins then plugins should be installed again after the upgrade. To check used grafana plugins: podman exec -it pmm-server ls /var/lib/grafana/plugins

  1. Stop PMM server.

    systemctl --user stop pmm-server
    
  2. Backup the data.

    podman volume export pmm-server --output pmm-server-backup.tar
    

    Important

    If you changed the default name to PMM_VOLUME_NAME environment variable, use that name after export instead of pmm-server (which is the default volume name).

Upgrade

Summary

  • Perform a backup.
  • Update PMM tag.
  • Pre-pull image.
  • Run it.

Important

You cannot downgrade. To go to a previous version, you must create a backup before upgrading.

Tip

To see the current release running on your system, use the PMM Upgrade panel on the Home Dashboard, or run:

podman exec -it pmm-server \
curl -ku admin:admin https://localhost/v1/version

(If you are accessing the podman host remotely, replace localhost with the IP or server name of the host.)

  1. Perform a backup.

  2. Update PMM tag.

    Edit ~/.config/pmm-server/env and create/update with a new tag from latest release:

    sed -i "s/PMM_TAG=.*/PMM_TAG=2.33.0/g" ~/.config/pmm-server/env
    
  3. Pre-pull image for faster restart.

    source ~/.config/pmm-server/env
    podman pull ${PMM_IMAGE}:${PMM_TAG}
    
  4. Run PMM.

    systemctl --user restart pmm-server
    

Restore

Summary

  • Stop PMM server.
  • Run PMM on the previous image.
  • Restore the volume.
  • Start PMM Server.

Important

You must have a backup to restore from. You need to perform restore only if you have issues with upgrade or with the data.

  1. Stop PMM server.

    systemctl --user stop pmm-server
    
  2. Run PMM on the previous image.

    Edit ~/.config/pmm-server/env file:

    sed -i "s/PMM_TAG=.*/PMM_TAG=2.31.0/g" ~/.config/pmm-server/env
    

    Important

    X.Y.Z (2.31.0) is the version you used before upgrade and you made Backup with it

  3. Restore the volume.

    podman volume import pmm-server pmm-server-backup.tar
    
  4. Start PMM Server.

    systemctl --user start pmm-server
    

Remove

Summary

  • Stop PMM server.
  • Remove (delete) volume.
  • Remove (delete) images.

Caution

These steps delete the PMM Server Docker image and the associated PMM metrics data.

  1. Stop PMM server.

    systemctl --user stop pmm-server
    
  2. Remove volume.

    podman volume rm --force pmm-server
    
  3. Remove the PMM images.

    podman rmi $(podman images | grep "pmm-server" | awk {'print $3'})
    

Get expert help

If you need assistance, visit the community forum for comprehensive and free database knowledge, or contact our Percona Database Experts for professional support and services.