mirror of
https://github.com/wekan/wekan.git
synced 2026-01-02 23:58:49 +01:00
Adding caddy support
Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
This commit is contained in:
parent
3665a9131c
commit
e077c85d00
6 changed files with 63 additions and 1 deletions
5
snap-src/Caddyfile
Normal file
5
snap-src/Caddyfile
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
http://:8080
|
||||
proxy / localhost:3001 {
|
||||
websocket
|
||||
transparent
|
||||
}
|
||||
12
snap-src/bin/caddy-control
Executable file
12
snap-src/bin/caddy-control
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# get wekan/mongo settings
|
||||
source $SNAP/bin/wekan-read-settings
|
||||
|
||||
if [ "$CADDY_ENABLED" = "true" ]; then
|
||||
env LC_ALL=C caddy -conf=$SNAP_DATA/Caddyfile -host=localhost:${CADDY_PORT}
|
||||
else
|
||||
snapctl stop caddy-service 2>&1 || true
|
||||
# sleep here, in case snapctl fails to stop service so we do not restart too often
|
||||
sleep 60
|
||||
fi
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
# store here all configuration options for wekan snap
|
||||
SNAP_NAME="wekan"
|
||||
|
||||
# read configured settings first
|
||||
SETTINGS_FILE="$SNAP_COMMON/wekan_settings.sh"
|
||||
[ -f $SETTINGS_FILE ] && . $SETTINGS_FILE
|
||||
|
||||
# list of supported keys
|
||||
keys="MONGODB_BIND_UNIX_SOCKET MONGODB_BIND_IP MONGODB_PORT MAIL_URL MAIL_FROM ROOT_URL PORT DISABLE_MONGODB"
|
||||
keys="MONGODB_BIND_UNIX_SOCKET MONGODB_BIND_IP MONGODB_PORT MAIL_URL MAIL_FROM ROOT_URL PORT DISABLE_MONGODB CADDY_ENABLED CADDY_BIND_PORT"
|
||||
|
||||
# default values
|
||||
DESCRIPTION_MONGODB_BIND_UNIX_SOCKET="mongodb binding unix socket:\n"\
|
||||
|
|
@ -42,3 +44,11 @@ KEY_PORT="port"
|
|||
DESCRIPTION_DISABLE_MONGODB="Disable mongodb service: use only if binding to database outside of the snap. Valid values: [true,false]"
|
||||
DEFAULT_DISABLE_MONGODB="false"
|
||||
KEY_DISABLE_MONGODB="disable-mongodb"
|
||||
|
||||
DESCRIPTION_CADDY_ENABLED="Enable caddy service (caddy - Every Site on HTTPS). Set to 'true' to enable caddy\n caddy settings are handled through $SNAP_COMMON/Caddyfile"
|
||||
DEFAULT_CADDY_ENABLED="false"
|
||||
KEY_CADDY_ENABLED="caddy-enabled"
|
||||
|
||||
DESCRIPTION_CADDY_BIND_PORT="Port on which caddy will expect proxy, value set here will be set in $SNAP_COMMON/Caddyfile"
|
||||
DEFAULT_CADDY_BIND_PORT="3001"
|
||||
KEY_CADDY_BIND_PORT="caddy-bind-port"
|
||||
|
|
|
|||
|
|
@ -18,3 +18,12 @@ do
|
|||
export $key=$value
|
||||
fi
|
||||
done
|
||||
|
||||
# if caddy is enabled, do update port settings based on caddy file
|
||||
if [ "$CADDY_ENABLED" = "true" ]; then
|
||||
echo "caddy is enabled, adjusting ports"
|
||||
export CADDY_PORT=${PORT}
|
||||
echo -e "CADDY_PORT=$CADDY_PORT"
|
||||
export PORT=${CADDY_BIND_PORT}
|
||||
echo -e "PORT=$PORT"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue