Gitlab backup does not start

I’m running Gitlab CE and I’ve configured my /etc/gitlab/gitlab.rb like this:

### Backup Settings
###! Docs: https://docs.gitlab.com/omnibus/settings/backups.html

# gitlab_rails['manage_backup_path'] = true
# gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"

###! Docs: https://docs.gitlab.com/ce/raketasks/backup_restore.html#backup-   archive-permissions
gitlab_rails['backup_archive_permissions'] = 0644

# gitlab_rails['backup_pg_schema'] = 'public'

###! The duration in seconds to keep backups before they are allowed to be deleted
gitlab_rails['backup_keep_time'] = 604800

And I setup a cron job to start a backup every 2AM(UTC+8), and to write the output to a log file:

0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create > /home/admin/gitlab_backup/backup.log 2>&1

I checked the /var/opt/gitlab/backups/ folder and I was expecting to see 3 days worth of backups (I setup the cron job to start last Friday night) but to my surprise, there was only one backup, which was a result of a manual backup I made 2 weeks ago. How do I debug this? Does gitlab store logs of backup tasks?

Nothing in that logfile?
What happens when you execute the same command as the same user which runs the cronjob?

Hi, I am running the cron job as the root user (sudo su - and then crontab -e), and yes, I can create gitlab backups as root. Anyway I changed the cron job to this, it seems the previous one is wrong:

0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create >> /tmp/gitlab_backup.log 2>&1

And just to be sure I set write permissions to the root group, for the /var/opt/gitlab/backups/ folder.

Just an update, it seems changing permissions and correcting the cron job did the trick.

1 Like