Skip to content

Commit

Permalink
PMM-12644 Remove the use of data container (#3414)
Browse files Browse the repository at this point in the history
* PMM-12664 Remove the use of the data container

* PMM-12664 Fix the GA image name

---------

Co-authored-by: Catalina A <[email protected]>
  • Loading branch information
ademidoff and catalinaadam authored Jan 10, 2025
1 parent 8bb3568 commit 1a3170f
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 130 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,20 @@ jobs:
git status
typos_check:
spell-check:
name: Spell check
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Check spelling of md files
uses: crate-ci/typos@9d890159570d5018df91fedfa40b4730cd4a81b1 # v1.28.4
with:
files: "**/*.md ./documentation/**/*.md"

merge-gatekeeper:
needs: [ check, typos_check ]
needs: [ check, spell-check ]
name: Merge Gatekeeper
if: ${{ always() }}
runs-on: ubuntu-22.04
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@

!!! summary alert alert-info ""
- Stop and rename the `pmm-server` container.
- Take a local copy of the `pmm-data` container's `/srv` directory.
- Take a local copy of the `pmm-server` container's `/srv` directory.

---

!!! caution alert alert-warning "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.
Grafana plugins have been moved to the `/srv` directory 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:

```sh
docker exec -it pmm-server ls /var/lib/grafana/plugins
docker exec -t pmm-server ls -l /var/lib/grafana/plugins
```
To backup container:

To back up the container:
{.power-number}

1. Stop the container:
Expand All @@ -26,13 +27,13 @@ To backup container:
docker stop pmm-server
```

2. Move the image:
2. Rename the image:

```sh
docker rename pmm-server pmm-server-backup
```

3. Create a subdirectory (e.g., `pmm-data-backup`) and move to it:
3. Create a subdirectory (e.g., `pmm-data-backup`) and change directory to it:

```sh
mkdir pmm-data-backup && cd pmm-data-backup
Expand All @@ -41,5 +42,5 @@ To backup container:
4. Back up the data:

```sh
docker cp pmm-data:/srv .
docker cp pmm-server-backup:/srv .
```
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ You can also install PMM 3 manually, following the instructions below.

Before starting the installation, review the installation prerequisites below and choose a method to run PMM Server with Docker based on your preferred data storage option:

- [Running Docker with Data container](../docker/run_with_data_container.md)
- [Running Docker with host directory](../docker/run_with_host_dir.md)
- [Running Docker with volume](../docker/run_with_vol.md)

Expand All @@ -35,14 +34,14 @@ Before starting the installation, review the installation prerequisites below an

!!! summary alert alert-info ""
- Pull the Docker image.
- Copy it to create a persistent data container.
- Choose how you want to store data.
- Run the image.
- Open the PMM UI in a browser.

---
??? info "Key points"

- To disable the Home Dashboard **PMM Upgrade** panel you can either add `-e DISABLE_UPDATES=true` to the `docker run` command (for the life of the container) or navigate to _PMM --> PMM Settings --> Advanced Settings_ and disable "Check for Updates" (can be turned back on by any admin in the UI).
- To disable the Home Dashboard **PMM Upgrade** panel you can either add `-e PMM_ENABLE_UPDATES=false` to the `docker run` command (for the life of the container) or navigate to _PMM --> PMM Settings --> Advanced Settings_ and disable "Check for Updates" (can be turned back on by any admin in the UI).

- Eliminate browser certificate warnings by configuring a [trusted certificate](https://docs.percona.com/percona-monitoring-and-management/how-to/secure.html#ssl-encryption).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
# Remove container

??? info "Summary"

!!! summary alert alert-info ""
- Stop the container.
- Remove (delete) both the server and data containers.
- Remove (delete) both images.

---

!!! caution alert alert-warning "Caution"
These steps delete the PMM Server Docker image and any accumulated PMM metrics data.

To remove the container:
{.power-number}

1. Stop pmm-server container.
1. Stop pmm-server container:

```sh
docker stop pmm-server
```

2. Remove containers.
2. Remove the container:

```sh
docker rm pmm-server
```

3. Remove the data volume:

```sh
docker rm pmm-server pmm-data
docker volume rm pmm-data
```

3. Remove the image.
4. Remove the image:

```sh
docker rmi $(docker images | grep "percona/pmm-server" | awk {'print $3'})
```
docker rmi $(docker images | grep "percona/pmm-server" | awk '{print $3}')
```
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
# Restore container

??? info "Summary"

!!! summary alert alert-info ""
- Stop and remove the container.
- Restore (rename) the backup container.
- Restore saved data to the data container.
- Restore permissions to the data.

---

!!! caution alert alert-warning "Important"
You must have a [backup](backup_container.md) to restore from.

Expand All @@ -22,7 +12,7 @@ To restore the container:
docker stop pmm-server
```

2. Remove it.
2. Remove the container.

```sh
docker rm pmm-server
Expand All @@ -36,36 +26,24 @@ To restore the container:

4. Change directory to the backup directory (e.g. `pmm-data-backup`).

5. Remove Victoria Metrics data folder.

```sh
docker run --rm --volumes-from pmm-data -it percona/pmm-server:3 rm -r /srv/victoriametrics/data
cd pmm-data-backup
```

6. Copy the data.
5. Copy the data.

```sh
docker cp srv pmm-data:/
docker run --rm -v $(pwd)/srv:/backup -v pmm-data:/srv -t percona/pmm-server:3 cp -r /backup/* /srv
```

7. Restore permissions.
6. Restore permissions.

```sh
docker run --rm --volumes-from pmm-data -it percona/pmm-server:3 chown -R root:root /srv && \
docker run --rm --volumes-from pmm-data -it percona/pmm-server:3 chown -R pmm:pmm /srv/alertmanager && \
docker run --rm --volumes-from pmm-data -it percona/pmm-server:3 chown -R root:pmm /srv/clickhouse && \
docker run --rm --volumes-from pmm-data -it percona/pmm-server:3 chown -R grafana:grafana /srv/grafana && \
docker run --rm --volumes-from pmm-data -it percona/pmm-server:3 chown -R pmm:pmm /srv/logs && \
docker run --rm --volumes-from pmm-data -it percona/pmm-server:3 chown -R postgres:postgres /srv/postgres14 && \
docker run --rm --volumes-from pmm-data -it percona/pmm-server:3 chown -R pmm:pmm /srv/prometheus && \
docker run --rm --volumes-from pmm-data -it percona/pmm-server:3 chown -R pmm:pmm /srv/victoriametrics && \
docker run --rm --volumes-from pmm-data -it percona/pmm-server:3 chown -R postgres:postgres /srv/logs/postgresql14.log
docker run --rm -v pmm-data:/srv -t percona/pmm-server:3 chown -R pmm:pmm /srv
```

8. Start the image.
7. Start the image.

```sh
docker start pmm-server
```


This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,39 @@ To run Docker with the host directory:
docker pull percona/pmm-server:3
```

2. Run the image:
2. Identify a directory on the host that you want to use to persist PMM data. For example, `/home/user/srv`.

3. Run the image:

```sh
docker run --detach --restart always \
--publish 443:8443 \
--env PMM_WATCHTOWER_HOST=your_watchtower_host \
--env PMM_WATCHTOWER_TOKEN=your_watchtower_token \
--volumes-from pmm-data \
--volume /home/user/srv:/srv \
--network=pmm_default \
--name pmm-server \
percona/pmm-server:3
```

3. Change the password for the default `admin` user:
4. Change the password for the default `admin` user:

```sh
docker exec -t pmm-server change-admin-password <new_password>
```

4. Check the [WatchTower prerequisites](../docker/index.md|#prerequisites) and pass the following command to Docker Socket to start [Watchtower](https://containrrr.dev/watchtower/):
5. Check the [WatchTower prerequisites](../docker/index.md|#prerequisites) and pass the following command to Docker Socket to start [Watchtower](https://containrrr.dev/watchtower/):

```sh
docker run -v /var/run/docker.sock:/var/run/docker.sock -e WATCHTOWER_HTTP_API_UPDATE=1 -e WATCHTOWER_HTTP_API_TOKEN=your_watchtower_token --hostname=your_watchtower_host --network=pmm_default docker.io/perconalab/watchtower
```

5. Visit `https://localhost:443` to see the PMM user interface in a web browser. (If you are accessing the docker host remotely, replace `localhost` with the IP or server name of the host.)
6. Visit `https://localhost:443` to see the PMM user interface in a web browser. (If you are accessing the docker host remotely, replace `localhost` with the IP or server name of the host.)

## Migrate from data container to host directory/volume
## Migrate from data container to host directory

To migrate your PMM from data container to host directory or volume run the following command:
To migrate your PMM from data container to host directory, run the following command:

```sh
docker cp <containerId>:/srv /target/host/directory
docker cp <container-id>:/srv /target/host/directory
```
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ To run Docker with volume:
--publish 443:8443 \
--env PMM_WATCHTOWER_HOST=your_watchtower_host \
--env PMM_WATCHTOWER_TOKEN=your_watchtower_token \
--volumes-from pmm-data \
--volume pmm-data:/srv \
--network=pmm_default \
--name pmm-server \
percona/pmm-server:3
```

4. Change the password for the default `admin` user, replacing `your_secure_password123` with a strong, unique password:
4. Change the password for the default `admin` user, replacing `your_secure_password` with a strong, unique password:

```sh
docker exec -t pmm-server change-admin-password your_secure_password123
docker exec -t pmm-server change-admin-password your_secure_password
```

5. Check the [WatchTower prerequisites](../docker/index.md|#prerequisites) and pass the following command to Docker Socket to start [Watchtower](https://containrrr.dev/watchtower/):
Expand All @@ -41,4 +41,4 @@ To run Docker with volume:
docker run -v /var/run/docker.sock:/var/run/docker.sock -e WATCHTOWER_HTTP_API_UPDATE=1 -e WATCHTOWER_HTTP_API_TOKEN=your_watchtower_token --hostname=your_watchtower_host --network=pmm_default docker.io/perconalab/watchtower
```

6. Visit `https://localhost:443` to see the PMM user interface in a web browser. If you are accessing the Docker host remotely, replace `localhost` with the IP or server name of the host.
6. Visit `https://localhost:443` to see the PMM user interface in a web browser. If you are accessing the Docker host remotely, replace `localhost` with the IP or server name of the host.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ In case you want to add extra environment variables (useful for advanced operati

```yaml
pmmEnv:
DISABLE_UPDATES: "1"
PMM_ENABLE_UPDATES: "1"
```
### PMM SSL certificates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ To run Podman as a non-privileged user:
# keep updates disabled
# do image replacement instead (update the tag and restart the service)
DISABLE_UPDATES=1
PMM_ENABLE_UPDATES=1
EOF
```
Expand Down
1 change: 1 addition & 0 deletions documentation/docs/pmm-upgrade/migrating_from_pmm_2.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Migrate PMM 2 to PMM 3

PMM 3 introduces significant architectural changes that require gradual transition from PMM 2.

You can migrate to PMM 3 either automatically using the upgrade script (recommended), or manually by following step-by-step instructions.

To graduallly migrate to PMM 3:
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/pmm-upgrade/upgrade_helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Percona releases new chart versions to update containers when:
The UI update feature is disabled by default and should remain so. Do not modify or add the following parameter in your custom `values.yaml` file:
```yaml
pmmEnv:
DISABLE_UPDATES: "1"
PMM_ENABLE_UPDATES: "1"
```

## Before you begin
Expand Down
1 change: 0 additions & 1 deletion documentation/mkdocs-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ nav:
- install-pmm/install-pmm-server/baremetal/docker/easy-install.md
- install-pmm/install-pmm-server/baremetal/docker/index.md
- install-pmm/install-pmm-server/baremetal/docker/run_with_vol.md
- install-pmm/install-pmm-server/baremetal/docker/run_with_data_container.md
- install-pmm/install-pmm-server/baremetal/docker/run_with_host_dir.md
- install-pmm/install-pmm-server/baremetal/docker/backup_container.md
- install-pmm/install-pmm-server/baremetal/docker/restore_container.md
Expand Down

0 comments on commit 1a3170f

Please sign in to comment.