From 9961746f1fdc27287b79dd4989af7b41ccc457a9 Mon Sep 17 00:00:00 2001 From: nough Date: Thu, 7 Jul 2022 15:46:31 +0100 Subject: [PATCH] update, adding docker backup script outline --- docs/system/updating.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/system/updating.md b/docs/system/updating.md index b38f3fd36..b1da0aa78 100644 --- a/docs/system/updating.md +++ b/docs/system/updating.md @@ -11,6 +11,33 @@ For all setups using Docker the updating process look something like this 2. Pull the latest image using `docker-compose pull` 3. Start the container again using `docker-compose up -d` +## Docker Script +``` +#get vars +input name of docker_db_container +input working directory + +#backup docker +sudo docker exec -t docker_db_recipes_1 pg_dumpall -U djangouser > pgdump.sql + +docker-compose down +mv postgresql date_postgresqlbackup +check that docker-compose.yml files are up to date with latest recommended from install instructions +check that .env is up to date with latest recommended from install instructions + +#start update +docker-compose pull +docker-compose up -d +wait 5 minutes +docker-compose down +docker-compose up -d +wait 5 minutes + +#import database to new setup +cat pgdump.sql | sudo docker exec -i docker_db_recipes_1 psql postgres -U djangouser +docker-compose down +docker-compose up -d +``` ## Manual @@ -20,4 +47,4 @@ After that make sure to run: 1. `manage.py collectstatic` 2. `manage.py migrate` -To apply all new migrations and collect new static files. \ No newline at end of file +To apply all new migrations and collect new static files.