diff --git a/docs/administrator/upgrade/backup.md b/docs/administrator/upgrade/backup.md index 6ef6eb0a7..bd5d72fbe 100644 --- a/docs/administrator/upgrade/backup.md +++ b/docs/administrator/upgrade/backup.md @@ -9,8 +9,8 @@ Before performing big changes, we recommend you back up your database and media :::{tab-item} Debian :sync: debian - ```{code-block} sh - sudo -u postgres -H pg_dumpall -c funkwhale > /path/to/your/backup/dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql + ```console + $ sudo -u postgres -H pg_dumpall -c funkwhale > /path/to/your/backup/dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql ``` ::: @@ -18,8 +18,16 @@ Before performing big changes, we recommend you back up your database and media :::{tab-item} Docker :sync: docker - ```{code-block} sh - sudo docker compose exec postgres pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql + 1. Stop the running containers: + + ```console + $ sudo docker compose down + ``` + + 2. Dump the database to a backup file: + + ```console + $ sudo docker compose run --rm postgres pg_dump -U postgres postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql ``` ::: @@ -32,9 +40,9 @@ Before performing big changes, we recommend you back up your database and media :::{tab-item} Debian :sync: debian - ```{code-block} sh - rsync -avzhP /srv/funkwhale/data/media /path/to/your/backup/media - rsync -avzhP /srv/funkwhale/data/music /path/to/your/backup/music + ```console + $ rsync -avzhP /srv/funkwhale/data/media /path/to/your/backup/media + $ rsync -avzhP /srv/funkwhale/data/music /path/to/your/backup/music ``` ::: @@ -42,10 +50,9 @@ Before performing big changes, we recommend you back up your database and media :::{tab-item} Docker :sync: docker - ```{code-block} sh - - rsync -avzhP /srv/funkwhale/data/media /path/to/your/backup/media - rsync -avzhP /srv/funkwhale/data/music /path/to/your/backup/music + ```console + $ rsync -avzhP /srv/funkwhale/data/media /path/to/your/backup/media + $ rsync -avzhP /srv/funkwhale/data/music /path/to/your/backup/music ``` ::: @@ -58,8 +65,8 @@ Before performing big changes, we recommend you back up your database and media :::{tab-item} Debian :sync: debian - ```{code-block} sh - rsync -avzhP /srv/funkwhale/config/.env /path/to/your/backup/.env + ```console + $ rsync -avzhP /srv/funkwhale/config/.env /path/to/your/backup/.env ``` ::: @@ -67,8 +74,8 @@ Before performing big changes, we recommend you back up your database and media :::{tab-item} Docker :sync: docker - ```{code-block} sh - rsync -avzhP /srv/funkwhale/.env /path/to/your/backup/.env + ```console + $ rsync -avzhP /srv/funkwhale/.env /path/to/your/backup/.env ``` ::: @@ -84,16 +91,16 @@ To restart your files, do the following: 1. Rename your current file directories. - ```{code-block} sh - mv /srv/funkwhale/data/media /srv/funkwhale/data/media.bak - mv /srv/funkwhale/data/music /srv/funkwhale/data/music.bak + ```console + $ mv /srv/funkwhale/data/media /srv/funkwhale/data/media.bak + $ mv /srv/funkwhale/data/music /srv/funkwhale/data/music.bak ``` 2. Restore your backed-up files to the original directories. - ```{code-block} sh - mv /patht/to/your/backup/media /srv/funkwhale/data/media - mv /path/to/your/backup/music /srv/funkwhale/data/music + ```console + $ mv /path/to/your/backup/media /srv/funkwhale/data/media + $ mv /path/to/your/backup/music /srv/funkwhale/data/music ``` ### Restore the database @@ -107,15 +114,15 @@ To restore your database, do the following: 1. Restore your database backup: - ```{code-block} sh - sudo -u postgres psql -f /path/to/your/backup/dump.sql funkwhale + ```console + $ sudo -u postgres psql -f /path/to/your/backup/dump.sql funkwhale ``` 2. Run the `funkwhale-manage migrate` command to set up the database. - ```{code-block} sh - cd /srv/funkwhale - venv/bin/funkwhale-manage migrate + ```console + $ cd /srv/funkwhale + $ venv/bin/funkwhale-manage migrate ``` ::: @@ -125,14 +132,20 @@ To restore your database, do the following: 1. Restore your database backup. - ```{code-block} sh - sudo docker compose run --rm -T postgres psql -U postgres postgres < "/path/to/your/backup/dump.sql" + ```console + $ sudo docker compose run --rm -T postgres psql -U postgres postgres < "/path/to/your/backup/dump.sql" ``` 2. Run the `funkwhale-manage migrate` command to set up the database. - ```{code-block} sh - sudo docker compose run --rm api funkwhale-manage migrate + ```console + $ sudo docker compose run --rm api funkwhale-manage migrate + ``` + +3. Restart the services. + + ```console + $ sudo docker compose up -d ``` :::