feat(servers): reset 7days map and add auto backups
All checks were successful
Discord / discord commits (push) Successful in 38s

This commit is contained in:
matt1432 2024-07-13 22:12:35 -04:00
parent 031a36acdd
commit d13e984368
2 changed files with 34 additions and 22 deletions

View file

@ -2,33 +2,37 @@
gamePath = "/var/lib/steam-servers/7-days-to-die"; gamePath = "/var/lib/steam-servers/7-days-to-die";
relativeConfig = "serverconfig-7days.xml"; relativeConfig = "serverconfig-7days.xml";
in { in {
systemd.extraConfig = "DefaultLimitNOFILE=10240"; services.borgbackup.configs."seven-days" = {
paths = ["/var/lib/steam-servers/7-days-to-die"];
startAt = "02/3:00";
};
# TODO: make backups systemd = {
extraConfig = "DefaultLimitNOFILE=10240";
# https://github.com/Krutonium/NewNix/blob/455aafc4caf553248ca228f844f021cecf494dc2/services/sevendaystodie.nix#L6 services."7-days-to-die" = {
systemd.services."7-days-to-die" = { wantedBy = ["multi-user.target"];
wantedBy = ["multi-user.target"]; serviceConfig.User = "matt";
serviceConfig.User = "matt";
path = with pkgs; [ path = with pkgs; [
steam-run steam-run
steamcmd steamcmd
]; ];
script = '' script = ''
# Make sure gamePath exists and cd to it # Make sure gamePath exists and cd to it
mkdir -p ${gamePath} mkdir -p ${gamePath}
cd ${gamePath} cd ${gamePath}
# Install / Update server # Install / Update server
steamcmd +force_install_dir ${gamePath} \ steamcmd +force_install_dir ${gamePath} \
+login anonymous +app_update 294420 \ +login anonymous +app_update 294420 \
-beta latest_experimental \ -beta latest_experimental \
+quit +quit
# Launch server # Launch server
steam-run ./startserver.sh -configfile=${relativeConfig} steam-run ./startserver.sh -configfile=${relativeConfig}
''; '';
};
}; };
} }

View file

@ -9,12 +9,20 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPijoxuSwH9IrS4poewzHHwe64UoX4QY7Qix5VhEdqKR root@servivi" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPijoxuSwH9IrS4poewzHHwe64UoX4QY7Qix5VhEdqKR root@servivi"
]; ];
} }
{ {
name = "mc"; name = "mc";
authorizedKeys = [ authorizedKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPijoxuSwH9IrS4poewzHHwe64UoX4QY7Qix5VhEdqKR root@servivi" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPijoxuSwH9IrS4poewzHHwe64UoX4QY7Qix5VhEdqKR root@servivi"
]; ];
} }
{
name = "seven-days";
authorizedKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPijoxuSwH9IrS4poewzHHwe64UoX4QY7Qix5VhEdqKR root@servivi"
];
}
]; ];
}; };
} }