Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab backup doesn't include wiki

We have GitLab CE 9.1.2 installed on our server where a backup is scheduled to run every 8:00 PM Mon-Fri. So far things are fine but yesterday we started using the Wiki. I double checked the backup file and somehow it had the exact same size as the backup the previous day (nothing was done in the system other than creating Wiki pages).

Because of that I suspected that the Wiki wasn't included in the backup process so I opened up a VM and tried to restore the backup file. After the successful operation I went over to the Wiki section of the project and it was empty.

I was reading some resources and they say the repo shouldn't be empty for the Wiki to be included but our repo is full of codes, commits, branches, issues, etc. I followed the backup instructions for the Omnibus installation because that's what we have.

0 20 * * 1-5 /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1

As you could see I didn't include any SKIP environment variable so it shouldn't skip anything. Am I missing something? I followed the instructions properly. I need a full backup of the system.

like image 273
Patrick Gregorio Avatar asked Jun 02 '17 17:06

Patrick Gregorio


People also ask

Where are GitLab wiki files stored?

Files added in GitLab 11.3 and later: Files are stored in the wiki's Git repository. Files added GitLab 11.2 and earlier: Files are stored in GitLab itself. To add the file to the wiki's Git repository, you must re-upload the file.

Does GitLab have a wiki?

GitLab is scalable and can be hosted on-premises or on cloud storage. It also includes a wiki, issue-tracking, IDE, and CI/CD pipeline features.

Where do GitLab backups go?

All configuration for Omnibus GitLab is stored in /etc/gitlab . To backup your configuration, just run sudo gitlab-ctl backup-etc (introduced in GitLab 12.3). It creates a tar archive in /etc/gitlab/config_backup/ . Directory and backup files will be readable only to root.


1 Answers

From the link @fedorqui provided it looks like this is an issue with the cache not being flushed out when you create a Wiki and so the backup process sees the Wiki as being empty therefore skipped.

To fix this it looks like we manually have to flush the cache ourselves.

sudo gitlab-rails console
p = Project.find_by_full_path 'namespace_path/project_path'
wiki = ProjectWiki.new p
wiki.repository.empty?
wiki.repository.expire_all_method_caches
wiki.repository.empty?

The first time you run wiki.repository.empty? it will return true which is why the backup process skips the Wiki. After running wiki.repository.expire_all_method_caches you should be good to go (I tried this and our Wiki is now being backed up). If you'd like to confirm that everything does look good, simply run the wiki.repository.empty? again and it should return false this time.

As of June 5, 2017 it seems like the bug hasn't been fixed yet.


Update (August 22, 2017)

GitLab CE 9.5.0 has been released (changelog) which has the fix for this issue. If you don't want to manually have to expire the cache I recommend that you upgrade your GitLab installation to at least v9.5.0 and you should be fine.

like image 83
Patrick Gregorio Avatar answered Sep 27 '22 21:09

Patrick Gregorio