Commit graph

25 commits

Author SHA1 Message Date
Connor Shea
903946c78a
Replace colorize gem with rainbow.
Colorize is a gem licensed under the GPLv2, so we can’t use it in GitLab without relicensing GitLab under the terms of the GPL. Rainbow is licensed under the MIT license and does the exact same thing as Colorize, so Rainbow was added in place of Colorize.

The syntax is slightly different for Rainbow vs. Colorize, and was updated in accordance.

The gem is still a dependency of Spinach, so it’s included in the development/test environments, but won’t be packaged with the actual product, and therefore doesn’t require we relicense the product.

An attempt at relicensing Colorize was made, but didn’t succeed as the library owner never responded.

Rainbow library: https://github.com/sickill/rainbow
Relevant issue regarding licensing in GitLab's gems: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3775
2016-06-03 10:37:09 -06:00
Jacob Vosmaer
901f544578 Remove superfluous mkdir -p 2015-10-06 15:38:21 +02:00
Jacob Vosmaer
e789644783 Keep old path: db/database.sql.gz
Documentation elsewhere refers to this internal path, let's keep
it.
2015-10-06 15:21:15 +02:00
Jacob Vosmaer
90ddf140b9 Reduce disk IO during SQL backup
By using light gzip compression we can save a lot of disk IO during
the backup.
2015-10-06 15:06:15 +02:00
Valery Sizov
d7242054ba add pg_schema to backup config 2015-09-18 16:29:13 +03:00
Jacob Vosmaer
4cd06867c7 Do not delete the SQL dump too early
The change in baa157926d broke backup
restore fucnctionality. This would not lead to data loss, but it
prevented the restore script from working. This bug exists only in
7.14.0 release candidate versions, not in 7.13.

Reported in https://github.com/gitlabhq/gitlabhq/issues/9571 .
2015-08-21 16:12:46 +02:00
Ted Strzalkowski
7430e7b5fc Workaround the warnings emitted by MySQL 5.6 regarding password on the
command line.
2015-08-12 07:51:24 -07:00
Jacob Vosmaer
baa157926d Stricter mkdir's in 'rake gitlab:backup:create' 2015-07-30 10:17:34 +02:00
Jacob Vosmaer
c5aae30773 Set internal backup directory modes on create
This sidesteps problems with running 'chmod' on some CIFS mounts.
2015-07-29 11:18:55 +02:00
Jacob Vosmaer
346b074979 Don't stop if database.sql.gz already exists
The existing behavior of the backups is to overwrite whatever data
was still there in the scratch directories. This broke when we added
a 'gzip' step because 'gzip database.sql' will fail if 'database.sql.gz'
already exists. Doing 'rm -f database.sql.gz' before the 'gzip'
avoids this failure.
2015-07-21 10:37:27 +02:00
Dmitriy Zaporozhets
b9452d7bcd Merge branch 'improve-postgres-restore-cleaning' into 'master'
Use native Postgres database cleaning during backup restore

We were using hacks to drop tables etc during a Postgres backup
restore. With this change, we let pg_dump insert the DROP TABLE
statements it needs at the start of the SQL dump.

See merge request !1891
2015-07-07 23:02:48 +00:00
Jacob Vosmaer
90ab5a59bb Use native Postgres database cleaning during backup restore
We were using hacks to drop tables etc during a Postgres backup
restore. With this change, we let pg_dump insert the DROP TABLE
statements it needs at the start of the SQL dump.
2015-07-07 15:34:06 +02:00
Kamil Trzcinski
69c659ebd3 Compress database backup 2015-07-06 17:14:17 +02:00
Jacob Vosmaer
7c54c63ac1 Add CRON=1 backup setting for quiet backups 2014-11-20 15:46:04 +01:00
Jacob Vosmaer
e00e67db42 Drop all Postgres sequences during backup restore 2014-10-28 18:52:21 +01:00
Jacob Vosmaer
02bf992f37 Fail harder in the backup script
This change also shows the output of failed Git commands during the
backup.
2014-10-01 15:43:27 +02:00
Jacob Vosmaer
77b57c114b Drop all tables before restoring a PostgreSQL DB
Invoking 'db:schema:load' turned out to be a bad idea: when downgrading
an existing GitLab installation, the schema of the newer version would
be preserved when trying to import the old version.
2014-03-28 13:44:46 +01:00
Jacob Vosmaer
8fe10e642a Empty the database during Postgres backup restore
The expected behavior during a GitLab backup restore is to overwrite
existing database data. This works for MySQL because the output of
mysqldump contains 'DROP TABLE IF EXISTS' statements. pg_dump on the
other hand assumes that one will restore into an empty database. When
this is not the case, during the restore with psql some of the data will
be skipped if existing data is 'in the way'. By first invoking `rake
db:schema:load` during a Postgres GitLab backup restore, we make sure
that all important data is correctly restored.
2014-02-26 18:26:31 +01:00
Jacob Vosmaer
9e6fc8b526 Report failure of DB backup commands 2014-01-23 11:19:43 +01:00
Jacob Vosmaer
a540ab4290 Remove Bourne shell from backup code 2013-11-06 14:02:28 +01:00
Dmitriy Zaporozhets
f9b66aecdd Revert "More escaping"
This reverts commit c46eaca912.
2013-11-05 15:35:49 +02:00
Nigel Kukard
c46eaca912 More escaping
- Database name may contain characters which are not shell friendly
- Database password could contain the same
- While we at it there is no harm in escaping generated paths too
- Refactored 2-line system(command)

Signed-off-by: Nigel Kukard <nkukard@lbsd.net>
2013-11-04 22:09:03 +00:00
andrewwutw
b898372154 Fix PostgreSQL database restoration problem (#4217)
Use psql instead of pg_restore to restore SQL dump file.
2013-06-10 19:06:12 +08:00
Axilleas Pipinellis
13dcc390cb Fix errors during backup task. Fix #3785
By default there is no public/uploads directory when no attachments
are uploaded. Prompt users to create the uploads directory during
install otherwise the backup task will fail.

Place mysqldump args in single quotes to avoid error if password
contains special characters.

Signed-off-by: Axilleas Pipinellis <axilleas@archlinux.gr>
2013-05-07 14:44:49 +03:00
Dmitriy Zaporozhets
c33d5e16fe refactor backup/restore 2013-04-05 19:01:19 +03:00