-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
33 lines (24 loc) · 1.11 KB
/
entrypoint.sh
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
27
28
29
30
31
32
#!/bin/sh
STORAGEDIR=/owntracks-storage
AUTHELIA_STORAGEDIR=${STORAGEDIR}/authelia-store
AUTHELIA_SECRETSDIR=${AUTHELIA_STORAGEDIR}/secrets
# These are read directly by Authelia, do not change their names.
# https://www.authelia.com/configuration/methods/secrets/
export AUTHELIA_JWT_SECRET_FILE=${AUTHELIA_SECRETSDIR}/jwt
export AUTHELIA_SESSION_SECRET_FILE=${AUTHELIA_SECRETSDIR}/session
export AUTHELIA_STORAGE_ENCRYPTION_KEY_FILE=${AUTHELIA_SECRETSDIR}/storage_encryption_key
# Make sure everything is set up to run correctly
setup.sh
# Run all services with fault tolerance
# Ensures that the given service never stops running. If there is an error, it is simply restarted.
persist() {
until $3; do
echo -e "\033[31mSYSTEM: $2 just crashed. This is not supposed to happen, please check your logs and see if there is an issue you can fix. The process will restart in $1 seconds.\033[0m" >&2
sleep $1
done
}
cd /configs
persist 10 'Caddy webserver' 'caddy run' &
persist 10 'Authelia' 'authelia --config /configs/authelia.yml' &
persist 10 'Owntracks extended API' 'extapi' &
persist 10 'OwnTracks recorder' 'ot-recorder'