From 1af149f81ce42b7064152f39e9996cbcda9e1ccd Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 19 Jun 2023 01:12:43 -0400 Subject: [PATCH] Add Systemd unit Closes #1420 --- README.md | 11 ++++++----- build/tgstation-server.service | 14 ++++++++++++++ tgstation-server.sln | 1 + 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 build/tgstation-server.service diff --git a/README.md b/README.md index 6d0687038e..5199335b05 100644 --- a/README.md +++ b/README.md @@ -37,22 +37,23 @@ If using the console version, run ./tgs.bat in the root of the installation dire #### Linux (Native) -We recommend using Docker for Linux installations, see below. The content of this parent section may be skipped if you choose to do so. +Installing natively is the recommended way to run tgstation-server on Linux. -The following dependencies are required to run tgstation-server on Linux alongside the .NET Core runtime +The following dependencies are required. +- aspnetcore-runtime-6.0 (Note, not all supported distros have this package, see the links above for official Microsoft installation instructions) - libc6-i386 - libstdc++6:i386 - gdb (for using gcore to create core dumps) - gcc-multilib (Only on 64-bit systems) -To launch the server, run ./tgs.sh in the root of the installation directory. The process will run in a blocking fashion. SIGQUIT will close the server, terminating all live game instances. +If you have SystemD, we recommend installing the service unit [here](./build/tgstation-server.service). It assumes TGS is installed into `/opt/tgstation-server` but feel free to adjust it to your needs. Note that the server will need to have it's configuration file setup before running with SystemD. -Note that tgstation-server has only ever been tested on Linux via it's [docker environment](build/Dockerfile#L22). If you are having trouble with something in a native installation, or figure out a required workaround, please contact project maintainers so this documentation may be better updated. +Alternatively, to launch the server in the current shell, run `./tgs.sh` in the root of the installation directory. The process will run in a blocking fashion. SIGQUIT will close the server, terminating all live game instances. #### Docker (Linux) -tgstation-server supports running in a docker container and is the recommended deployment method for Linux systems. The official image repository is located at https://hub.docker.com/r/tgstation/server. It can also be built locally by running `docker build . -f build/Dockerfile -t ` in the repository root. +tgstation-server supports running in a docker container. The official image repository is located at https://hub.docker.com/r/tgstation/server. It can also be built locally by running `docker build . -f build/Dockerfile -t ` in the repository root. To create a container run ```sh diff --git a/build/tgstation-server.service b/build/tgstation-server.service new file mode 100644 index 0000000000..e9dcd56961 --- /dev/null +++ b/build/tgstation-server.service @@ -0,0 +1,14 @@ +[Unit] +Description=tgstation-server +After=network.target + +[Service] +ExecStart=/bin/bash /opt/tgstation-server/tgs.sh General:SetupWizardMode=Never +Restart=Always +RestartKillSignal=SIGUSR1 +AmbientCapabilities=CAP_SYS_NICE +StandardOutput=null +StandardError=null + +[Install] +WantedBy=multi-user.target diff --git a/tgstation-server.sln b/tgstation-server.sln index 2b9ab94ed2..2690aacfcd 100644 --- a/tgstation-server.sln +++ b/tgstation-server.sln @@ -36,6 +36,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{6FF654E6 build\tgs.docker.sh = build\tgs.docker.sh build\tgs.ico = build\tgs.ico build\tgs.png = build\tgs.png + build\tgstation-server.service = build\tgstation-server.service build\Version.props = build\Version.props EndProjectSection EndProject