From f7b72a1a8030c4b49f4c15ebae82cdbcf8b5f259 Mon Sep 17 00:00:00 2001 From: Ondrej Kubik Date: Thu, 22 Feb 2018 11:47:26 +0000 Subject: Fixing typo and improving help text Signed-off-by: Ondrej Kubik --- snap-src/bin/config | 4 ++-- snap-src/bin/wekan-help | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/snap-src/bin/config b/snap-src/bin/config index c3434c8e..da2ee5cd 100755 --- a/snap-src/bin/config +++ b/snap-src/bin/config @@ -8,7 +8,7 @@ keys="MONGODB_BIND_UNIX_SOCKET MONGODB_BIND_IP MONGODB_PORT MAIL_URL MAIL_FROM R # default values DESCRIPTION_MONGODB_BIND_UNIX_SOCKET="mongodb binding unix socket:\n"\ "\t\t\t Default behaviour will preffer binding over unix socket, to disable unix socket binding set value to 'nill' string\n"\ -"\t\t\t To bind to instance of mongo provided through contect interface set to relative path to the socket inside shared directory" +"\t\t\t To bind to instance of mongodb provided through content interface,set value to relative path to the socket inside '$SNAP_DATA/shared' directory" DEFAULT_MONGODB_BIND_UNIX_SOCKET="$SNAP_DATA/share" KEY_MONGODB_BIND_UNIX_SOCKET="mongodb-bind-unix-socket" @@ -36,7 +36,7 @@ DESCRIPTION_PORT="port wekan is exposed at" DEFAULT_PORT="8080" KEY_PORT="port" -DESCRIPTION_DISABLE_MONGODB="Disable mongodb service: use only if binding to database outside of the snap. Valid values: [true,false]" +DESCRIPTION_DISABLE_MONGODB="Disable mongodb service: use only if binding to database outside of the ${SNAP_NAME} snap. Valid values: [true,false]" DEFAULT_DISABLE_MONGODB="false" KEY_DISABLE_MONGODB="disable-mongodb" diff --git a/snap-src/bin/wekan-help b/snap-src/bin/wekan-help index a498b9b9..ee565500 100755 --- a/snap-src/bin/wekan-help +++ b/snap-src/bin/wekan-help @@ -8,15 +8,10 @@ if [ "$CADDY_ENABLED" = "true" ]; then fi echo -e "Wekan: The open-source Trello-like kanban.\n" -echo -e "Make sure you have connected all interfaces, check more by calling $ snap interfaces" +echo -e "Make sure you have connected all interfaces, check more by calling $ snap interfaces ${SNAP_NAME}" echo -e "\n" -echo -e "${SNAP_NAME} has multiple services, to check status/restart/stop use systemctl" -echo -e "mongodb service:" -echo -e "\t$ sudo systemctl status/start/stop/restart snap.$SNAP_NAME.mongodb" -echo -e "wekan service" -echo -e "\t$ sudo systemctl status/start/stop/restart snap.$SNAP_NAME.wekan" -echo -e "Optional caddy service" -echo -e "\t$ sudo systemctl status/start/stop/restart snap.$SNAP_NAME.caddy" +echo -e "${SNAP_NAME} has multiple services, to check status use systemctl" +echo -e "\t$ systemctl status snap.$SNAP_NAME.*" echo -e "\n" echo -e "To make backup of wekan's database use: $ ${SNAP_NAME}.database-backup [backup file]" echo -e "\t backup file is optional parameter, if not passed backup is created in directory:" -- cgit v1.2.3-1-g7c22 From e3bd1c4d23baefa9a321b6501c2ea1ae5893aaa3 Mon Sep 17 00:00:00 2001 From: Ondrej Kubik Date: Thu, 22 Feb 2018 11:47:53 +0000 Subject: Adding mongodb service control to configure hook Signed-off-by: Ondrej Kubik --- snap/hooks/configure | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/snap/hooks/configure b/snap/hooks/configure index 5d121e15..89ada296 100755 --- a/snap/hooks/configure +++ b/snap/hooks/configure @@ -22,5 +22,12 @@ else snapctl stop --disable ${SNAP_NAME}.caddy 2>&1 || true fi +value=$(snapctl get disable-mongodb) +if [ "$value" = "true" ]; then + snapctl stop --disable ${SNAP_NAME}.mongodb 2>&1 || true +else + snapctl start --enable ${SNAP_NAME}.mongodb 2>&1 || true +fi + # restart all services snapctl restart ${SNAP_NAME} 2>&1 || true -- cgit v1.2.3-1-g7c22 From fd47e10e523ab687a470484ee62e502cf82bf7bd Mon Sep 17 00:00:00 2001 From: Ondrej Kubik Date: Thu, 22 Feb 2018 13:14:03 +0000 Subject: Tuning services life cycle Signed-off-by: Ondrej Kubik --- snap-src/bin/caddy-control | 4 ++-- snap-src/bin/mongodb-control | 3 ++- snap/hooks/configure | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/snap-src/bin/caddy-control b/snap-src/bin/caddy-control index 92ce70ba..46d36c6b 100755 --- a/snap-src/bin/caddy-control +++ b/snap-src/bin/caddy-control @@ -6,7 +6,7 @@ source $SNAP/bin/wekan-read-settings if [ "$CADDY_ENABLED" = "true" ]; then env LC_ALL=C caddy -conf=$SNAP_COMMON/Caddyfile -host=localhost:${CADDY_PORT} else - snapctl stop caddy-service 2>&1 || true + echo "caddy is disabled. Stop service" + snapctl stop --disable ${SNAP_NAME}.caddy # sleep here, in case snapctl fails to stop service so we do not restart too often - sleep 60 fi diff --git a/snap-src/bin/mongodb-control b/snap-src/bin/mongodb-control index 08af132d..a7a98739 100755 --- a/snap-src/bin/mongodb-control +++ b/snap-src/bin/mongodb-control @@ -4,7 +4,8 @@ source $SNAP/bin/wekan-read-settings if [ "true" == "${DISABLE_MONGODB}" ]; then - echo "mongodb is disabled. Not starting it" + echo "mongodb is disabled. Stop service" + snapctl stop --disable ${SNAP_NAME}.mongodb exit 0 fi diff --git a/snap/hooks/configure b/snap/hooks/configure index 89ada296..5dcea5b9 100755 --- a/snap/hooks/configure +++ b/snap/hooks/configure @@ -17,6 +17,7 @@ if [ "$value" = "true" ]; then port=$(snapctl get port) [ "x" != "x${bind_port}" ] && sed -i 's|proxy / localhost:.* {|proxy / localhost:'"${bind_port}"' {|g' $SNAP_COMMON/Caddyfile [ "x" != "x$port" ] && sed -i 's|http://:.*|http://:'"${port}"'|g' $SNAP_COMMON/Caddyfile + snapctl stop ${SNAP_NAME}.caddy 2>&1 || true snapctl start --enable ${SNAP_NAME}.caddy 2>&1 || true else snapctl stop --disable ${SNAP_NAME}.caddy 2>&1 || true @@ -26,8 +27,9 @@ value=$(snapctl get disable-mongodb) if [ "$value" = "true" ]; then snapctl stop --disable ${SNAP_NAME}.mongodb 2>&1 || true else + snapctl stop ${SNAP_NAME}.mongodb 2>&1 || true snapctl start --enable ${SNAP_NAME}.mongodb 2>&1 || true fi # restart all services -snapctl restart ${SNAP_NAME} 2>&1 || true +snapctl restart ${SNAP_NAME}.wekan 2>&1 || true -- cgit v1.2.3-1-g7c22