Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
a2001eec
Commit
a2001eec
authored
Nov 18, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backup LFS objects same as any upload.
parent
03442eb3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
2 deletions
+36
-2
doc/raketasks/backup_restore.md
doc/raketasks/backup_restore.md
+1
-1
lib/backup/lfs.rb
lib/backup/lfs.rb
+13
-0
lib/backup/manager.rb
lib/backup/manager.rb
+1
-1
lib/tasks/gitlab/backup.rake
lib/tasks/gitlab/backup.rake
+21
-0
No files found.
doc/raketasks/backup_restore.md
View file @
a2001eec
...
@@ -29,7 +29,7 @@ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
...
@@ -29,7 +29,7 @@ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
```
```
Also you can choose what should be backed up by adding environment variable SKIP. Available options: db,
Also you can choose what should be backed up by adding environment variable SKIP. Available options: db,
uploads (attachments), repositories, builds(CI build output logs), artifacts (CI build artifacts).
uploads (attachments), repositories, builds(CI build output logs), artifacts (CI build artifacts)
, lfs (LFS objects)
.
Use a comma to specify several options at the same time.
Use a comma to specify several options at the same time.
```
```
...
...
lib/backup/lfs.rb
0 → 100644
View file @
a2001eec
require
'backup/files'
module
Backup
class
Lfs
<
Files
def
initialize
super
(
'lfs'
,
Settings
.
lfs
.
storage_path
)
end
def
create_files_dir
Dir
.
mkdir
(
app_files_dir
,
0700
)
end
end
end
lib/backup/manager.rb
View file @
a2001eec
...
@@ -154,7 +154,7 @@ module Backup
...
@@ -154,7 +154,7 @@ module Backup
end
end
def
archives_to_backup
def
archives_to_backup
%w{uploads builds artifacts}
.
map
{
|
name
|
(
name
+
".tar.gz"
)
unless
skipped?
(
name
)
}.
compact
%w{uploads builds artifacts
lfs
}
.
map
{
|
name
|
(
name
+
".tar.gz"
)
unless
skipped?
(
name
)
}.
compact
end
end
def
folders_to_backup
def
folders_to_backup
...
...
lib/tasks/gitlab/backup.rake
View file @
a2001eec
...
@@ -13,6 +13,7 @@ namespace :gitlab do
...
@@ -13,6 +13,7 @@ namespace :gitlab do
Rake
::
Task
[
"gitlab:backup:uploads:create"
].
invoke
Rake
::
Task
[
"gitlab:backup:uploads:create"
].
invoke
Rake
::
Task
[
"gitlab:backup:builds:create"
].
invoke
Rake
::
Task
[
"gitlab:backup:builds:create"
].
invoke
Rake
::
Task
[
"gitlab:backup:artifacts:create"
].
invoke
Rake
::
Task
[
"gitlab:backup:artifacts:create"
].
invoke
Rake
::
Task
[
"gitlab:backup:lfs:create"
].
invoke
backup
=
Backup
::
Manager
.
new
backup
=
Backup
::
Manager
.
new
backup
.
pack
backup
.
pack
...
@@ -34,6 +35,7 @@ namespace :gitlab do
...
@@ -34,6 +35,7 @@ namespace :gitlab do
Rake
::
Task
[
"gitlab:backup:uploads:restore"
].
invoke
unless
backup
.
skipped?
(
"uploads"
)
Rake
::
Task
[
"gitlab:backup:uploads:restore"
].
invoke
unless
backup
.
skipped?
(
"uploads"
)
Rake
::
Task
[
"gitlab:backup:builds:restore"
].
invoke
unless
backup
.
skipped?
(
"builds"
)
Rake
::
Task
[
"gitlab:backup:builds:restore"
].
invoke
unless
backup
.
skipped?
(
"builds"
)
Rake
::
Task
[
"gitlab:backup:artifacts:restore"
].
invoke
unless
backup
.
skipped?
(
"artifacts"
)
Rake
::
Task
[
"gitlab:backup:artifacts:restore"
].
invoke
unless
backup
.
skipped?
(
"artifacts"
)
Rake
::
Task
[
"gitlab:backup:lfs:restore"
].
invoke
unless
backup
.
skipped?
(
"lfs"
)
Rake
::
Task
[
"gitlab:shell:setup"
].
invoke
Rake
::
Task
[
"gitlab:shell:setup"
].
invoke
backup
.
cleanup
backup
.
cleanup
...
@@ -134,6 +136,25 @@ namespace :gitlab do
...
@@ -134,6 +136,25 @@ namespace :gitlab do
end
end
end
end
namespace
:lfs
do
task
create: :environment
do
$progress
.
puts
"Dumping lfs objects ... "
.
blue
if
ENV
[
"SKIP"
]
&&
ENV
[
"SKIP"
].
include?
(
"lfs"
)
$progress
.
puts
"[SKIPPED]"
.
cyan
else
Backup
::
Lfs
.
new
.
dump
$progress
.
puts
"done"
.
green
end
end
task
restore: :environment
do
$progress
.
puts
"Restoring lfs objects ... "
.
blue
Backup
::
Lfs
.
new
.
restore
$progress
.
puts
"done"
.
green
end
end
def
configure_cron_mode
def
configure_cron_mode
if
ENV
[
'CRON'
]
if
ENV
[
'CRON'
]
# We need an object we can say 'puts' and 'print' to; let's use a
# We need an object we can say 'puts' and 'print' to; let's use a
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment