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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
69c659eb
Commit
69c659eb
authored
Jun 23, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compress database backup
parent
17446ff0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
CHANGELOG
CHANGELOG
+2
-0
doc/update/mysql_to_postgresql.md
doc/update/mysql_to_postgresql.md
+4
-1
lib/backup/database.rb
lib/backup/database.rb
+14
-0
No files found.
CHANGELOG
View file @
69c659eb
...
...
@@ -51,6 +51,8 @@ v 7.12.1
- Fix closed merge request scope at milestone page (Dmitriy Zaporozhets)
- Revert merge request states renaming
- Fix hooks for web based events with external issue references (Daniel Gerhardt)
- Improve performance for issue and merge request pages
- Compress database dumps to reduce backup size
v 7.12.0
- Fix Error 500 when one user attempts to access a personal, internal snippet (Stan Hu)
...
...
doc/update/mysql_to_postgresql.md
View file @
69c659eb
...
...
@@ -57,12 +57,15 @@ sudo -u git -H git clone https://github.com/gitlabhq/mysql-postgresql-converter.
sudo -u git -H mkdir db
sudo -u git -H python mysql-postgresql-converter/db_converter.py gitlabhq_production.mysql db/database.sql
# Compress database backup
sudo -u git -H gzip db/database.sql
# Replace the MySQL dump in TIMESTAMP_gitlab_backup.tar.
# Warning: if you forget to replace TIMESTAMP below, tar will create a new file
# 'TIMESTAMP_gitlab_backup.tar' without giving an error.
sudo -u git -H tar rf TIMESTAMP_gitlab_backup.tar db/database.sql
sudo -u git -H tar rf TIMESTAMP_gitlab_backup.tar db/database.sql
.gz
# Done! TIMESTAMP_gitlab_backup.tar can now be restored into a Postgres GitLab
# installation. Remember to recreate the indexes after the import.
...
...
lib/backup/database.rb
View file @
69c659eb
...
...
@@ -22,9 +22,19 @@ module Backup
end
report_success
(
success
)
abort
'Backup failed'
unless
success
$progress
.
print
'Compressing database ... '
success
=
system
(
'gzip'
,
db_file_name
)
report_success
(
success
)
abort
'Backup failed: compress error'
unless
success
end
def
restore
$progress
.
print
'Decompressing database ... '
success
=
system
(
'gzip'
,
'-d'
,
db_file_name_gz
)
report_success
(
success
)
abort
'Restore failed: decompress error'
unless
success
success
=
case
config
[
"adapter"
]
when
/^mysql/
then
$progress
.
print
"Restoring MySQL database
#{
config
[
'database'
]
}
... "
...
...
@@ -48,6 +58,10 @@ module Backup
File
.
join
(
db_dir
,
'database.sql'
)
end
def
db_file_name_gz
File
.
join
(
db_dir
,
'database.sql.gz'
)
end
def
mysql_args
args
=
{
'host'
=>
'--host'
,
...
...
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