Commit Graph

134 Commits

Author SHA1 Message Date
GitLab Bot 7b8ec6e718 Add latest changes from gitlab-org/gitlab@master 2019-10-15 18:06:01 +00:00
GitLab Bot 3d13802bc2 Add latest changes from gitlab-org/gitlab@master 2019-10-15 09:06:09 +00:00
Dominic Renner ad29681cab Replaced config access
Replaced Settings with Gitlab.config for uniformity
2019-03-18 17:26:18 +00:00
Rémy Coutable 5c583c8e87 Merge branch 'master' into '46448-add-timestamps-for-each-stage-of-gitlab-rake-gitlab-backup-restore'
# Conflicts:
#   spec/tasks/gitlab/backup_rake_spec.rb
2019-02-04 14:11:04 +00:00
Zeger-Jan van de Weg 89a407dc3b
Restore Object Pools when restoring an object pool
Pool repositories are persisted in the database, and when the DB is
restored, the data need to be restored on disk. This is done by
resetting the state machine and rescheduling the object pool creation.

This is not an exact replica of the state like at the time of the
creation of the backup. However, the data is consistent again.

Dumping isn't required as internally GitLab uses git bundles which
bundle all refs and include all objects in the bundle that they require,
reduplicating as more repositories get backed up. This does require more
data to be stored.

Fixes https://gitlab.com/gitlab-org/gitaly/issues/1355
2018-12-13 09:00:03 +01:00
George Tsiolis 733ae94921 Fix typos in comments and specs 2018-11-01 08:59:20 +02:00
Zeger-Jan van de Weg d7afed34c4
Remove feature flags from lib/backup
Moved to OPT_OUT in 7d14b725a0, Now, by
removing the feature gates, this is an mandatory feature.

Related issues:
- https://gitlab.com/gitlab-org/gitaly/issues/526
- https://gitlab.com/gitlab-org/gitaly/issues/1194

Closes https://gitlab.com/gitlab-org/gitaly/issues/749
Closes https://gitlab.com/gitlab-org/gitaly/issues/1212
Closes https://gitlab.com/gitlab-org/gitaly/issues/1195
2018-07-31 15:24:19 +02:00
Will Chandler cc41a77183 Add timestamps to gitlab-rake gitlab:backup:restore
Adds a new method 'puts_time' that prepends the time of a
message when printing it.  All instances of 'progress.puts'
in the gitlab:backup:restore tasks are replaced with puts_time.
Example output:
  2018-06-03 16:33:25 -0400 -- Restoring uploads ..
Closes #46448
2018-06-14 23:03:15 -04:00
Jacob Vosmaer (GitLab) a0808df0b6 Find and mark more Git disk access locations 2018-06-05 15:51:14 +00:00
Stan Hu e6fca03bbd Fix backup creation and restore for specific Rake tasks 2018-05-24 14:58:25 +00:00
Zeger-Jan van de Weg ec4423665c
Gitlab::Shell works on shard name, not path
Direct disk access is done through Gitaly now, so the legacy path was
deprecated. This path was used in Gitlab::Shell however. This required
the refactoring in this commit.

Added is the removal of direct path access on the project model, as that
lookup wasn't needed anymore is most cases.

