samjeston / openhub Public
46 lines· 1.5 KB
Raw
1# systemd unit for openhub, installed by packaging/linux/install.sh
2# (scripts/deploy-server.sh runs it for you). Serves the web interface on
3# loopback for a TLS-terminating proxy or tunnel on the same machine, and SSH
4# on every interface. Set OPENHUB_* variables (at least OPENHUB_PUBLIC_URL) in
5# /etc/default/openhub, then restart the service.
6[Unit]
7Description=Openhub git server
8After=network-online.target
9Wants=network-online.target
10# Keep retrying forever, e.g. while a disk is still mounting after a power cut.
11StartLimitIntervalSec=0
12
13[Service]
14User=openhub
15Group=openhub
16Environment=OPENHUB_DATA_DIR=/var/lib/openhub
17Environment=OPENHUB_HTTP_ADDR=127.0.0.1:3000
18Environment=OPENHUB_SSH_ADDR=0.0.0.0:2222
19# Make git fsync objects and refs, so a power cut just after a push can't leave
20# a ref pointing at an object that never reached the disk.
21Environment=GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.fsync GIT_CONFIG_VALUE_0=committed
22# The journal doesn't render colour codes.
23Environment=NO_COLOR=1
24EnvironmentFile=-/etc/default/openhub
25ExecStart=/usr/local/bin/openhub
26Restart=always
27RestartSec=2
28StateDirectory=openhub
29StateDirectoryMode=0750
30
31NoNewPrivileges=yes
32ProtectSystem=strict
33ProtectHome=yes
34PrivateTmp=yes
35PrivateDevices=yes
36ProtectKernelTunables=yes
37ProtectKernelModules=yes
38ProtectControlGroups=yes
39RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
40RestrictNamespaces=yes
41LockPersonality=yes
42MemoryDenyWriteExecute=yes
43SystemCallArchitectures=native
44
45[Install]
46WantedBy=multi-user.target