From 71d1f73029ec7440dd631e2f865afe3a7a78fbd8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= <felix@thegcat.net>
Date: Sun, 16 Feb 2025 15:09:12 +0100
Subject: [PATCH] Remove borgbackup

---
 README.md                        | 21 ---------------------
 defaults/main.yml                |  1 -
 tasks/main.yml                   | 27 ---------------------------
 templates/gitlab_dump.service.j2 | 11 -----------
 4 files changed, 60 deletions(-)
 delete mode 100644 templates/gitlab_dump.service.j2

diff --git a/README.md b/README.md
index f2ef01d..ba36b9f 100644
--- a/README.md
+++ b/README.md
@@ -13,24 +13,3 @@ You can find all possible options at https://gitlab.com/gitlab-org/omnibus-gitla
 
 ## Setup hints
 - Disable normal sign-up/log-in
-
-## Restore
-- Restore borg backup
-```shell script
-# Stop web services
-> gitlab-ctl stop unicorn
-> gitlab-ctl stop puma
-> gitlab-ctl stop sidekiq
-# Drop database
-> gitlab-rake gitlab:db:drop_tables
-# Restore database
-> gitlab-rake gitlab:backup:db:restore
-# Restore repository contents
-> gitlab-rake gitlab:backup:repo:restore
-# Setup authorized_keys
-> gitlab-rake gitlab:shell:setup
-# Clear cache
-> gitlab-rake cache:clear
-# Start all services
-> gitlab-ctl start
-```
diff --git a/defaults/main.yml b/defaults/main.yml
index f9c75c9..1fb6c0d 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -7,7 +7,6 @@ gitlab_download_validate_certs: true
 gitlab_config_path_prefix: ""
 
 gitlab_external_postgres: false
-gitlab_use_borgbackup: false
 
 gitlab_enable_plantuml: false
 gitlab_enable_offline_registry_cleanup: true # needs to be disabled if using registry-metadata-database
diff --git a/tasks/main.yml b/tasks/main.yml
index 5cad6c1..3cd1843 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -90,33 +90,6 @@
     group: root
     mode: "0644"
 
-- name: Copy gitlab-dump service
-  ansible.builtin.template:
-    src: gitlab_dump.service.j2
-    dest: /etc/systemd/system/gitlab_dump.service
-    mode: '0644'
-  when: gitlab_use_borgbackup
-
-- name: Enable gitlab-dump service
-  ansible.builtin.systemd:
-    name: "gitlab_dump.service"
-    enabled: true
-    daemon_reload: true
-  when: gitlab_use_borgbackup
-
-- name: Configure backups
-  ansible.builtin.include_role:
-    name: borgbackup_client
-  vars:
-    borgbackup_source_dirs: # noqa var-naming[no-role-prefix]
-      - "/var/opt/gitlab/backups"
-      - "/var/opt/gitlab/gitlab-rails"
-      - "/var/opt/gitlab/gitlab-ci/builds"
-      - "/var/opt/gitlab/gitlab-pages"
-      - "/etc/gitlab"
-      - "/etc/ssh"
-  when: gitlab_use_borgbackup
-
 - name: Install postgres client binaries
   when: gitlab_external_postgres
   block:
diff --git a/templates/gitlab_dump.service.j2 b/templates/gitlab_dump.service.j2
deleted file mode 100644
index 3931118..0000000
--- a/templates/gitlab_dump.service.j2
+++ /dev/null
@@ -1,11 +0,0 @@
-[Unit]
-Description=Creates an GitLab Repository Backup
-Before=borgbackup.service
-
-[Service]
-Type=oneshot
-ExecStart=/usr/bin/gitlab-rake gitlab:backup:repo:create INCREMENTAL=true
-{% if not gitlab_external_postgres %}ExecStart=/usr/bin/gitlab-rake gitlab:backup:db:create{% endif %}
-
-[Install]
-RequiredBy=borgbackup.service
-- 
GitLab