From e5c9c163238a3a8e4fa2da855c492e4d310bb29b Mon Sep 17 00:00:00 2001 From: daragh Date: Mon, 25 Mar 2024 11:58:15 +0000 Subject: [PATCH 1/6] gitlab backup options --- applications/gitlab.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/applications/gitlab.nix b/applications/gitlab.nix index 36b2aae..e0fe3e0 100644 --- a/applications/gitlab.nix +++ b/applications/gitlab.nix @@ -178,6 +178,10 @@ in { domain = lib.mkForce domain_base; }; + services.skynet_backup.normal.backups = [ + "/etc/skynet/backups/gitlab" + ]; + services.gitlab = { enable = true; @@ -213,6 +217,14 @@ in { }; }; + # see https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/gitlab.nix#L295 + backup = { + startAt = "Sat *-*-* 04:00:00"; # Sat 4am weekly + path = "/etc/skynet/backups/gitlab"; # Has to be same as line 182 + keepTime = 2190; # 3 months(hours) - 12 backups untill the first one gets deleted + skip = ["builds" "artifacts" "registry" "packages" "terraform_state"]; # see https://docs.gitlab.com/ee/administration/backup_restore/backup_gitlab.html#excluding-specific-data-from-the-backup + }; + # use the local email client smtp.enable = true; -- 2.46.1 From fb4685797bd43109a8b62fc42555a6276591a644 Mon Sep 17 00:00:00 2001 From: daragh Date: Mon, 25 Mar 2024 12:03:51 +0000 Subject: [PATCH 2/6] fix: dont need to keep backups for long since they are moved to a diff server --- applications/gitlab.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/gitlab.nix b/applications/gitlab.nix index e0fe3e0..5d05f09 100644 --- a/applications/gitlab.nix +++ b/applications/gitlab.nix @@ -221,7 +221,7 @@ in { backup = { startAt = "Sat *-*-* 04:00:00"; # Sat 4am weekly path = "/etc/skynet/backups/gitlab"; # Has to be same as line 182 - keepTime = 2190; # 3 months(hours) - 12 backups untill the first one gets deleted + keepTime = 24; # (Hours) Backups are uploaded to seperate server skip = ["builds" "artifacts" "registry" "packages" "terraform_state"]; # see https://docs.gitlab.com/ee/administration/backup_restore/backup_gitlab.html#excluding-specific-data-from-the-backup }; -- 2.46.1 From 292c977ec150f23621a5fb067727c6a237ea3b7d Mon Sep 17 00:00:00 2001 From: daragh Date: Mon, 25 Mar 2024 12:13:09 +0000 Subject: [PATCH 3/6] fix: variables are cool --- applications/gitlab.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/applications/gitlab.nix b/applications/gitlab.nix index 5d05f09..5275f64 100644 --- a/applications/gitlab.nix +++ b/applications/gitlab.nix @@ -6,6 +6,7 @@ }: with lib; let cfg = config.services.skynet_gitlab; + backup_path = "/etc/skynet/backups/gitlab"; domain_base = "${cfg.domain.base}.${cfg.domain.tld}"; domain_full = "${cfg.domain.sub}.${domain_base}"; @@ -179,7 +180,7 @@ in { }; services.skynet_backup.normal.backups = [ - "/etc/skynet/backups/gitlab" + backup_path ]; services.gitlab = { @@ -220,7 +221,7 @@ in { # see https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/gitlab.nix#L295 backup = { startAt = "Sat *-*-* 04:00:00"; # Sat 4am weekly - path = "/etc/skynet/backups/gitlab"; # Has to be same as line 182 + path = backup_path; # Has to be same as line 182 keepTime = 24; # (Hours) Backups are uploaded to seperate server skip = ["builds" "artifacts" "registry" "packages" "terraform_state"]; # see https://docs.gitlab.com/ee/administration/backup_restore/backup_gitlab.html#excluding-specific-data-from-the-backup }; -- 2.46.1 From 4312f438eea80182990cf80cbc4d85022d5f0edb Mon Sep 17 00:00:00 2001 From: daragh Date: Mon, 25 Mar 2024 12:54:14 +0000 Subject: [PATCH 4/6] fix: can't use packages, redundant comment removed --- applications/gitlab.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/gitlab.nix b/applications/gitlab.nix index 5275f64..fe99bf4 100644 --- a/applications/gitlab.nix +++ b/applications/gitlab.nix @@ -221,9 +221,9 @@ in { # see https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/gitlab.nix#L295 backup = { startAt = "Sat *-*-* 04:00:00"; # Sat 4am weekly - path = backup_path; # Has to be same as line 182 + path = backup_path; keepTime = 24; # (Hours) Backups are uploaded to seperate server - skip = ["builds" "artifacts" "registry" "packages" "terraform_state"]; # see https://docs.gitlab.com/ee/administration/backup_restore/backup_gitlab.html#excluding-specific-data-from-the-backup + skip = ["builds" "artifacts" "registry" "terraform_state"]; # see https://docs.gitlab.com/ee/administration/backup_restore/backup_gitlab.html#excluding-specific-data-from-the-backup }; # use the local email client -- 2.46.1 From 51607a22ca27906b691262691e4c3ca5b53e74d7 Mon Sep 17 00:00:00 2001 From: daragh Date: Mon, 25 Mar 2024 13:22:57 +0000 Subject: [PATCH 5/6] fix: removed missing option --- applications/gitlab.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/gitlab.nix b/applications/gitlab.nix index fe99bf4..a5a77e1 100644 --- a/applications/gitlab.nix +++ b/applications/gitlab.nix @@ -223,7 +223,7 @@ in { startAt = "Sat *-*-* 04:00:00"; # Sat 4am weekly path = backup_path; keepTime = 24; # (Hours) Backups are uploaded to seperate server - skip = ["builds" "artifacts" "registry" "terraform_state"]; # see https://docs.gitlab.com/ee/administration/backup_restore/backup_gitlab.html#excluding-specific-data-from-the-backup + skip = ["builds" "artifacts" "registry"]; # see https://docs.gitlab.com/ee/administration/backup_restore/backup_gitlab.html#excluding-specific-data-from-the-backup }; # use the local email client -- 2.46.1 From 036dd607511eadfd330eafd3df970ac31bf3e8eb Mon Sep 17 00:00:00 2001 From: daragh Date: Mon, 25 Mar 2024 15:58:12 +0000 Subject: [PATCH 6/6] added tar option for restic --- applications/gitlab.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/gitlab.nix b/applications/gitlab.nix index a5a77e1..6aa4de6 100644 --- a/applications/gitlab.nix +++ b/applications/gitlab.nix @@ -223,7 +223,7 @@ in { startAt = "Sat *-*-* 04:00:00"; # Sat 4am weekly path = backup_path; keepTime = 24; # (Hours) Backups are uploaded to seperate server - skip = ["builds" "artifacts" "registry"]; # see https://docs.gitlab.com/ee/administration/backup_restore/backup_gitlab.html#excluding-specific-data-from-the-backup + skip = ["builds" "artifacts" "registry" "tar"]; # see https://docs.gitlab.com/ee/administration/backup_restore/backup_gitlab.html#excluding-specific-data-from-the-backup }; # use the local email client -- 2.46.1