dataset/seed/forgejo/templates/forgejo.service

40 lines
2.1 KiB
SYSTEMD
Raw Permalink Normal View History

2023-01-03 11:36:37 +01:00
#GNUNUX https://codeberg.org/forgejo/forgejo/raw/branch/forgejo/contrib/systemd/forgejo.service
[Unit]
Description=Forgejo (Beyond coding. We forge.)
After=syslog.target
After=network.target
#>GNUNUX
After=risotto.target
#<GNUNUX
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=2s
Type=simple
User=forgejo
Group=forgejo
WorkingDirectory=/srv/forgejo/lib/
ExecStart=/usr/bin/forgejo web --config /etc/forgejo/app.ini
2023-06-23 08:12:05 +02:00
ExecStartPre=/bin/bash -c '{% if True -%}{% endif -%}
/usr/bin/forgejo migrate --config /etc/forgejo/app.ini;{% if True -%}{% endif -%}
if /usr/bin/forgejo admin auth list --config /etc/forgejo/app.ini | grep "OAuth2"; then {% if True -%}{% endif -%}
echo "UPDATE";{% if True -%}{% endif -%}
id=$(/usr/bin/forgejo --config /etc/forgejo/app.ini admin auth list |tail -n 1|awk "{ print \$1}");{% if True -%}{% endif -%}
/usr/bin/forgejo admin auth update-oauth --id $id --name "{{ general.network.interface_0.domain_name_eth0 }}" --provider "openidConnect" --key "{{ general.oauth2_client.oauth2_client_id }}" --secret "{{ general.oauth2_client.oauth2_client_secret }}" --scopes "profile email" --auto-discover-url "https://{{ general.oauth2_client.oauth2_client_server_domainname }}/.well-known/openid-configuration" --config /etc/forgejo/app.ini;{% if True -%}{% endif -%}
else {% if True -%}{% endif -%}
echo "CONFIGURE";{% if True -%}{% endif -%}
/usr/bin/forgejo admin auth add-oauth --name "{{ general.network.interface_0.domain_name_eth0 }}" --provider "openidConnect" --key "{{ general.oauth2_client.oauth2_client_id }}" --secret "{{ general.oauth2_client.oauth2_client_secret }}" --scopes "profile email" --auto-discover-url "https://{{ general.oauth2_client.oauth2_client_server_domainname }}/.well-known/openid-configuration" --config /etc/forgejo/app.ini;{% if True -%}{% endif -%}
fi;{% if True -%}{% endif -%}
sleep 2;{% if True -%}{% endif -%}
2023-01-03 11:36:37 +01:00
echo "CONFIGURATION DONE"'
Restart=always
Environment=GITEA_WORK_DIR=/srv/forgejo/lib
[Install]
WantedBy=multi-user.target