BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ac571623
Commit
ac571623
authored
Sep 18, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pg_dump_schema' into 'master'
Add pg_schema to backup config
https://dev.gitlab.org/gitlab/gitlabhq/issues/2489
See merge request !1345
parents
8b05abe8
d7242054
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
2 deletions
+9
-2
CHANGELOG
CHANGELOG
+1
-0
gitlab.yml.example
config/gitlab.yml.example
+1
-0
1_settings.rb
config/initializers/1_settings.rb
+1
-0
database.rb
lib/backup/database.rb
+6
-2
No files found.
CHANGELOG
View file @
ac571623
...
@@ -54,6 +54,7 @@ v 8.0.0 (unreleased)
...
@@ -54,6 +54,7 @@ v 8.0.0 (unreleased)
- Sort users autocomplete lists by user (Allister Antosik)
- Sort users autocomplete lists by user (Allister Antosik)
- Webhook for issue now contains repository field (Jungkook Park)
- Webhook for issue now contains repository field (Jungkook Park)
- Add ability to add custom text to the help page (Jeroen van Baarsen)
- Add ability to add custom text to the help page (Jeroen van Baarsen)
- Add pg_schema to backup config
v 7.14.3
v 7.14.3
- No changes
- No changes
...
...
config/gitlab.yml.example
View file @
ac571623
...
@@ -306,6 +306,7 @@ production: &base
...
@@ -306,6 +306,7 @@ production: &base
path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)
path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)
# archive_permissions: 0640 # Permissions for the resulting backup.tar file (default: 0600)
# archive_permissions: 0640 # Permissions for the resulting backup.tar file (default: 0600)
# keep_time: 604800 # default: 0 (forever) (in seconds)
# keep_time: 604800 # default: 0 (forever) (in seconds)
# pg_schema: public # default: nil, it means that all schemas will be backed up
# upload:
# upload:
# # Fog storage connection settings, see http://fog.io/storage/ .
# # Fog storage connection settings, see http://fog.io/storage/ .
# connection:
# connection:
...
...
config/initializers/1_settings.rb
View file @
ac571623
...
@@ -220,6 +220,7 @@ Settings.gitlab_shell['ssh_path_prefix'] ||= Settings.send(:build_gitlab_shell_s
...
@@ -220,6 +220,7 @@ Settings.gitlab_shell['ssh_path_prefix'] ||= Settings.send(:build_gitlab_shell_s
#
#
Settings
[
'backup'
]
||=
Settingslogic
.
new
({})
Settings
[
'backup'
]
||=
Settingslogic
.
new
({})
Settings
.
backup
[
'keep_time'
]
||=
0
Settings
.
backup
[
'keep_time'
]
||=
0
Settings
.
backup
[
'pg_schema'
]
=
nil
Settings
.
backup
[
'path'
]
=
File
.
expand_path
(
Settings
.
backup
[
'path'
]
||
"tmp/backups/"
,
Rails
.
root
)
Settings
.
backup
[
'path'
]
=
File
.
expand_path
(
Settings
.
backup
[
'path'
]
||
"tmp/backups/"
,
Rails
.
root
)
Settings
.
backup
[
'archive_permissions'
]
||=
0600
Settings
.
backup
[
'archive_permissions'
]
||=
0600
Settings
.
backup
[
'upload'
]
||=
Settingslogic
.
new
({
'remote_directory'
=>
nil
,
'connection'
=>
nil
})
Settings
.
backup
[
'upload'
]
||=
Settingslogic
.
new
({
'remote_directory'
=>
nil
,
'connection'
=>
nil
})
...
...
lib/backup/database.rb
View file @
ac571623
...
@@ -25,8 +25,12 @@ module Backup
...
@@ -25,8 +25,12 @@ module Backup
when
"postgresql"
then
when
"postgresql"
then
$progress
.
print
"Dumping PostgreSQL database
#{
config
[
'database'
]
}
... "
$progress
.
print
"Dumping PostgreSQL database
#{
config
[
'database'
]
}
... "
pg_env
pg_env
# Pass '--clean' to include 'DROP TABLE' statements in the DB dump.
pgsql_args
=
[
"--clean"
]
# Pass '--clean' to include 'DROP TABLE' statements in the DB dump.
system
(
'pg_dump'
,
'--clean'
,
config
[
'database'
],
out:
db_file_name
)
if
Gitlab
.
config
.
backup
.
pg_schema
pgsql_args
<<
"-n"
pgsql_args
<<
Gitlab
.
config
.
backup
.
pg_schema
end
system
(
'pg_dump'
,
*
pgsql_args
,
config
[
'database'
],
out:
db_file_name
)
end
end
report_success
(
success
)
report_success
(
success
)
abort
'Backup failed'
unless
success
abort
'Backup failed'
unless
success
...
...
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