Posted onIntutorialViews: Word count in article: 1.6kReading time ≈1 mins.
Recently, I need to migrate a lot of services from one server to another, this time, it is turn for Plausible.
Log in the older server as root.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
cd ~ mkdir plausible_backups # create a folder for saving exported data tar -cvzf plausible.tar.gz hosting/ # hosting is your plausible repo
cd hosting/ docker-compose down # close current plausible service when export data docker run -v hosting_db-data:/volume --rm --log-driver none loomchild/volume-backup backup > ~/plausible_backups/hosting_db-data docker run -v hosting_event-data:/volume --rm --log-driver none loomchild/volume-backup backup > ~/plausible_backups/hosting_event-data cd ~ tar -czvf hosting.tar.gz hosting/ tar -czvf plausible_backups.tar.gz plausible_backups/ scp hosting.tar.gz root@new.server:~ # use scp to transfer back up file to new server scp plausible_backups.tar.gz root@new.server:~ cd hosting docker-compose up -d # restart plausible service in old service service nginx restart
Log in new server as root.
1 2 3 4
tar -xzvf hosting.tar.gz tar -xzvf plausible_backups.tar.gz cd hosting/ vim plausible-conf.env
docker-compose up -d # initiate plausible service docker-compose down # stop plausible service when import backup date docker run -i -v hosting_db-data:/volume --rm loomchild/volume-backup restore -f < ~/plausible_backups/hosting_db-data docker run -i -v hosting_event-data:/volume --rm loomchild/volume-backup restore -f < ~/plausible_backups/hosting_event-data docker-compose up -d # restart plausible service service nginx restart
Then maybe you need to update your plausible javascript url in html or projects.