Merge branch 'wikijs-user' into 'master'

[__wikijs] run under own user

See merge request ungleich-public/cdist-contrib!26
This commit is contained in:
fnux 2021-03-08 09:44:42 +01:00
commit c80d041e1c
3 changed files with 10 additions and 3 deletions

View file

@ -3,6 +3,7 @@
command='/usr/bin/node' command='/usr/bin/node'
command_args='server' command_args='server'
command_background=true command_background=true
command_user='wikijs'
description="Run wiki.js" description="Run wiki.js"
directory='/var/wiki' directory='/var/wiki'
error_log=/var/log/"$RC_SVCNAME".err error_log=/var/log/"$RC_SVCNAME".err

View file

@ -17,6 +17,7 @@ EOF
# Download and copy source # Download and copy source
cat << EOF cat << EOF
wget -O - https://github.com/Requarks/wiki/releases/download/$version/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
chown -R wikijs:wikijs /var/wiki
EOF EOF
# Install deps and launch # Install deps and launch

View file

@ -52,15 +52,20 @@ export HTTP_PORT HTTPS_PORT
db_pass="$(cat "${__object:?}/parameter/database-password")" db_pass="$(cat "${__object:?}/parameter/database-password")"
__package nodejs __package nodejs
__directory /var/wiki/ __user wikijs --home /var/wiki --create-home
# These things are Alpine-dependant. # These things are Alpine-dependant.
__file /etc/init.d/wikijs \ __file /etc/init.d/wikijs \
--source "${__type:?}/files/wikijs-openrc" \ --source "${__type:?}/files/wikijs-openrc" \
--mode 0755 --mode 0755
__package nghttp2-dev # Required for some reason, else a symbol is missing __package nghttp2-dev # Required for some reason, else a symbol is missing
for logfile in wikijs.log wikijs.err; do
require="__user/wikijs" __file /var/log/$logfile --owner wikijs
done
mkdir -p "${__object:?}/files" mkdir -p "${__object:?}/files"
"${__type:?}/files/config.yml.sh" "$db_pass" > "${__object:?}/files/config.yml" "${__type:?}/files/config.yml.sh" "$db_pass" > "${__object:?}/files/config.yml"
require='__directory/var/wiki' \ require='__user/wikijs' \
__file /var/wiki/config.yml --source "${__object:?}/files/config.yml" __file /var/wiki/config.yml \
--source "${__object:?}/files/config.yml" \
--owner wikijs