]> git.deb.at Git - rhonda/impostor.git/commitdiff
systemd template and instructions (#508)
authorbkloosterboer <bryan@kevin.cat>
Sun, 22 Jan 2023 22:29:22 +0000 (16:29 -0600)
committerGitHub <noreply@github.com>
Sun, 22 Jan 2023 22:29:22 +0000 (23:29 +0100)
* systemd template and instructions

* clarify some intsructions, change a few systemd paramters

* change targets

docs/Running-the-server.md
docs/Server-configuration.md

index 4dc4a5ff2a869d716014b44f06e3c6619861318d..52e6f6635dcd6df2700400b051d803ff8c7ae17f 100644 (file)
@@ -12,6 +12,7 @@ There are currently two modes to run the Impostor server. The first way, Single
 4. Extract the zip.
 5. Modify `config.json` to your liking. Documentation can be found [here](Server-configuration.md) _(this step is mandatory if you want to expose this server to other devices)_
 6. Run `Impostor.Server` (Linux/macOS) or `Impostor.Server.exe` (Windows)
+7. (OPTIONAL - Linux) Configure a systemd definition file and enable the service to start on boot - [systemd configuration](Server-configuration.md#systemd)
 
 Depending on your host you may also need to port forward Impostor to the internet. By default Impostor uses port **22023** and the **UDP** protocol. As port forwarding changes per host or router configuration, port forwarding is not covered by this guide.
 
index 65b29922b12003a7e7a9cd155ba84b95e9605af5..642c0bc42220af6746ec1223b49ff3c91176e1d6 100644 (file)
@@ -93,3 +93,69 @@ IMPOSTOR_Server__ListenPort=22023
 IMPOSTOR_AntiCheat__Enabled=true
 IMPOSTOR_AntiCheat__BanIpFromGame=true
 ```
+
+# systemd
+
+Linux users will likely want to create a systemd service definition to manage running the Impostor application.  Benefits to using a systemd service include the following:
+
+- The server process can automatically restart if the process dies
+- Impostor can be set to start on boot (handy if you do system updates regularly)
+- You can use systemd targets to ensure the process doesn't start until the system dependencies are met
+
+Using your favorite text editor, create the following service file:
+
+```
+sudoedit /etc/systemd/system/impostor.service
+```
+
+Modify the following template to your needs and populate the service file.
+
+```
+[Unit]
+Description=Impostor private Among Us server - https://github.com/Impostor/Impostor
+
+[Service]
+# Directory where Impostor is installed
+WorkingDirectory=/opt/impostor
+# Path to Impostor binary
+ExecStart=/opt/impostor/Impostor.Server
+Restart=always
+# Restart service after 10 seconds if the dotnet service crashes
+RestartSec=10
+KillSignal=SIGTERM
+SyslogIdentifier=impostor
+
+# User and group that will run the Impostor server process -- ensure that user is allowed to execute the binary
+User=impostor
+Group=impostor
+TimeoutStopSec=10
+
+[Install]
+# Wait until most system services have started before starting Impostor
+After=multi-user.target
+WantedBy=multi-user.target
+```
+
+Reload all systemd unit files to source in the new file you've created.
+
+```
+sudo systemctl daemon-reload
+```
+
+Start the service. 
+
+```
+sudo systemctl start impostor.service
+```
+
+Check the log for the service and verify it has started correctly -- Hint: Use the Q key to quit out of journalctl.
+
+```
+sudo journalctl -u impostor.service
+```
+
+If everything has started correctly, ensure the service is set to start on boot.
+
+```
+sudo systemctl enable impostor.service
+```
\ No newline at end of file