umorpha-boxes/modules/service-bookstack.sh.in

78 lines
1.9 KiB
Bash
Raw Normal View History

2023-11-16 18:12:05 +00:00
#!/hint/bash -euE
# Copyright (C) 2023 Umorpha Systems
# SPDX-License-Identifier: AGPL-3.0-or-later
load_module "$(dirname -- "${BASH_SOURCE[0]}")/base-uwsgi.sh"
load_module "$(dirname -- "${BASH_SOURCE[0]}")/base-nginx.sh"
packages+=(
uwsgi-plugin-php
)
post_install+=(20:bookstack:post_install)
bookstack:post_install() {
local arg_mountpoint=$1
install -Dm644 /dev/stdin "$arg_mountpoint/etc/nginx/sites/bookstack.conf" <<-'EOF'
# -*- mode: nginx; nginx-indent-level: 4; intent-tabs-mode: nil -*-
server {
server_name bookstack.mothstuff.lol;
include /etc/nginx/snippets/listen.conf;
root /usr/share/webapps/bookstack/public;
index index.php index.html;
location /index.php {
uwsgi_cache_key $host$request_uri;
uwsgi_cache_valid 5m;
include uwsgi_params;
uwsgi_modifier1 14; # Standard PHP request
uwsgi_pass unix:/run/uwsgi/bookstack.sock;
}
}
EOF
2023-12-07 16:55:46 +00:00
install -Dm600 /dev/stdin "$arg_mountpoint/etc/webapps/bookstack/config.env" <<-'EOF'
2023-11-16 18:12:05 +00:00
APP_KEY=@APP_KEY@
APP_URL=https://bookstack.mothstuff.lol
DB_HOST=localhost
DB_DATABASE=bookstack
DB_USERNAME=bookstack
DB_PASSWORD=@DB_PASSWORD@
MAIL_DRIVER=smtp
MAIL_HOST=mail.infomaniak.com
MAIL_PORT=465
MAIL_ENCRYPTION=tls
MAIL_USERNAME=bookstack@umorpha.io
MAIL_PASSWORD=@MAIL_PASSWORD@
MAIL_FROM=lukeshu@umorpha.io
MAIL_FROM="Umorpha BookStack"
AUTH_METHOD=oidc
AUTH_AUTO_INITIATE=true
OIDC_NAME=Infomaniak
OIDC_DISPLAY_NAME_CLAIMS=name
OIDC_CLIENT_ID=@CLIENT_ID@
OIDC_CLIENT_SECRET=@CLIENT_SECRET@
OIDC_ISSUER=https://login.infomaniak.com
OIDC_ISSUER_DISCOVER=true
EOF
2023-12-07 16:55:46 +00:00
install -Dm600 /dev/stdin "$arg_mountpoint/etc/uwsgi/bookstack.ini" <<-'EOF'
2023-11-16 18:12:05 +00:00
[uwsgi]
master = true
processes = 4
uid = %n
gid = http
plugins = php
php-set = extension=gd.so
EOF
systemctl --root="$arg_mountpoint" enable uwsgi@bookstack.socket
}