Mastodon Restore Role¶
Restores Mastodon from archives produced by mastodon_backup, including database, media, and configuration.
Features¶
Unpacks archive into a staging directory.
Drops and recreates the PostgreSQL database, then restores the custom-format dump.
Restores media,
.env.production, systemd units, Traefik configuration, and nginx configuration when present.Restarts services and optionally reruns migrations.
Usage¶
- hosts: mastodon
become: true
roles:
- role: local.ops_library.mastodon_restore
vars:
mastodon_restore_archive: latest
Key Variables¶
Variable |
Default |
Description |
|---|---|---|
|
|
Directory containing backup archives. |
|
|
Archive name or |
|
|
Run migrations after restoring the database. |
|
|
Remove staging directory after restore. |
|
|
Postgres OS user for running restore commands. |
Restore keeps mastodon_restore_postgres_become_user defaulting to postgres so dropdb, createdb, and
pg_restore continue to work with peer-authenticated local PostgreSQL setups. The role makes the staged database
dump path traversable by that OS user before invoking pg_restore.
See defaults/main.yml and roles/mastodon_shared/defaults/main.yml for the full reference.
Dependencies¶
local.ops_library.mastodon_shared
Testing¶
cd /path/to/ops-library
just test-role mastodon_restore
License¶
MIT