Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update run-with-systemd.md #254

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 45 additions & 0 deletions docs/administration/run-with-systemd.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

For non-Docker users, you could run Opengist as a systemd service.

## As root
On Unix distributions with systemd, place the Opengist binary like:

```shell
Expand Down Expand Up @@ -45,3 +46,47 @@ systemctl daemon-reload
systemctl enable --now opengist
systemctl status opengist
```

----

## As a normal user
**NOTE: This was tested on Ubuntu 20.04 and newer. For other distros, please check the respective documentation**

#### For the purpose of this documentation, we will assume that:
- You've followed the instructions on how to run opengist [from source](https://github.com/thomiceli/opengist?tab=readme-ov-file#from-source)
- Your shell user is named `pastebin`
- All commands are being executed as the `pastebin` user

_If none of the above is true, then adapt the commands and paths to fit your needs._

Enable lingering for the user:
```shell
loginctl enable-linger
```

Create the user systemd folder:
```
mkdir -p /home/pastebin/.config/systemd/user
```

Then create a service file at `/home/pastebin/.config/systemd/user/opengist.service`:
```ini
[Unit]
Description=opengist Server
After=network.target

[Service]
Type=simple
ExecStart=/home/pastebin/opengist/opengist --config /home/pastebin/opengist/config.yml
Restart=on-failure

[Install]
WantedBy=default.target
```

Finally, start the service:
```shell
systemctl --user daemon-reload
systemctl --user enable --now opengist
systemctl --user status opengist
```