98 lines
3.0 KiB
Django/Jinja
98 lines
3.0 KiB
Django/Jinja
[Unit]
|
|
Description=Forgejo (Beyond coding. We forge.)
|
|
After=syslog.target
|
|
After=network.target
|
|
###
|
|
# Don't forget to add the database service dependencies
|
|
###
|
|
{% if forgejo_dbservice is defined %}
|
|
Wants={{ forgejo_dbservice }}
|
|
After={{ forgejo_dbservice }}
|
|
{% endif %}
|
|
|
|
###
|
|
# If using socket activation for main http/s
|
|
###
|
|
{% if forgejo_websocket is defined %}
|
|
After=forgejo.main.socket
|
|
Requires=forgejo.main.socket
|
|
|
|
###
|
|
# (You can also provide forgejo an http fallback and/or ssh socket too)
|
|
#
|
|
# An example of /etc/systemd/system/forgejo.main.socket
|
|
###
|
|
|
|
[Unit]
|
|
Description=Forgejo Web Socket
|
|
PartOf=forgejo.service
|
|
|
|
[Socket]
|
|
Service=forgejo.service
|
|
ListenStream=<some_port>
|
|
NoDelay=true
|
|
|
|
[Install]
|
|
WantedBy=sockets.target
|
|
{% endif %}
|
|
|
|
|
|
[Service]
|
|
# Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that
|
|
{% if forgejo_limitnofile is defined %}
|
|
LimitNOFILE={{ forgejo_limitnofile }}
|
|
{% else %}
|
|
# LimitNOFILE=524288:524288
|
|
{% endif %}
|
|
RestartSec=2s
|
|
Type=simple
|
|
User={{ forgejo_user }}
|
|
Group={{ forgejo_group }}
|
|
WorkingDirectory={{ forgejo_lib_dir }}
|
|
# If using Unix socket: tells systemd to create the /run/forgejo folder, which will contain the forgejo.sock file
|
|
# (manually creating /run/forgejo doesn't work, because it would not persist across reboots)
|
|
{% if forgejo_websocket is defined %}
|
|
RuntimeDirectory=forgejo
|
|
{% else %}
|
|
#RuntimeDirectory=forgejo
|
|
{% endif %}
|
|
ExecStart={{ forgejo_bindir }}/forgejo web -c {{ forgejo_confdir }}
|
|
Restart=always
|
|
RestartSec=3
|
|
Environment=USER={{ forgejo_user }} HOME=/home/{{ forgejo_user }} FORGEJO_WORK_DIR={{ forgejo_lib_dir }} FORGEJO_CUSTOM={{ forgejo_theme_dir }}
|
|
# If you install Git to directory prefix other than default PATH (which happens
|
|
# for example if you install other versions of Git side-to-side with
|
|
# distribution version), uncomment below line and add that prefix to PATH
|
|
# Don't forget to place git-lfs binary on the PATH below if you want to enable
|
|
# Git LFS support
|
|
{% if forgejo_custom_path is defined %}
|
|
Environment=PATH={{ forgejo_custom_path }}:/bin:/sbin:/usr/bin:/usr/sbin
|
|
{% else %}
|
|
#Environment=PATH=/path/to/git/bin:/bin:/sbin:/usr/bin:/usr/sbin
|
|
{% endif %}
|
|
# If you want to bind Forgejo to a port below 1024, uncomment
|
|
# the two values below, or use socket activation to pass Forgejo its ports as above
|
|
###
|
|
{% if forgejo_cap_net_bind_service is defined %}
|
|
CapabilityBoundingSet={{ forgejo_cap_net_bind_service }}
|
|
AmbientCapabilities={{ forgejo_cap_net_bind_service }}
|
|
{% else %}
|
|
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
|
#AmbientCapabilities=CAP_NET_BIND_SERVICE
|
|
{% endif %}
|
|
###
|
|
# In some cases, when using CapabilityBoundingSet and AmbientCapabilities option, you may want to
|
|
# set the following value to false to allow capabilities to be applied on Forgejo process. The following
|
|
# value if set to true sandboxes Forgejo service and prevent any processes from running with privileges
|
|
# in the host user namespace.
|
|
###
|
|
{% if forgejo_privateusers is defined %}
|
|
PrivateUsers={{ forgejo_privateusers }}
|
|
{% else %}
|
|
#PrivateUsers=false
|
|
{% endif %}
|
|
###
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|