blob: 38e07f92d3115d3f686ba99103b39a0326139f4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/bin/sh
# Web frontend container: bokfweb (login gate), ttyd (browser terminal)
# and Caddy (routing on :8790, behind the host's TLS proxy). The gate and
# ttyd listen on 127.0.0.1 only. Each helper is restarted if it dies; Caddy
# is the main process, so the container stops (and compose restarts it)
# when Caddy does.
set -eu
export BOKFD_SOCKET="${BOKFD_SOCKET:-/run/bokfd/bokfd.sock}"
export XDG_DATA_HOME=/tmp/caddy-data XDG_CONFIG_HOME=/tmp/caddy-config
keep() {
while :; do
"$@" || true
echo "web: $1 exited, restarting" >&2
sleep 1
done
}
keep bokfweb &
keep ttyd -i 127.0.0.1 -p 7681 -b /web/tty -a -W -O \
-m "${BOKF_WEB_MAX_SESSIONS:-20}" \
-t titleFixed=bokf -t fontSize=15 -t disableLeaveAlert=true \
bokftui-web &
exec caddy run --config /etc/caddy/Caddyfile --adapter caddyfile
|