From 9b6a294ae5d4e6115b1c64fc495b3e500b39a917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Sun, 16 Apr 2023 23:43:37 +0900 Subject: [PATCH] software/metabase: fix backup restoration use dropdb and createdb command is a working approach to backup restoration here --- software/metabase/buildout.hash.cfg | 2 +- software/metabase/instance.cfg.in | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/software/metabase/buildout.hash.cfg b/software/metabase/buildout.hash.cfg index ab39519de..e65fe1574 100644 --- a/software/metabase/buildout.hash.cfg +++ b/software/metabase/buildout.hash.cfg @@ -1,3 +1,3 @@ [instance-profile] filename = instance.cfg.in -md5sum = 0e74c862401f266111552b7a3611f7bf +md5sum = 685e7b371768f6977896d7214fd379f1 diff --git a/software/metabase/instance.cfg.in b/software/metabase/instance.cfg.in index e3cf0d2f9..db4052f2e 100644 --- a/software/metabase/instance.cfg.in +++ b/software/metabase/instance.cfg.in @@ -130,7 +130,7 @@ recipe = slapos.cookbook:generate.password [postgresql] recipe = slapos.cookbook:postgres -bin = ${postgresql10:location}/bin/ +bin = ${postgresql10:location}/bin services = $${directory:service} dbname = metabase_db superuser = metabase-psql @@ -190,7 +190,16 @@ wrapper-path = $${directory:bin}/$${:_buildout_section_name_} command-line = sh -e -c "\ echo 'This will replace current database with latest backup. Hit Ctrl+C to cancel'; - sleep 30; + sleep 10; + $${postgresql:bin}/dropdb \ + -h $${postgresql:pgdata-directory} \ + -U $${postgresql:superuser} \ + --if-exists \ + $${postgresql:dbname}; + $${postgresql:bin}/createdb \ + -h $${postgresql:pgdata-directory} \ + -U $${postgresql:superuser} \ + $${postgresql:dbname}; $${postgresql:bin}/pg_restore \ --exit-on-error \ -h $${postgresql:pgdata-directory} \ -- 2.30.9