diff --git a/hosts/nixos/snowbelle/configuration.nix b/hosts/nixos/snowbelle/configuration.nix index b05841e..6623b4f 100644 --- a/hosts/nixos/snowbelle/configuration.nix +++ b/hosts/nixos/snowbelle/configuration.nix @@ -13,7 +13,7 @@ in ../../../modules/system ../../../modules/holocron ../../../modules/homelab - ../../../modules/homelab/minecraft_recpro + ../../../modules/gameservers/minecraft_recpro ]; system = { diff --git a/modules/homelab/minecraft_recpro/default.nix b/modules/gameservers/minecraft_recpro/default.nix similarity index 94% rename from modules/homelab/minecraft_recpro/default.nix rename to modules/gameservers/minecraft_recpro/default.nix index 4974df8..eed27e6 100644 --- a/modules/homelab/minecraft_recpro/default.nix +++ b/modules/gameservers/minecraft_recpro/default.nix @@ -3,15 +3,7 @@ config, lib, ... -}: -/* -to restore db make sure it exists with rebuild or command below -then use zstd command to decompress and restore in one go - -mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS minecraft_recpro_db;" -zstd -dc | mysql -u root -p minecraft_recpro_db -*/ -let +}: let service = "minecraft_recpro"; cfg = config.gameservers.${service}; sec = config.sops.secrets; diff --git a/modules/homelab/backups/default.nix b/modules/homelab/backups/default.nix index 2de2aae..62a5523 100644 --- a/modules/homelab/backups/default.nix +++ b/modules/homelab/backups/default.nix @@ -4,7 +4,17 @@ pkgs, ... }: -/**/ +/* +to restore mysql/marinadb database: +mysql -u root -p -e "DROP DATABASE IF EXISTS ;" # delete old db if still lingering +mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS ;" # create empty db w/ correct name +zstd -dc | mysql -u root -p + +to restore a postgres database: +sudo -u postgres psql -c "DROP DATABASE IF EXISTS ;" # delete old db if lingering (prolly wont work) +sudo -u postgres psql -c "CREATE DATABASE ;" # create empty db w/ correct name +zstd -dc | sudo -u postgres psql -d immich # restore from the dump +*/ let cfg = config.homelab.backups; sec = config.sops.secrets; @@ -30,7 +40,7 @@ in { repo = cfg.backup_repo; paths = lib.flatten (lib.attrsets.mapAttrsToList (_: arg: arg.paths) cfg.baks); compression = "auto,zstd"; - startAt = "daily"; + startAt = "03:30"; group = "archives"; encryption.mode = "repokey-blake2"; encryption.passCommand = "cat ${sec."borg_passwd".path}"; @@ -53,7 +63,7 @@ in { enable = true; location = "/var/backup/mysql"; user = "root"; - calendar = "*-*-* *:59:45"; # goes fast, included in back up with server dirs at **:00 + calendar = "daily"; # goes fast, included in back up with server dirs at **:00 compressionAlg = "zstd"; databases = config.services.mysql.ensureDatabases; # set to all databases defined in esure databases }; @@ -62,7 +72,7 @@ in { enable = true; location = "/var/backup/postgresql"; compression = "zstd"; # optional: "xz", "zstd", "none" - startAt = "03:59"; # the dump is included in a backup taken at 4:00 + startAt = "daily"; # the dump is included in a backup taken at 4:00 databases = config.services.postgresql.ensureDatabases; # set to all databases defined in esure databases }; diff --git a/modules/homelab/immich/default.nix b/modules/homelab/immich/default.nix index 182cc3a..396b262 100644 --- a/modules/homelab/immich/default.nix +++ b/modules/homelab/immich/default.nix @@ -5,14 +5,7 @@ inputs, unstable_pkgs, ... -}: -/* -to restore database ensure it exists - -sudo -u postgres psql -c "DROP DATABASE IF EXISTS immich; CREATE DATABASE immich;" -zstd -dc | sudo -u postgres psql -d immich -*/ -let +}: let service = "immich"; cfg = config.homelab.${service}; sec = config.sops.secrets;