summaryrefslogtreecommitdiff
path: root/gitlab-server/usr
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab-server/usr')
-rw-r--r--gitlab-server/usr/share/gitlab-install/backup-gitlab22
-rw-r--r--gitlab-server/usr/share/gitlab-install/systemd-units/gitlab-backup.service11
-rw-r--r--gitlab-server/usr/share/gitlab-install/systemd-units/gitlab-backup.timer8
-rwxr-xr-xgitlab-server/usr/share/gitlab-setup2
4 files changed, 42 insertions, 1 deletions
diff --git a/gitlab-server/usr/share/gitlab-install/backup-gitlab b/gitlab-server/usr/share/gitlab-install/backup-gitlab
new file mode 100644
index 00000000..a6c3e3f5
--- /dev/null
+++ b/gitlab-server/usr/share/gitlab-install/backup-gitlab
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Run the gitlab backup script. The backup will be stored as
+# /home/git/gitlab-backup.tar . A separate backup host will need to
+# back that up.
+#
+# This script be run as the git user on a GitLab host.
+
+set -e
+
+export PATH=/usr/local/bin:/usr/bin:/bin
+
+cd /home/git/gitlab
+mkdir -p /home/git/gitlab/tmp/backups
+bundle exec rake gitlab:backup:create RAILS_ENV=production
+
+ls /home/git/gitlab/tmp/backups/[0-9]*.tar |
+tail -n1 |
+while read filename
+do
+ mv "$filename" /home/git/gitlab-backup.tar
+done
diff --git a/gitlab-server/usr/share/gitlab-install/systemd-units/gitlab-backup.service b/gitlab-server/usr/share/gitlab-install/systemd-units/gitlab-backup.service
new file mode 100644
index 00000000..967a65e3
--- /dev/null
+++ b/gitlab-server/usr/share/gitlab-install/systemd-units/gitlab-backup.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=GitLab Backup Run
+After=postgres.service
+
+[Install]
+WantedBy=gitlab.target
+
+[Service]
+ExecStart=/usr/share/gitlab-install/backup-gitlab
+User=git
+Group=git
diff --git a/gitlab-server/usr/share/gitlab-install/systemd-units/gitlab-backup.timer b/gitlab-server/usr/share/gitlab-install/systemd-units/gitlab-backup.timer
new file mode 100644
index 00000000..1c2f57ba
--- /dev/null
+++ b/gitlab-server/usr/share/gitlab-install/systemd-units/gitlab-backup.timer
@@ -0,0 +1,8 @@
+[Unit]
+Description=GitLab Backup Timer
+
+[Install]
+WantedBy=gitlab.target
+
+[Timer]
+OnCalendar=*-*-* 00/4:00:00
diff --git a/gitlab-server/usr/share/gitlab-setup b/gitlab-server/usr/share/gitlab-setup
index 5c53c859..e1084a1b 100755
--- a/gitlab-server/usr/share/gitlab-setup
+++ b/gitlab-server/usr/share/gitlab-setup
@@ -100,5 +100,5 @@ cp /usr/share/gitlab-install/nginx.conf /etc/nginx/nginx.conf
# make systemd units to start gitlab and required stuff on boot
cd /etc/systemd/system
cp /usr/share/gitlab-install/systemd-units/* .
-systemctl enable redis.service nginx.service postgres.service gitlab.target gitlab-unicorn.service gitlab-sidekiq.service gitlab-ci-sidekiq.service gitlab-ci-unicorn.service
+systemctl enable redis.service nginx.service postgres.service gitlab.target gitlab-unicorn.service gitlab-sidekiq.service gitlab-ci-sidekiq.service gitlab-ci-unicorn.service gitlab-backup.timer gitlab-backup.service
reboot