fix: start tailscale before forgejo
If tailscale is not up then we can't reach the database. Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
This commit is contained in:
parent
34bbab282c
commit
d5d3984557
1 changed files with 30 additions and 26 deletions
|
|
@ -63,34 +63,38 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
systemd.services.forgejo.preStart = ''
|
||||
auth="${lib.getExe config.services.forgejo.package} admin auth"
|
||||
systemd.services.forgejo = {
|
||||
requires = [ "tailscaled.service" ];
|
||||
|
||||
echo "Trying to find existing sso configuration for Authelia"...
|
||||
set +e -o pipefail
|
||||
id="$($auth list | grep "Authelia.*OAuth2" | cut -d' ' -f1)"
|
||||
found=$?
|
||||
set -e +o pipefail
|
||||
preStart = ''
|
||||
auth="${lib.getExe config.services.forgejo.package} admin auth"
|
||||
|
||||
if [[ $found = 0 ]]; then
|
||||
echo Found sso configuration at id=$id, updating it if needed.
|
||||
$auth update-oauth \
|
||||
--id $id \
|
||||
--name "Authelia" \
|
||||
--provider openidConnect \
|
||||
--key forgejo \
|
||||
--secret $(tr -d '\n' < ${config.sops.secrets."forgejo/oidc-secret".path}) \
|
||||
--auto-discover-url https://auth.escapeangle.com/.well-known/openid-configuration
|
||||
else
|
||||
echo Did not find any sso configuration, creating one with name Authelia.
|
||||
$auth add-oauth \
|
||||
--name Authelia \
|
||||
--provider openidConnect \
|
||||
--key forgejo \
|
||||
--secret $(tr -d '\n' < ${config.sops.secrets."forgejo/oidc-secret".path}) \
|
||||
--auto-discover-url https://auth.escapeangle.com/.well-known/openid-configuration
|
||||
fi
|
||||
'';
|
||||
echo "Trying to find existing sso configuration for Authelia"...
|
||||
set +e -o pipefail
|
||||
id="$($auth list | grep "Authelia.*OAuth2" | cut -d' ' -f1)"
|
||||
found=$?
|
||||
set -e +o pipefail
|
||||
|
||||
if [[ $found = 0 ]]; then
|
||||
echo Found sso configuration at id=$id, updating it if needed.
|
||||
$auth update-oauth \
|
||||
--id $id \
|
||||
--name "Authelia" \
|
||||
--provider openidConnect \
|
||||
--key forgejo \
|
||||
--secret $(tr -d '\n' < ${config.sops.secrets."forgejo/oidc-secret".path}) \
|
||||
--auto-discover-url https://auth.escapeangle.com/.well-known/openid-configuration
|
||||
else
|
||||
echo Did not find any sso configuration, creating one with name Authelia.
|
||||
$auth add-oauth \
|
||||
--name Authelia \
|
||||
--provider openidConnect \
|
||||
--key forgejo \
|
||||
--secret $(tr -d '\n' < ${config.sops.secrets."forgejo/oidc-secret".path}) \
|
||||
--auto-discover-url https://auth.escapeangle.com/.well-known/openid-configuration
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."git.escapeangle.com" = {
|
||||
forceSSL = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue