Skip to content
Snippets Groups Projects
Unverified Commit 3b2a07f4 authored by vmaubert's avatar vmaubert Committed by GitHub
Browse files

chore(backup): ajoute une commande pour récupérer un backup sans les fichiers (#1234)

parent 688f0c79
No related merge requests found
......@@ -12,6 +12,7 @@ infra/cd/.cargo_docker
infra/cd/.cargo
infra/cd/target
packages/api/backups
packages/api/backup_without_files.backup
packages/api/sources
packages/api/files
packages/api/api-cache
......@@ -20,4 +21,4 @@ packages/api/docs
packages/ui/coverage
packages/ui/stats.html
packages/ui/dist
docs
\ No newline at end of file
docs
......@@ -16,7 +16,7 @@ docker exec camino_api_db vacuumlo camino
docker exec camino_api_db pg_dump --clean --if-exists --format=d --no-owner --no-privileges --dbname=camino -f /dump
docker exec camino_api_db chown -R "{{camino_user_uid}}:${USER_GROUP_ID}" /dump
docker exec camino_api_db pg_dump --clean --if-exists --no-owner --no-privileges -B --dbname=camino > /srv/backups/dump_without_files.sql
docker exec camino_api_db pg_dump --clean --if-exists --no-owner --no-privileges -B --dbname=camino --format c > /srv/backups/dump_without_files.backup
# sauvegarde les fichiers
rsync --delete -r /srv/www/camino/files/ /srv/backups/files
......
......@@ -8,6 +8,7 @@
node_modules
/backups
backup_without_files.sql
backup_without_files.backup
/dist
/coverage
/api-cache
......
......@@ -11,9 +11,9 @@
"monthly": "node --loader ts-node/esm/transpile-only ./src/scripts/monthly.ts",
"db:dump": "rm -rf ./backups/* && pg_dump --host=localhost --username=postgres --clean --if-exists --format=d --no-owner --no-privileges --dbname=camino --file=./backups/",
"db:import": "pg_restore --host=localhost --username=postgres --clean --if-exists --no-owner --no-privileges --dbname=camino ./backups",
"db:import-without-files": "pg_restore --host=localhost --username=postgres --clean --if-exists --no-owner --no-privileges --dbname=camino ./backup_without_files.sql",
"db:import-without-files": "pg_restore --host=localhost --username=postgres --clean --if-exists --no-owner --no-privileges --dbname=camino < ./backup_without_files.backup",
"db:prod-fetch": "rm -rf ./backups/* && ssh camino.beta.gouv.fr 'rm -f ~/backup.tgz && cd /srv/backups/dump/ && tar cvzf ~/backup.tgz .' && scp camino.beta.gouv.fr:~/backup.tgz backups/ && tar xvf backups/backup.tgz --directory ./backups",
"db:prod-fetch-without-files": "scp camino.beta.gouv.fr:/srv/backups/dump_without_files.sql ./backup_without_files.sql",
"db:prod-fetch-without-files": "scp camino.beta.gouv.fr:/srv/backups/dump_without_files.backup ./backup_without_files.backup",
"db:recreate": "dropdb --host=localhost --username=postgres camino && createdb --host=localhost --username=postgres camino",
"db:migrate": "node --loader ts-node/esm/transpile-only ./src/knex/migrate.ts",
"db:add-migration": "NODE_OPTIONS='--loader ts-node/esm/transpile-only' knex migrate:make",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment