forked from ungleich-public/cdist-contrib
__wikijs: add version management and HTTP(S) port configuration
This commit is contained in:
parent
647833580d
commit
7122fe1bee
8 changed files with 51 additions and 11 deletions
|
@ -7,8 +7,25 @@ then
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
generate_ssl_section () {
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
ssl:
|
||||||
|
enabled: ${SSL}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "$SSL" = "true" ]; then
|
||||||
|
cat << EOF
|
||||||
|
port: $HTTPS_PORT
|
||||||
|
provider: letsencrypt
|
||||||
|
domain: ${__target_host:?}
|
||||||
|
subscriberEmail: ${LE_EMAIL:?}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
port: 80
|
port: $HTTP_PORT
|
||||||
db:
|
db:
|
||||||
type: postgres
|
type: postgres
|
||||||
host: localhost
|
host: localhost
|
||||||
|
@ -17,12 +34,7 @@ db:
|
||||||
pass: $1
|
pass: $1
|
||||||
db: ${DB_NAME:?}
|
db: ${DB_NAME:?}
|
||||||
ssl: false
|
ssl: false
|
||||||
ssl:
|
$(generate_ssl_section)
|
||||||
enabled: ${SSL}
|
|
||||||
port: 443
|
|
||||||
provider: letsencrypt
|
|
||||||
domain: ${__target_host:?}
|
|
||||||
subscriberEmail: ${LE_EMAIL:?}
|
|
||||||
pool:
|
pool:
|
||||||
min: 2
|
min: 2
|
||||||
max: 10
|
max: 10
|
||||||
|
|
14
type/__wikijs/gencode-remote
Normal file → Executable file
14
type/__wikijs/gencode-remote
Normal file → Executable file
|
@ -1,17 +1,22 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
VERSION_FILE=/var/wiki/version
|
||||||
|
version=$(cat "${__object:?}/parameter/version")
|
||||||
|
|
||||||
# Check for installation
|
# Check for installation
|
||||||
cat << EOF
|
cat << EOF
|
||||||
if [ -f '/var/wiki/LICENSE' ];
|
if [ -f $VERSION_FILE ] && [ "\$(cat $VERSION_FILE)" = "$version" ];
|
||||||
then
|
then
|
||||||
# Assume everything is done already.
|
# Assume everything is done already.
|
||||||
exit 0;
|
exit 0;
|
||||||
|
else
|
||||||
|
echo "$version" > $VERSION_FILE
|
||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Download and copy source
|
# Download and copy source
|
||||||
cat << EOF
|
cat << EOF
|
||||||
wget -O - https://github.com/Requarks/wiki/releases/download/2.4.107/wiki-js.tar.gz | tar xz -C /var/wiki
|
wget -O - https://github.com/Requarks/wiki/releases/download/$version/wiki-js.tar.gz | tar xz -C /var/wiki
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Install deps and launch
|
# Install deps and launch
|
||||||
|
@ -19,3 +24,8 @@ cat << EOF
|
||||||
cd /var/wiki || exit 1
|
cd /var/wiki || exit 1
|
||||||
npm install
|
npm install
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Restart service.
|
||||||
|
cat << EOF
|
||||||
|
service wikijs restart
|
||||||
|
EOF
|
||||||
|
|
|
@ -22,6 +22,9 @@ REQUIRED PARAMETERS
|
||||||
database-password
|
database-password
|
||||||
The password to the PSQL database.
|
The password to the PSQL database.
|
||||||
|
|
||||||
|
version
|
||||||
|
'wikijs' version to be deployed.
|
||||||
|
|
||||||
OPTIONAL PARAMETERS
|
OPTIONAL PARAMETERS
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
@ -37,6 +40,12 @@ letsencrypt-mail
|
||||||
If the SSL parameter is passed, then we setup wikijs to automatically obtain
|
If the SSL parameter is passed, then we setup wikijs to automatically obtain
|
||||||
certificates: this is the email used to sign up to a LE account.
|
certificates: this is the email used to sign up to a LE account.
|
||||||
|
|
||||||
|
http-port
|
||||||
|
Specify HTTP port, defaults to 80.
|
||||||
|
|
||||||
|
http-port
|
||||||
|
Specify HTTPS port, defaults to 443. Only relevant if the SSL flag is enabled.
|
||||||
|
|
||||||
BOOLEAN PARAMETERS
|
BOOLEAN PARAMETERS
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ then
|
||||||
fi
|
fi
|
||||||
export SSL
|
export SSL
|
||||||
|
|
||||||
if ! [ "$SSL" = "false" ];
|
if [ "$SSL" = "true" ];
|
||||||
then
|
then
|
||||||
if [ -f "${__object:?}/parameter/letsencrypt-mail" ];
|
if [ -f "${__object:?}/parameter/letsencrypt-mail" ];
|
||||||
then
|
then
|
||||||
|
@ -45,6 +45,10 @@ then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
HTTP_PORT=$(cat "${__object:?}/parameter/http-port")
|
||||||
|
HTTPS_PORT=$(cat "${__object:?}/parameter/https-port")
|
||||||
|
export HTTP_PORT HTTPS_PORT
|
||||||
|
|
||||||
db_pass="$(cat "${__object:?}/parameter/database-password")"
|
db_pass="$(cat "${__object:?}/parameter/database-password")"
|
||||||
|
|
||||||
__package nodejs
|
__package nodejs
|
||||||
|
@ -52,7 +56,7 @@ __package npm
|
||||||
__directory /var/wiki/
|
__directory /var/wiki/
|
||||||
|
|
||||||
# These things are Alpine-dependant.
|
# These things are Alpine-dependant.
|
||||||
__file /etc/init.d/wikijs --source "${__files:?}/files/wikijs-openrc"
|
__file /etc/init.d/wikijs --source "${__type:?}/files/wikijs-openrc"
|
||||||
__package nghttp2-dev # Required for some reason, else a symbol is missing
|
__package nghttp2-dev # Required for some reason, else a symbol is missing
|
||||||
|
|
||||||
mkdir -p "${__object:?}/files"
|
mkdir -p "${__object:?}/files"
|
||||||
|
|
1
type/__wikijs/parameter/default/http-port
Normal file
1
type/__wikijs/parameter/default/http-port
Normal file
|
@ -0,0 +1 @@
|
||||||
|
80
|
1
type/__wikijs/parameter/default/https-port
Normal file
1
type/__wikijs/parameter/default/https-port
Normal file
|
@ -0,0 +1 @@
|
||||||
|
443
|
|
@ -1,3 +1,5 @@
|
||||||
database
|
database
|
||||||
database-user
|
database-user
|
||||||
letsencrypt-mail
|
letsencrypt-mail
|
||||||
|
http-port
|
||||||
|
https-port
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
database-password
|
database-password
|
||||||
|
version
|
||||||
|
|
Loading…
Reference in a new issue