mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-22 09:36:52 +03:00
Breakup the backups section for docker into its own document
This commit is contained in:
parent
4b348812db
commit
0a6b06ebe4
|
@ -91,35 +91,6 @@ Production Mode
|
|||
|
||||
Instead of using `dev.yml`, you would use `docker-compose.yml`.
|
||||
|
||||
Database Backups
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
The database has to be running to create/restore a backup.
|
||||
|
||||
First, run the app with `docker-compose -f dev.yml up`.
|
||||
|
||||
To create a backup, run::
|
||||
|
||||
docker-compose -f dev.yml run postgres backup
|
||||
|
||||
|
||||
To list backups, run::
|
||||
|
||||
docker-compose -f dev.yml run postgres list-backups
|
||||
|
||||
|
||||
To restore a backup, run::
|
||||
|
||||
docker-compose -f dev.yml run postgres restore filename.sql
|
||||
|
||||
To copy the files from the running Postgres container to the host system::
|
||||
|
||||
docker cp <containerId>:/backups /host/path/target
|
||||
|
||||
Where <containerId> is the ID of the Postgres container. To get it, run::
|
||||
|
||||
docker ps
|
||||
|
||||
Other Useful Tips
|
||||
-----------------
|
||||
|
||||
|
|
40
docs/docker-postgres-backups.rst
Normal file
40
docs/docker-postgres-backups.rst
Normal file
|
@ -0,0 +1,40 @@
|
|||
============================
|
||||
Database Backups with Docker
|
||||
============================
|
||||
|
||||
The database has to be running to create/restore a backup. These examples show local examples. If you want to use it on a remote server, remove ``-f dev.yml`` from each example.
|
||||
|
||||
Running Backups
|
||||
================
|
||||
|
||||
Run the app with `docker-compose -f dev.yml up`.
|
||||
|
||||
To create a backup, run::
|
||||
|
||||
docker-compose -f dev.yml run postgres backup
|
||||
|
||||
|
||||
To list backups, run::
|
||||
|
||||
docker-compose -f dev.yml run postgres list-backups
|
||||
|
||||
|
||||
To restore a backup, run::
|
||||
|
||||
docker-compose -f dev.yml run postgres restore filename.sql
|
||||
|
||||
Where <containerId> is the ID of the Postgres container. To get it, run::
|
||||
|
||||
docker ps
|
||||
|
||||
To copy the files from the running Postgres container to the host system::
|
||||
|
||||
docker cp <containerId>:/backups /host/path/target
|
||||
|
||||
Restoring From Backups
|
||||
======================
|
||||
|
||||
To restore the production database to a local PostgreSQL database::
|
||||
|
||||
createdb NAME_OF_DATABASE
|
||||
psql NAME_OF_DATABASE < NAME_OF_BACKUP_FILE
|
|
@ -21,6 +21,7 @@ Contents:
|
|||
deployment-on-pythonanywhere
|
||||
deployment-on-heroku
|
||||
deployment-with-docker
|
||||
docker-postgres-backups
|
||||
faq
|
||||
troubleshooting
|
||||
my-favorite-cookie
|
||||
|
|
Loading…
Reference in New Issue
Block a user