summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2015-09-22 13:35:46 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2015-09-22 13:35:46 +0000
commit63b36c926b8b38836f5b617ca197d9ada056b9e4 (patch)
tree1133e9ea1d8bc85d0dd450360b7efd07a1292fdb
parent6c73ce6880c81cb0173815f0090c2db2ba36c135 (diff)
parent8a342e69fa11293b028841d01ca3d89f60216d05 (diff)
downloadgitlab-ci-63b36c926b8b38836f5b617ca197d9ada056b9e4.tar.gz
Merge branch 'backup-directory-permissions' into 'master'
More export improvements See merge request !253
-rw-r--r--lib/backup/builds.rb2
-rw-r--r--lib/backup/manager.rb3
-rw-r--r--lib/tasks/backup.rake33
3 files changed, 34 insertions, 4 deletions
diff --git a/lib/backup/builds.rb b/lib/backup/builds.rb
index 9746d24..f2c1be8 100644
--- a/lib/backup/builds.rb
+++ b/lib/backup/builds.rb
@@ -30,7 +30,7 @@ module Backup
# default behavior of tar is to talk to a tape device instead of
# stdin/stdout.
system(
- *%W(tar -C #{app_builds_dir} -xzf - -- .),
+ *%W(tar -C #{app_builds_dir} -xzf -),
in: backup_builds_tarball
)
end
diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb
index 8ad3ea6..9a4ddab 100644
--- a/lib/backup/manager.rb
+++ b/lib/backup/manager.rb
@@ -19,17 +19,16 @@ module Backup
# create archive
$progress.print "Creating backup archive: #{tar_file} ... "
- orig_umask = File.umask(0077)
if Kernel.system('tar', '-cf', tar_file, *backup_contents)
$progress.puts "done".green
else
puts "creating archive #{tar_file} failed".red
abort 'Backup failed'
end
- File.umask(orig_umask)
upload(tar_file)
end
+ File.join(GitlabCi.config.backup.path, tar_file)
end
def upload(tar_file)
diff --git a/lib/tasks/backup.rake b/lib/tasks/backup.rake
index 67c2dc4..eacb5f5 100644
--- a/lib/tasks/backup.rake
+++ b/lib/tasks/backup.rake
@@ -18,9 +18,40 @@ namespace :backup do
$progress.puts "done".green
backup = Backup::Manager.new
- backup.pack
+ tar_file = backup.pack
backup.cleanup
backup.remove_old
+
+ # Relax backup directory permissions to make the migration easier
+ File.chmod(0755, GitlabCi.config.backup.path)
+
+ $progress.puts "\n\nYour final CI export is in the following file:\n\n"
+ system(*%W(ls -lh #{tar_file}))
+ $progress.puts
+ end
+
+ desc "GITLAB | Show database secrets"
+ task show_secrets: :environment do
+ configure_cron_mode
+ $progress.puts <<-EOS
+
+If you are moving to a GitLab installation installed from source, replace the
+contents of /home/git/gitlab/config/secrets.yml with the following:
+
+
+---
+production:
+ db_key_base: #{JSON.dump(GitlabCi::Application.secrets.db_key_base)}
+
+
+If your GitLab server uses Omnibus packages, add the following line to
+/etc/gitlab/gitlab.rb:
+
+
+gitlab_rails['db_key_base'] = #{GitlabCi::Application.secrets.db_key_base.inspect}
+
+
+EOS
end
desc "GITLAB | Restore a previously created backup"