From 0e7f5621b838f84aecb1e95266f8b605767ec8b3 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Fri, 18 Mar 2022 12:04:19 +0100 Subject: [PATCH] new: [vps] add ``vps cyclos unlock`` command to release lock on database Signed-off-by: Valentin Lab --- bin/vps | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/bin/vps b/bin/vps index f204b72..4d244d5 100755 --- a/bin/vps +++ b/bin/vps @@ -706,6 +706,15 @@ cyclos:set_root_url() { export -f cyclos:set_root_url +cyclos:unlock() { + local project_name="$1" dbname="$2" url="$3" + + echo "delete from database_lock;" | + compose:psql "${project_name}" "${dbname}" +} +export -f cyclos:unlock + + compose:project_name() { if [ -z "$PROJECT_NAME" ]; then PROJECT_NAME=$(compose --get-project-name) || { @@ -1316,11 +1325,8 @@ EOF postgres:restore "$project_name" "$GZ_DUMP_LOCATION" "${cyclos_service}@${cyclos_database}" || exit 1 ## ensure that the database is not locked - ## XXXvlab: 70 is uid of user postgres, this avoids the docker bug - ## but introduce hardwritten value - Wrap -d "check and remove database lock if any" <