Automatically spawn and destroy a tf2 server on a schedule
  • Rust 86.7%
  • Nix 13.3%
Find a file
2024-06-14 20:56:42 +02:00
.github/workflows updates 2024-06-13 22:35:54 +02:00
src add maximum time after schedule to shut down regardless of player count 2024-06-13 23:00:05 +02:00
.dockerignore dockerfile 2021-03-28 20:36:32 +02:00
.envrc add flake 2022-07-04 00:03:03 +02:00
.gitattributes add flake 2022-07-04 00:03:03 +02:00
.gitignore add flake 2022-07-04 00:03:03 +02:00
Cargo.lock older trussh 2024-06-14 20:56:42 +02:00
Cargo.toml older trussh 2024-06-14 20:56:42 +02:00
config.sample.toml fix do example config 2023-03-09 23:12:03 +01:00
Dockerfile no longer depends on openssl 2021-07-31 17:00:46 +02:00
flake.lock updates 2024-06-13 22:35:54 +02:00
flake.nix updates 2024-06-13 22:35:54 +02:00
LICENSE Create LICENSE 2021-03-28 18:06:34 +00:00
module.nix allow setting extra_cfg 2024-03-02 15:17:20 +01:00
overlay.nix flake reorg 2024-01-12 23:30:09 +01:00
package.nix use newer rust for nix package 2024-03-02 15:34:10 +01:00
README.md allow loading secrets from files 2022-07-03 23:09:26 +02:00

Dispenser

Automatically spawn and destroy a tf2 server on a schedule

Usage

  • Copy config.sample.toml to config.toml and edit accordingly
  • Start dispenser config.toml as a system service

When the configured start schedule is reached it will create a new cloud server, update the dyndns (optional) and install a tf2 server. This server is then destroyed when the stop schedule is reached.

As a failsafe against unexpected costs or destroying the wrong server, this program will not spawn any server if it already detects a running one, and it will only destroy a server that was created by the program.

This does mean that if the program is (re-)started while a server is already active, the program will not start and destroy any server because it can't be sure it should control the running server. You'll need to manually destroy the existing server in that case.

You can overwrite this behavior by setting manage_existing = true in your config.toml,

Manual usage

Instead of managing the servers on a schedule with a background server you can also manually manage the server.

List running servers

dispenser config.toml list

Start a new server

dispenser config.toml start

Note that this will not start an additional server is a server is already running

Stop a running server

dispenser config.toml stop

Dealing with secrets

If you want to store your config file in version control but don't want to store your secrets there, you can choose to load the secrets from other files by specifying the secret as an absolute path.

This can be done for the following config options: server.demostf_key, server.logstf_key, vultr.api_key, digitalocean.api_key and dyndns.password.

TODO

  • don't blindly kill server if there are players connected
  • kill the server earlier if everyone disconnected
  • digital ocean backend
  • more backends?