Closes https://gitlab.com/gitlab-org/gitaly/issues/1111
2018-04-25 13:36:22 +02:00
Jacob Vosmaer 008a6a6ce6 Route path lookups through legacy_disk_path 2018-03-21 18:18:32 +01:00
Takuya Noguchi 2b6307f6ad Enable RuboCop Style/RegexpLiteral 2018-02-01 02:06:07 +09:00
Zeger-Jan van de Weg 03ac8d5d0b Remove Rugged::Repository#empty? 2017-12-07 15:33:30 +00:00
Rémy Coutable 8b8bab118e Stub ENV in the backup task spec file
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-10-18 18:42:09 +02:00
Zeger-Jan van de Weg 4656283c5c
Gitaly namespace service enabled for GitLab 2017-10-05 14:11:32 +02:00
Robert Speicher c8b802471b Enable the RSpec/HookArgument cop and auto-correct offenses 2017-08-10 19:29:42 -04:00
Gabriel Mazetto c6dee99803 Rename path_with_namespace -> disk_path when dealing with the filesystem 2017-08-01 07:26:58 +02:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Alejandro Rodríguez 58821ebbb4 Stop using deprecated `path` field on Gitaly messages
This revealed an error in our configuration generation in
gitlab:gitaly:install rake task. The fix is included
2017-06-14 19:33:43 -04:00
Jacob Vosmaer 43f037c903 Don't reuse gRPC channels
It seems that bad things happen when two gRPC stubs share one gRPC
channel so let's stop doing that. The downside of this is that we
create more gRPC connections; one per stub.
2017-05-15 10:52:33 +02:00
Stan Hu d36a409768 Relax rake backup regex to handle CE and EE RCs
See http://rubular.com/r/uTDlT85zW1
2017-05-12 13:00:03 -07:00
Stan Hu 5bed3390aa Fix failing backup filename spec for RCs
See http://rubular.com/r/9oI7K8b773 for more details.
2017-05-11 22:31:20 -07:00
Kim "BKC" Carlbäcker 6f89bd3628 Use Gitaly for getting Branch/Tag counts
- Backup-rake-spec fixed. Storage config broken
- Use rugged to compare branch/tag-count in specs
- upgrade gitaly
2017-04-28 13:07:53 +02:00
Achilleas Pipinellis 3bce129570 Fix failing spec
http://rubular.com/r/op7TI9UX6K
2017-04-26 18:30:02 +02:00
Rémy Coutable 03538558d9 Merge branch 'rs-empty-project-misc' into 'master'
Use `:empty_project` in worker, view, task, serializer, policy, migration, and mailer specs

See merge request !10272
2017-03-30 12:06:23 +00:00
author Jacob Vosmaer jacob@gitlab.com 1490710538 +0200 6b8c2ea866 Allow backup tests to run locally 2017-03-29 14:48:06 +02:00
Jacob Vosmaer eee07f1c7c Expand relative paths in storages 2017-03-29 14:48:05 +02:00
Robert Speicher 02ccf750ee Use Project `:repository` trait where necessary in task specs 2017-03-27 18:45:36 -04:00
Sean McGivern a5db7f5425 Merge branch '28447-hybrid-repository-storages' into 'master'
Update storage settings to allow extra values per shard

See merge request !9597
2017-03-07 16:55:03 +00:00
Pawel Chojnacki d13669c98b Remove remnants of git annex 2017-03-03 18:33:47 +01:00
Alejandro Rodríguez 0b9d56f960 Update storage settings to allow extra values per shard
This will be necessary when adding gitaly settings. This version
doesn't make any functional changes, but allows us to include this
breaking change in 9.0 and add the needed extra settings in the future
with backwards compatibility
2017-03-03 12:13:30 -03:00
Kamil Trzcinski 120f9abaa1 Add GitLab Pages
- The pages are created when build artifacts for `pages` job are uploaded
- Pages serve the content under: http://group.pages.domain.com/project
- Pages can be used to serve the group page, special project named as host: group.pages.domain.com
- User can provide own 403 and 404 error pages by creating 403.html and 404.html in group page project
- Pages can be explicitly removed from the project by clicking Remove Pages in Project Settings
- The size of pages is limited by Application Setting: max pages size, which limits the maximum size of unpacked archive (default: 100MB)
- The public/ is extracted from artifacts and content is served as static pages
- Pages asynchronous worker use `dd` to limit the unpacked tar size
- Pages needs to be explicitly enabled and domain needs to be specified in gitlab.yml
- Pages are part of backups
- Pages notify the deployment status using Commit Status API
- Pages use a new sidekiq queue: pages
- Pages use a separate nginx config which needs to be explicitly added
2017-01-31 22:50:39 +00:00
Adam Niedzielski 82692ea214 Restore backup correctly when "BACKUP" environment variable is passed 2017-01-09 18:38:53 +01:00
Douwe Maan 7633e4ae3f Merge branch '23718/backup-rake-task-human-readable' into 'master'
23718/backup rake task human readable

## What does this MR do?
Add the human readable format to the backup tar file. 
From `1477317140_gitlab_backup.tar` to `1477317140_2016_10_24_gitlab_backup.tar`.

## Are there points in the code the reviewer needs to double check?

