summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2018-02-22 21:50:41 +0200
committerGitHub <noreply@github.com>2018-02-22 21:50:41 +0200
commit435501fb8e5a5d68c3e9e05fff5c6ee24a3f9166 (patch)
tree45811552a3ed967c651be4895b4b0b182d6407d1
parent31f25bcddbc8e3a1f0e2c657d7189da2e10f4c49 (diff)
parentfd47e10e523ab687a470484ee62e502cf82bf7bd (diff)
downloadwekan-435501fb8e5a5d68c3e9e05fff5c6ee24a3f9166.tar.gz
wekan-435501fb8e5a5d68c3e9e05fff5c6ee24a3f9166.tar.bz2
wekan-435501fb8e5a5d68c3e9e05fff5c6ee24a3f9166.zip
Merge pull request #1500 from kubiko/devel
service life cycle improvements
-rwxr-xr-xsnap-src/bin/caddy-control4
-rwxr-xr-xsnap-src/bin/config4
-rwxr-xr-xsnap-src/bin/mongodb-control3
-rwxr-xr-xsnap-src/bin/wekan-help11
-rwxr-xr-xsnap/hooks/configure11
5 files changed, 19 insertions, 14 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/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/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-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:"
diff --git a/snap/hooks/configure b/snap/hooks/configure
index 5d121e15..5dcea5b9 100755
--- a/snap/hooks/configure
+++ b/snap/hooks/configure
@@ -17,10 +17,19 @@ 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
fi
+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