Skip to content

Instantly share code, notes, and snippets.

@imshvc
Created December 26, 2023 05:39
Show Gist options
  • Save imshvc/657ca72c22990d84cd89bd3ca650d71f to your computer and use it in GitHub Desktop.
Save imshvc/657ca72c22990d84cd89bd3ca650d71f to your computer and use it in GitHub Desktop.
Gitea Systemd Service Unit
[Unit]
Description=Gitea service bootstrap for /opt/gitea/gitea
[Service]
Type=simple
ExecStart=/opt/gitea/gitea web
ExecStop=/opt/gitea/gitea manager shutdown
Restart=on-failure
User=user
Group=1000
KillSignal=SIGINT
[Install]
WantedBy=multi-user.target

systemd service unit for gitea

Requirements

  1. Brain.
  2. Gitea installed at /opt/gitea, otherwise modify the gitea.service file contents before the next steps.
  3. Modify the User and Group inside gitea.service if necessary.

Installation

  1. Save gitea.service as /etc/systemd/system/gitea.service
  2. Run sudo systemctl enable gitea
  3. Run sudo systemctl start gitea

Conclusion

If you did everything right (download, configure, this and that) then the unit should be working fine. It will also automatically run whenever the system boots up, which means you don't have to deal with the headache of starting it up manually yourself.

In case the service is not running when you check via sudo systemctl status gitea then make sure your Gitea configuration hasn't been mangled by something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment