mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-11 23:44:53 +03:00
Update docker-postgres-backups.rst
Changed `docker-compose` to `docker compose`
This commit is contained in:
parent
f12c4f6a77
commit
56545804fd
|
@ -8,7 +8,7 @@ Prerequisites
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
#. the project was generated with ``use_docker`` set to ``y``;
|
#. the project was generated with ``use_docker`` set to ``y``;
|
||||||
#. the stack is up and running: ``docker-compose -f local.yml up -d postgres``.
|
#. the stack is up and running: ``docker compose -f local.yml up -d postgres``.
|
||||||
|
|
||||||
|
|
||||||
Creating a Backup
|
Creating a Backup
|
||||||
|
@ -16,7 +16,7 @@ Creating a Backup
|
||||||
|
|
||||||
To create a backup, run::
|
To create a backup, run::
|
||||||
|
|
||||||
$ docker-compose -f local.yml exec postgres backup
|
$ docker compose -f local.yml exec postgres backup
|
||||||
|
|
||||||
Assuming your project's database is named ``my_project`` here is what you will see: ::
|
Assuming your project's database is named ``my_project`` here is what you will see: ::
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ Viewing the Existing Backups
|
||||||
|
|
||||||
To list existing backups, ::
|
To list existing backups, ::
|
||||||
|
|
||||||
$ docker-compose -f local.yml exec postgres backups
|
$ docker compose -f local.yml exec postgres backups
|
||||||
|
|
||||||
These are the sample contents of ``/backups``: ::
|
These are the sample contents of ``/backups``: ::
|
||||||
|
|
||||||
|
@ -55,9 +55,9 @@ With a single backup file copied to ``.`` that would be ::
|
||||||
|
|
||||||
$ docker cp 9c5c3f055843:/backups/backup_2018_03_13T09_05_07.sql.gz .
|
$ docker cp 9c5c3f055843:/backups/backup_2018_03_13T09_05_07.sql.gz .
|
||||||
|
|
||||||
You can also get the container ID using ``docker-compose -f local.yml ps -q postgres`` so if you want to automate your backups, you don't have to check the container ID manually every time. Here is the full command ::
|
You can also get the container ID using ``docker compose -f local.yml ps -q postgres`` so if you want to automate your backups, you don't have to check the container ID manually every time. Here is the full command ::
|
||||||
|
|
||||||
$ docker cp $(docker-compose -f local.yml ps -q postgres):/backups ./backups
|
$ docker cp $(docker compose -f local.yml ps -q postgres):/backups ./backups
|
||||||
|
|
||||||
.. _`command`: https://docs.docker.com/engine/reference/commandline/cp/
|
.. _`command`: https://docs.docker.com/engine/reference/commandline/cp/
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ Restoring from the Existing Backup
|
||||||
|
|
||||||
To restore from one of the backups you have already got (take the ``backup_2018_03_13T09_05_07.sql.gz`` for example), ::
|
To restore from one of the backups you have already got (take the ``backup_2018_03_13T09_05_07.sql.gz`` for example), ::
|
||||||
|
|
||||||
$ docker-compose -f local.yml exec postgres restore backup_2018_03_13T09_05_07.sql.gz
|
$ docker compose -f local.yml exec postgres restore backup_2018_03_13T09_05_07.sql.gz
|
||||||
|
|
||||||
You will see something like ::
|
You will see something like ::
|
||||||
|
|
||||||
|
@ -94,5 +94,5 @@ Backup to Amazon S3
|
||||||
----------------------------------
|
----------------------------------
|
||||||
For uploading your backups to Amazon S3 you can use the aws cli container. There is an upload command for uploading the postgres /backups directory recursively and there is a download command for downloading a specific backup. The default S3 environment variables are used. ::
|
For uploading your backups to Amazon S3 you can use the aws cli container. There is an upload command for uploading the postgres /backups directory recursively and there is a download command for downloading a specific backup. The default S3 environment variables are used. ::
|
||||||
|
|
||||||
$ docker-compose -f production.yml run --rm awscli upload
|
$ docker compose -f production.yml run --rm awscli upload
|
||||||
$ docker-compose -f production.yml run --rm awscli download backup_2018_03_13T09_05_07.sql.gz
|
$ docker compose -f production.yml run --rm awscli download backup_2018_03_13T09_05_07.sql.gz
|
||||||
|
|
Loading…
Reference in New Issue
Block a user