2.7 KiB
2.7 KiB
Backup/Restore/Move/Remove your instance
Backup
- Stop the Pleroma service.
- Go to the working directory of Pleroma (default is
/opt/pleroma
) - Run
sudo -Hu postgres pg_dump -d <pleroma_db> --format=custom -f </path/to/backup_location/pleroma.pgdump>
(make sure the postgres user has write access to the destination file) - Copy
pleroma.pgdump
,config/prod.secret.exs
and theuploads
folder to your backup destination. If you have other modifications, copy those changes too. - Restart the Pleroma service.
Restore/Move
- Optionally reinstall Pleroma (either on the same server or on another server if you want to move servers). Try to use the same database name.
- Stop the Pleroma service.
- Go to the working directory of Pleroma (default is
/opt/pleroma
) - Copy the above mentioned files back to their original position.
- Drop the existing database and recreate an empty one
sudo -Hu postgres psql -c 'DROP DATABASE <pleroma_db>;';
sudo -Hu postgres psql -c 'CREATE DATABASE <pleroma_db>;';
- Run
sudo -Hu postgres pg_restore -d <pleroma_db> -v -1 </path/to/backup_location/pleroma.pgdump>
- If you installed a newer Pleroma version, you should run
mix ecto.migrate
1. This task performs database migrations, if there were any. - Restart the Pleroma service.
- Run
sudo -Hu postgres vacuumdb --all --analyze-in-stages
. This will quickly generate the statistics so that postgres can properly plan queries.
Remove
- Optionally you can remove the users of your instance. This will trigger delete requests for their accounts and posts. Note that this is 'best effort' and doesn't mean that all traces of your instance will be gone from the fediverse.
- You can do this from the admin-FE where you can select all local users and delete the accounts using the Moderate multiple users dropdown.
- You can also list local users and delete them individualy using the CLI tasks for Managing users.
- Stop the Pleroma service
systemctl stop pleroma
- Disable pleroma from systemd
systemctl disable pleroma
- Remove the files and folders you created during installation (see installation guide). This includes the pleroma, nginx and systemd files and folders.
- Reload nginx now that the configuration is removed
systemctl reload nginx
- Remove the database and database user
sudo -Hu postgres psql -c 'DROP DATABASE <pleroma_db>;';
sudo -Hu postgres psql -c 'DROP USER <pleroma_db>;';
- Remove the system user
userdel pleroma
- Remove the dependencies that you don't need anymore (see installation guide). Make sure you don't remove packages that are still needed for other software that you have running!
-
Prefix with
MIX_ENV=prod
to run it using the production config file. ↩︎