diff --git a/README.md b/README.md index c473cf8..a3bcedd 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # valproxy -UDP proxy for Valheim dedicated server Systemd socket activation \ No newline at end of file +UDP proxy for Valheim dedicated server Systemd socket activation. diff --git a/systemd/valheim-proxy.service b/systemd/valheim-proxy.service new file mode 100644 index 0000000..37736af --- /dev/null +++ b/systemd/valheim-proxy.service @@ -0,0 +1,13 @@ +[Unit] +# BindsTo ensures that the Valheim server will start and be shut down along with the proxy. +BindsTo=valheim.service +After=valheim.service +Requires=valheim-proxy.socket +After=valheim-proxy.socket + +[Service] +Type=simple +WorkingDirectory=/home/valheim/valproxy + +# This is using asdf to manage the version of Node.js +ExecStart=/home/valheim/.asdf/shims/node index.js 127.0.0.1 2456 diff --git a/systemd/valheim-proxy.socket b/systemd/valheim-proxy.socket new file mode 100644 index 0000000..9f2dfa4 --- /dev/null +++ b/systemd/valheim-proxy.socket @@ -0,0 +1,5 @@ +[Socket] +ListenDatagram=41831 + +[Install] +WantedBy=sockets.target diff --git a/systemd/valheim.service b/systemd/valheim.service new file mode 100644 index 0000000..9fd0326 --- /dev/null +++ b/systemd/valheim.service @@ -0,0 +1,14 @@ +[Unit] +Description=Valheim server +StopWhenUnneeded=yes + +[Service] +Type=simple +WorkingDirectory=/home/valheim/valheim +Environment=LD_LIBRARY_PATH=./linux64 +Environment=SteamAppID=892970 +ExecStart=/home/valheim/valheim/valheim_server.x86_64 -name "server_name" -port 2456 -nographics -batchmode -world "world_name" -password "password" -public 0 + +# Important! Always kill with SIGINT so that the server has a chance to save the world. +KillSignal=SIGINT +WatchdogSignal=SIGINT