If I make a GitLab backup using the gitlab:backup:create rake task just as someone is pushing to the repositories, will the backup process be affected?
Is it necessary to shutdown GitLab before doing the backup?
GitLab provides Rake tasks to assist you with common administration and operational processes. You can perform GitLab Rake tasks by using: gitlab-rake <raketask> for Omnibus GitLab installations. bundle exec rake <raketask> for source installations.
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.
GitLab's built-in back up utility exports data created by users on your GitLab instance. This includes everything in the GitLab database and your on-disk Git repositories. Restoring the backup will reinstate your projects, groups, users, issues, uploaded file attachments, and CI/CD job logs.
The task gitlab/backup.rake
itself doesn't look atomic.
It calls:
Rake::Task["gitlab:backup:db:create"].invoke
Rake::Task["gitlab:backup:repo:create"].invoke
That uses the gem activerecord
:
puts "Dumping database tables ... ".blue
ActiveRecord::Base.connection.tables.each do |tbl|
...
Like other operations with ActiveRecord (see this question), it doesn't seem to be a global atomic operation.
Hold on, a few hours ago, randx (Dmitriy Zaporozhets), main developer for GitLab, just refactored the dumping a database:
mysqldump
:system("mysqldump #{mysql_args} #{config['database']} > #{db_file_name}")
GRANT SELECT, LOCK TABLES, ...
So the part dumping the database is now more atomic ;)
But the backup itself, which involves other steps including backing up the bare repos, is not atomic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With