Backup and Restore of Plausible Analytics

Plausible Analytics

Updated and revised on June 13, 2023 for Plausible Analytics V1.5 and V2

Plausible Analytics is an open-source web analytics tool that places special emphasis on privacy. Plausible can be used both as a ready-to-use cloud solution and as a self-hosted on-premise solution.

The on-premise solution is based on Docker, which makes the backup and restore process slightly more complicated. However, with the commands described below, backing up and restoring Plausible is straightforward.

Backup of Plausible Analytics

In the first step, you need to navigate to the directory where Plausible is installed:

cd hosting

Next, the running Plausible environment needs to be shut down:

docker-compose down

In the next step, a backup directory is created in the home directory:

mkdir $HOME/backups/

Then, the Plausible database and event data are backed up:

docker run -v plausible_db-data:/volume --rm --log-driver none loomchild/volume-backup backup > $HOME/backups/plausible_db-data.tar.bz2
docker run -v plausible_event-data:/volume --rm --log-driver none loomchild/volume-backup backup > $HOME/backups/plausible_event-data.tar.bz2

Now, in the backup directory, you should have two files: plausible_db-data.tar.bz2 and plausible_event-data.tar.bz2, which contain the backed-up data.

Restore of Plausible Analytics

To restore a backup, Plausible needs to be stopped first:

cd hosting

In the next step, the actual backup is restored:

docker run -i -v plausible_db-data:/volume --rm loomchild/volume-backup restore < $HOME/backups/plausible_db-data.tar.bz2
docker run -i -v plausible_event-data:/volume --rm loomchild/volume-backup restore < $HOME/backups/plausible_event-data.tar.bz2