## Why was this MR needed?
#23718 issue
## Screenshots (if relevant)

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG.md) entry added
- [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [x] API support added
- Tests
  - [x] Added for this feature/bug
  - [x] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if it does - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?
23718

See merge request !7188
2016-12-01 03:39:31 +00:00
Rémy Coutable b193e84974
Move task helpers to a module
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-30 12:20:21 +01:00
David Gerő 0fbb5a86db Add Human Readable Timestamp to backup tar file 2016-11-30 11:41:53 +01:00
tiagonbotelho 96f050fa34 Backups do not fail anymore when using tar on annex and custom_hooks
only.
2016-10-27 11:24:35 +01:00
tiagonbotelho 4eb9056890 fixes build with cache:clear issue 2016-10-24 14:59:20 +01:00
bogdanvlviv 96ebc8c4f7 Use `File::exist?` instead of `File::exists?`
Since version ruby-2.2.0, method `File::exists?` is deprecated.
2016-08-11 13:54:45 +03:00
tiagonbotelho 1d268a89de adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
Grzegorz Bizon 9e211091a8 Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
Alejandro Rodríguez 86359ec854 Refactor repository paths handling to allow multiple git mount points 2016-06-29 22:30:31 -04:00
Kamil Trzcinski 12bd781031 Fix backups if registry is disabled 2016-05-23 14:18:39 -05:00
Kamil Trzcinski 143cd58c39 Added backup of container registry 2016-05-16 17:25:38 -05:00
Grzegorz Bizon 6f0cba11da Ensure uploads dir exists when running backup specs 2016-03-30 15:40:49 +02:00
Drew Blessing 5516b6c47f Reload the schema before restoring a database backup 2016-03-21 21:16:34 -05:00
Marin Jankovski 2219743d5c Add lfs to backup specs. 2015-11-19 10:43:45 +01:00
Marin Jankovski d9c4625c6d Specs that failed before the fix. 2015-11-18 13:16:07 +01:00
Kamil Trzcinski d0e3e823a2 Implement Build Artifacts
- Offloads uploading to GitLab Workhorse
- Use /authorize request for fast uploading
- Added backup recipes for artifacts
- Support download acceleration using X-Sendfile
2015-11-10 12:51:50 +01:00
Jacob Vosmaer b847baf8c4 One more backup spec fix
Stop the 'uploads' part from actually running.
2015-10-06 16:11:59 +02:00
Jacob Vosmaer 852526e07f Spec fixes for new backup contents 2015-10-06 16:10:14 +02:00
Guilherme Garnier aed145a9c6 Fix rubocop warnings in spec/lib and spec/tasks 2015-10-03 16:02:21 -05:00
Kamil Trzcinski 2f2b9f67c2 Fix backup tests 2015-09-16 00:06:41 +02:00
Kamil Trzcinski 81d98112d4 Fix: tasks/gitlab/backup_rake_spec.rb 2015-09-15 22:21:51 +02:00
Kamil Trzcinski ed18e04bb3 Cleanup CI backup => migrate with GitLab 2015-09-15 20:14:21 +02:00
Jacob Vosmaer 39a7e210a3 Use a separate backup test directory and nuke its contents 2015-07-24 18:54:06 +02:00
Jacob Vosmaer db0fce322a Create more backups during backup tests
I hope this makes the backup tests more reliable.
2015-07-24 18:34:00 +02:00
Jacob Vosmaer 810ffab4b1 Use a loop when enabling subtasks 2015-07-10 14:44:07 +02:00
Jacob Vosmaer 4612599e5e Remove rake task re-enabling into a method 2015-07-09 12:11:35 +02:00
Jacob Vosmaer 64f6034091 More hacks to get the specs working again 2015-07-08 20:07:56 +02:00
Jacob Vosmaer 0194dd4182 Add tests for custom backup archive file permissions 2015-07-07 19:03:29 +02:00
Dmitriy Zaporozhets 779646ef38
Fix rubocop issues after merge of recent master
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-23 10:46:29 +02:00
Robert Speicher bf71d53f63 Change `to_not` calls to `not_to`
Both work, but now we're consistent across the entire app.
2015-06-22 12:13:49 +02:00
Robert Speicher 5a9ede4721 Update mock and stub syntax for specs 2015-06-22 12:13:46 +02:00
Douwe Maan 9157985cfc Merge branch 'fix-backup-spec-regexp' into 'master'
Improve regexp to prevent false positives

If a filename happened to contain "db" and enough "rwx" characters before, then
this test would previously fail. For example:

```
drwxr-xr-x gitlab-runner/gitlab-runner      0 2015-04-02 07:46 uploads/tmp/cassidy.stokes8477/gitlabhq/36d972fa55d6b44810fc6fd843473adb/
```

Adding a space before the "db" match string tightens up the regexp and reduces the
chance of an unintended match.

See merge request !489
2015-04-03 08:49:47 +00:00
Stan Hu b277f23a53 Improve regexp to prevent false positives
If a filename happened to contain "db" and enough "rwx" characters before, then
this test would previously fail. For example:

```
drwxr-xr-x gitlab-runner/gitlab-runner      0 2015-04-02 07:46 uploads/tmp/cassidy.stokes8477/gitlabhq/36d972fa55d6b44810fc6fd843473adb/
```

Adding a space before the "db" match string tightens up the regexp and reduces the
chance of unintended match.
2015-04-02 07:02:47 -07:00
Valery Sizov 67c83489ca ability to skip some items in backup 2015-04-02 15:37:50 +03:00
Vinnie Okada 0f78d92e4c Don't use chmod_R for backup tars
When creating backup tar files, only change permissions on the `db`,
`uploads`, and `repositories` directories, not their contents.
2015-03-28 08:38:48 -06:00
Vinnie Okada 61c06c5e1a Change permissions on backup files
Use more restrictive permissions for backup tar files and for the db,
uploads, and repositories directories inside the tar files.
2015-03-17 19:04:21 -06:00
Dmitriy Zaporozhets 3a324d9c6d Revert "Merge branch 'backup-permissions' into 'master'"
This reverts commit c42262b43b, reversing
changes made to c6586b1283.
2015-03-16 23:51:46 -07:00
Vinnie Okada 8587a29370 Change permissions on backup files
Use more restrictive permissions for backup tar files and for the db,
uploads, and repositories directories inside the tar files.
2015-03-15 13:14:30 -06:00
Jeroen van Baarsen 0c4a70a306 Updated rspec to rspec 3.x syntax
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-02-12 19:17:35 +01:00
Jacob Vosmaer 46b1c63b7a Make backup version blocker test more robust
Assuming that VERSION != VERSION.reverse is not robust. This will fail
at e.g. version 6.6.6.
2014-02-28 12:11:43 +01:00
Jacob Vosmaer b36751c897 Use VERSION contanst in backup specs 2014-02-28 11:57:58 +01:00
Andrew Kumanyaev f9780eeeca Fix deprecation in specs
From https://github.com/gitlabhq/gitlabhq/pull/6053
2014-01-15 14:00:11 +03:00
Dmitriy Zaporozhets fb0b932937 Revert "Fix deprecation in specs"
This reverts commit 414ead57ee.
2014-01-14 23:55:51 +02:00
Andrew Kumanyaev 414ead57ee Fix deprecation in specs
DEPRECATION: `expect { }.not_to raise_error(SpecificErrorClass)` is deprecated. Use `expect { }.not_to raise_error` (with no args) instead. Called from /home/travis/build/gitlabhq/gitlabhq/spec/tasks/gitlab/backup_rake_spec.rb:42:in `block (4 levels) in <top (required)>'.
2014-01-14 20:57:29 +03:00
Johannes Schleifenbaum cd19f82e51 Fix typos 2013-07-29 12:47:06 +02:00
Andrey Kumanyaev 67ccc8b52a Replace old hashes with new 1.9 ruby hashes (rebase) 2013-05-05 18:01:10 +04:00
Dmitriy Zaporozhets c8ba5c2d58 Fix routing issues when navigating over tree, commits etc 2012-12-25 06:14:05 +03:00
Dmitriy Zaporozhets b510f8c496 Fixed tests 2012-12-21 13:37:44 +02:00
Hugo Duksis a9c2500a55 Stub for Dir.chdir as it is not needed 2012-11-20 16:34:58 +02:00
Hugo Duksis a8eb3fe1d2 tests for issue #1984 2012-11-19 22:42:58 +02:00