diff options
-rw-r--r-- | Dockerfile | 31 | ||||
-rw-r--r-- | Makefile | 110 | ||||
-rw-r--r-- | server_config.toml | 102 | ||||
-rwxr-xr-x | update_and_start.sh | 27 |
4 files changed, 270 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eb52850 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM docker.io/debian:bookworm + +MAINTAINER Hende, Botond <nettingman@gmail.com> +LABEL Description="Space Station 14 server" + +RUN apt-get update && apt-get install -y \ + wget \ + curl \ + unzip + +RUN wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ + && dpkg -i packages-microsoft-prod.deb \ + && rm packages-microsoft-prod.deb + +RUN apt-get update && apt-get install -y \ + dotnet-runtime-8.0 \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /opt/ss14/server + +COPY server_config.toml /opt/ss14/server_config.toml +COPY update_and_start.sh /opt/ss14/update_and_start.sh + +RUN useradd -M spessman && chown -R spessman:spessman /opt/ss14 + +WORKDIR /opt/ss14 +USER spessman +EXPOSE 1212/tcp +EXPOSE 1212/udp + +CMD ["/opt/ss14/update_and_start.sh"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..47c116a --- /dev/null +++ b/Makefile @@ -0,0 +1,110 @@ +name = $(notdir $(realpath .)) +host = $(name) +pwd = $(realpath .) +run-args = -itd --name $(host) +run-cmd = + + +default: build + + +build: build-buildah + +build-docker: + docker build --squash -t $(name) $(pwd) + +build-buildah: + buildah bud --squash --layers -t $(name) $(pwd) + + +run: run-podman + +run-docker: stop-docker build-docker wait start-docker + +run-podman: stop-podman build-buildah wait start-podman + + +start: start-podman + +start-docker: + docker run --rm --cpus 1 $(run-args) $(name) $(run-cmd) + +start-podman: + podman run --rm $(run-args) $(name) $(run-cmd) + + +stop: stop-podman + +stop-docker: + -docker stop $(name) + +stop-podman: + -podman stop $(name) + + +kill: kill-podman + +kill-docker: + -docker kill $(name) + +kill-podman: + -podman kill $(name) + + +restart: restart-podman + +restart-docker: + -docker restart $(name) + +restart-podman: + -podman restart $(name) + + +wait: + sleep 1 + + +log: log-podman + +log-docker: + docker logs $(name) + +log-podman: + podman logs $(name) + + +clean: clean-podman + +clean-docker: kill-docker wait + -docker image prune --force + -docker container prune --force + +clean-podman: kill-podman wait + -buildah rm -a + -podman image prune + -podman container prune --force + + +shell: shell-podman + +shell-docker: console-docker + +shell-podman: console-podman + + +console: console-podman + +console-docker: + docker exec -it $(name) /bin/bash + +console-podman: + podman exec -it $(name) /bin/bash + + +status: status-podman + +status-docker: + docker exec -it $(name) /usr/bin/supervisorctl status + +status-podman: + podman exec -it $(name) /usr/bin/supervisorctl status diff --git a/server_config.toml b/server_config.toml new file mode 100644 index 0000000..44a50e5 --- /dev/null +++ b/server_config.toml @@ -0,0 +1,102 @@ +# Welcome to the example configuration file! +# Remember that if this is in bin/Content.Server or such, it may be overwritten on build. +# Consider copying it and using the --config-file and --data-dir options. + +[log] +path = "logs" +format = "log_%(date)s-%(time)s.txt" +level = 1 +enabled = false + +[net] +tickrate = 30 +port = 1212 +bindto = "::,0.0.0.0" +max_connections = 256 +# Automatic port forwarding! +# Disabled by default because you may not want to do this. +# upnp = true + +[status] +# The status server is the TCP side, used by the launcher to determine engine version, etc. +# To be clear: Disabling it makes the launcher unable to connect! +enabled = true + +# This is the address and port the status server binds to. +# The port is by default set based on net.port so it will follow what you set there. +# bind = "*:1212" + +# This is the address of the SS14 server as the launcher uses it. +# This is only needed if you're proxying the status HTTP server - +# by default the launcher will assume the address and port match that of the status server. +# connectaddress = "udp://localhost:1212" + +[game] +hostname = "MyServer" + +[console] +# If this is true, people connecting from this machine (loopback) +# will automatically be elevated to full admin privileges. +# This literally works by checking if address == 127.0.0.1 || address == ::1 +loginlocal = true + +[hub] +# Set to true to show this server on the public server list +# Before enabling this, read: https://docs.spacestation14.io/hosts/hub-rules +advertise = false +# Comma-separated list of tags, useful for categorizing your server. +# See https://docs.spacestation14.io/hosts/hub-rules for more details on this when it becomes relevant. +tags = "" +# URL of your server. Fill this in if you have a domain name, +# want to use HTTPS (with a reverse proxy), or other advanced scenarios. +# Must be in the form of an ss14:// or ss14s:// URI pointing to the status API. +server_url = "" +# Comma-separated list of URLs of hub servers to advertise to. +hub_urls = "https://hub.spacestation14.com/" + +[build] +# *Absolutely all of these can be supplied using a "build.json" file* +# For further information, see https://github.com/space-wizards/space-station-14/blob/master/Tools/gen_build_info.py +# The main reason you'd want to supply any of these manually is for a custom fork and if you have no tools. + +# Useful to override if the existing version is bad. +# See https://github.com/space-wizards/RobustToolbox/tags for version values, remove the 'v'. +# The value listed here is almost certainly wrong - it is ONLY a demonstration of format. +# engine_version = "0.7.6" + +# This one is optional, the launcher will delete other ZIPs of the same fork to save space. +# fork_id = "abacusstation" + +# Automatically set if self-hosting client zip, but otherwise use this when updating client build. +# There is no required format, any change counts as a new version. +# version = "Example1" + +# This is where the launcher will download the client ZIP from. +# If this isn't supplied, the server will check for a file called "Content.Client.zip", +# and will host it on the status server. +# If that isn't available, the server will attempt to find and use "../../Resources" and +# "../../bin/Content.Client" to automatically construct a client zip. +# It will then host this on the status server. +# Note that these paths do not work on "FULL_RELEASE" servers. +# FULL_RELEASE servers expect to be used with a specific "packaged" layout. +# As such, whatever script you're using to package them is expected to create the ZIP. +# download_url = "http://example.com/compass.zip" + +# Build hash - this is a *capitalized* SHA256 hash of the client ZIP. +# Optional in any case and automatically set if hosting a client ZIP. +# This hash is an example only. +# build = "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855" + +[auth] +# Authentication (accounts): +# 0 = Optional, 1 = Required, 2 = Disabled +# Presumably do require authentication on any public server. +# mode = 0 + +# If true, even if authentication is required, localhost is still allowed to login directly regardless. +# allowlocal = true + +# You should probably never EVER need to touch this, but if you need a custom auth server, +# (the auth server being the one which manages Space Station 14 accounts), you change it here. +# server = https://auth.spacestation14.com/ + diff --git a/update_and_start.sh b/update_and_start.sh new file mode 100755 index 0000000..93ff5c3 --- /dev/null +++ b/update_and_start.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +SERVER_PATH=/opt/ss14/server +BUILD_JSON_PATH="$SERVER_PATH"/build.json +SERVER="$SERVER_PATH"/Robust.Server + +TEMP_ZIP_PATH=/tmp/ss14-temp.zip + +LATEST_VER=$(curl https://wizards.cdn.spacestation14.com/fork/wizards | sed -nE 's/(\s*)<dd><span class="versionNumber">(.*)<\/span><\/dd>/\2/p' | head -1) + +if [ \! -f "$BUILD_JSON_PATH" ] || ! grep -q "$LATEST_VER" "$BUILD_JSON_PATH"; then + rm -r "$SERVER_PATH"/* + + # ARM64 version + wget "https://wizards.cdn.spacestation14.com/fork/wizards/version/$LATEST_VER/file/SS14.Server_linux-arm64.zip" -O "$TEMP_ZIP_PATH" + + # x64 version + #wget "https://wizards.cdn.spacestation14.com/fork/wizards/version/$LATEST_VER/file/SS14.Server_linux-x64.zip" -O "$TEMP_ZIP_PATH" + + unzip "$TEMP_ZIP_PATH" -d "$SERVER_PATH" + rm "$TEMP_ZIP_PATH" + + chmod +x "$SERVER" + cp server_config.toml "$SERVER_PATH" +fi + +"$SERVER" |