Skip to content

Commit

Permalink
#99 some more backup/restore documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ephes committed Aug 14, 2023
1 parent 9f40bf1 commit af0d107
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
21 changes: 20 additions & 1 deletion docs/backup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,27 @@
Backup
######

***********************
Database Backup/Restore
***********************

There's no unified way to backup and restore a database. For my personal projects
I use ansible playbooks like this:

* `backup <https://github.com/ephes/homepage/blob/main/deploy/backup_database.yml>`_
* `restore <https://github.com/ephes/homepage/blob/main/deploy/restore_database.yml>`_

It would be nice to be able to fetch all the relevant database contents by just
reading from the cast REST-api and recreate the contents by just writing to
another cast REST-api. This would make it possible to backup and restore really
easy. But for now you have to do something database specific.

********************
Media Backup/Restore
********************

Backup and restore are supported by the `media_backup` and `media_restore` commands.
Backup and restore are supported by the `media_backup` and `media_restore`
:ref:`management commands <cast_management_commands>`.

Once we have a unified way to backup and restore the database, we can also
integrate the media backup and restore into a single command.
14 changes: 8 additions & 6 deletions docs/management-commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
Django-Admin Commands
*********************

.. _cast_management_commands:

There are some management-commands bundled with django-cast. Most of them
are dealing with the management of media files.

* ``recalc_video_posters``: Recalculate the poster images for all videos.
* ``s3_backup``: Backup media files from S3 to local media root.
* ``s3_media_sizes``: Print the sizes of all media files on S3.
* ``s3_replace``: Replace paths on s3 with versions from local media root.
* ``media_backup``: Backup media files from production to backup storage backend (requires Django >= 4.2).
* ``media_sizes``: Print the sizes of all media files stored in the production storage backend (requires Django >= 4.2).
* ``media_replace``: Replace files on production storage backend with versions from local file system (requires Django >= 4.2).
This might be useful for videos for which you now have a better compressed
version, but you don't want to generate a new name.
* ``s3_restore``: Restore media files from local media root to S3.
* ``s3_stale``: Print the paths of all media files on S3 that are not
referenced in the database.
* ``media_restore``: Restore media files from backup storage backend to production storage backend (requires Django >= 4.2).
* ``media_stale``: Print the paths of all media files stored in the production storage backend that are not
referenced in the database (requires Django >= 4.2).

0 comments on commit af0d107

Please sign in to comment.