[__wikijs] run under own user

This commit is contained in:
fnux 2021-03-01 07:23:47 +01:00
parent f1bab1e23b
commit 859a156cef
No known key found for this signature in database
GPG key ID: 4502C902C00A1E12
3 changed files with 10 additions and 3 deletions

View file

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

View file

@ -17,6 +17,7 @@ EOF
# Download and copy source
cat << EOF
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
# Install deps and launch

View file

@ -52,15 +52,20 @@ export HTTP_PORT HTTPS_PORT
db_pass="$(cat "${__object:?}/parameter/database-password")"
__package nodejs
__directory /var/wiki/
__user wikijs --home /var/wiki --create-home
# These things are Alpine-dependant.
__file /etc/init.d/wikijs \
--source "${__type:?}/files/wikijs-openrc" \
--mode 0755
__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"
"${__type:?}/files/config.yml.sh" "$db_pass" > "${__object:?}/files/config.yml"
require='__directory/var/wiki' \
__file /var/wiki/config.yml --source "${__object:?}/files/config.yml"
require='__user/wikijs' \
__file /var/wiki/config.yml \
--source "${__object:?}/files/config.yml" \
--owner wikijs