M README.md => README.md +22 -0
@@ 58,3 58,25 @@ If something goes wrong, you can apply migrations manually by running
It's also a good idea to run `gobin` binary as a system service. Make
sure to provide all environment variables.
+
+## Using systemd
+```sh
+# Copy templates and static files
+sudo mkdir -p /usr/share/gobin
+cp -r templates static /usr/share/gobin
+
+# Add SystemD unit
+cp -r ./contrib/systemd/gobin.service ./contrib/systemd/gobin.service.d /etc/systemd/system
+
+# Edit /etc/systemd/system/gobin.service.d/environment.conf and set environment variables
+
+# Install gobin itself
+sudo install ./gobin /usr/local/bin
+
+# Reload units and start gobin
+sudo systemctl daemon-reload
+sudo systemctl start gobin
+```
+
+## Using OpenRC
+TODO: Write the service and this doc
A contrib/systemd/gobin.service => contrib/systemd/gobin.service +19 -0
@@ 0,0 1,19 @@
+# SPDX-License-Identifier: AGPL-3.0-or-later
+#
+# This unit runs gobin as a system service. It requires gobin to be
+# available in your PATH (/usr/bin, /usr/local/bin, etc). To place it
+# there use:
+# sudo install ./gobin /usr/local/bin
+
+[Unit]
+Description=Simple self-hosted service for sharing text snippets
+Requires=network.target
+
+[Service]
+Type=simple
+ExecStart=gobin
+Environment="TEMPLATE_ROOT=/usr/share/gobin/templates"
+Environment="STATIC_ROOT=/usr/share/gobin/static"
+
+[Install]
+WantedBy=multi-user.target
A contrib/systemd/gobin.service.d/environment.conf => contrib/systemd/gobin.service.d/environment.conf +6 -0
@@ 0,0 1,6 @@
+# This file is a template, edit to your own liking
+
+[Service]
+Environment="DATABASE_URI=posgtresql://andrew:super_secret_haha@localhost/pastebin"
+Environment="BASE_URL=https://mywebsite.com"
+Environment="PORT=80"