Commit Graph

731 Commits

Author SHA1 Message Date
Ben Bodenmiller 2497917b65 delete feature flag when disabling Rugged 2019-05-13 08:57:10 +00:00
Cindy Pallares deb5276f8b
Add warning that gitlab-secrets isn't included
Many customers forget to include the gitlab-secrets.json file. This adds
a warning that both gitlab-secrets.json and gitlab.rb are not included
in the backup.
2019-05-08 12:39:04 -05:00
Rémy Coutable 2537b0c1e0
Provide a new gitlab:seed:issues task
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-04-23 11:43:53 +02:00
Kamil Trzciński 650f40865e Forbid the use of `#reload` and prefer `#reset`
The `#reload` makes to load all objects into memory,
and the main purpose of `#reload` is to drop the association cache.

The `#reset` seems to solve exactly that case.
2019-04-15 13:05:14 +02:00
Robert Speicher e036cb04a2 Merge branch 'remaining-lib-differences' into 'master'
Resolve remaining CE to EE differences in lib/

See merge request gitlab-org/gitlab-ce!26608
2019-04-03 12:27:55 +00:00
Yorick Peterse 1f4bc814ab
Backport EE changes to gitlab:env:info
This backports EE specific changes for the Rake task `gitlab:env:info`,
wrapping them in a conditional. There is no way to inject code in the
middle of a Rake task in EE, so unfortunately this is the best we can
do.
2019-04-02 14:57:44 +02:00
John Jarvis 69b65a6b74 Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq into jarv/dev-to-gitlab-2019-04-02 2019-04-02 10:12:32 +02:00
Jan Provaznik a466d97e62 Rake task for removing exif from uploads
Adds a rake task which can be used for removing EXIF
data from existing uploads.
2019-04-02 07:48:35 +00:00
Wei-Meng Lee cfc6d2528c Fix attempting to drop views in PostgreSQL 2019-04-02 00:19:22 +00:00
Douglas Barbosa Alexandre a86f48c79b
Add helper method to return a human-friendly name for database adapter 2019-03-21 19:03:26 -03:00
Patrick Bajao 26dadbc9c4 Integrate Gitlab::Keys with Gitlab::Shell
In this commit, some methods that aren't being used
are removed from `Gitlab::Shell`. They are the ff:
- `#remove_keys_not_found_in_db`
- `#batch_read_key_ids`
- `#list_key_ids`

The corresponding methods in `Gitlab::Keys` have been
removed as well.
2019-03-19 11:16:21 +00:00
Nick Thomas 9f05e97aad
Run rubocop -a 2019-03-13 13:42:43 +00:00
Gabriel Mazetto 337977776a Prevent storage migration and rollback running at the same time
This is a small polishing on the storage migration and storage rollback
rake tasks. By aborting a migration while a rollback is already
scheduled we want to prevent unexpected consequences.
2019-03-12 17:51:05 +01:00
Ray Paik 976fee745e Update cleanup.rake to fix a typo in the error message 2019-03-07 23:37:16 +00:00
Rémy Coutable c1c30f19a1 Merge branch 'resolve-some-rake-differences' into 'master'
Resolve some Rake task differences

See merge request gitlab-org/gitlab-ce!25644
2019-03-04 11:45:21 +00:00
Sean McGivern fd50ba4240 Merge branch 'sh-rugged-find-commit' into 'master'
Bring back Rugged implementation of find_commit

See merge request gitlab-org/gitlab-ce!25477
2019-03-04 09:22:44 +00:00
Stan Hu fb6a4e21d4 Bring back Rugged implementation of find_commit
This brings back some of the changes in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20339.

For users using Gitaly on top of NFS, accessing the Git data directly
via Rugged is more performant than Gitaly. This merge request introduces
the feature flag `rugged_find_commit` to activate Rugged paths.

There are also Rake tasks `gitlab:features:enable_rugged` and
`gitlab:features:disable_rugged` to enable/disable these feature
flags altogether.

Part of four Rugged changes identified in
https://gitlab.com/gitlab-org/gitlab-ce/issues/57317.
2019-03-01 08:45:51 -08:00
Gabriel Mazetto fc0ff92807 Added Rollbacker workers and support on the rake task
Rollback is done similar to Migration for the Hashed Storage.
It also shares the same ExclusiveLease key to prevent both happening
at the same time.

All Hashed Storage related workers now share the same queue namespace
which allows for assigning dedicated workers easily.
2019-03-01 15:49:20 +01:00
Gabriel Mazetto ff2ca3569e Rake task for storage rollback 2019-03-01 15:49:20 +01:00
Yorick Peterse bb873b1e3b
Make the backup Rake task the same as in EE
EE uses single quotes for the changed line, whereas CE was using double
quotes. This commit ensures both repositories use the same kind of
quotes.
2019-02-28 15:03:10 +01:00
Jacob Vosmaer 078f11a6b9 Prepare test suite for switch to Gitaly-embedded Git hooks 2019-02-27 10:58:21 +00:00
Stan Hu 1dadfff3f5 Move terminate_all_connections into setup Rake task 2019-02-11 21:30:57 -08:00
Stan Hu 5488e8a4a3 Kill all PostgreSQL connections for rake dev:setup
If there are any clients connected to the DB, PostgreSQL won't let you
drop the database. It's possible that Sidekiq, Unicorn, or some other
client will be hanging onto a connection, preventing the DROP DATABASE
from working. To workaround this problem, this method cancels all the
connections so that the db:reset command will work.

Note that there's still a slight possibility a client connects after its
connection is terminated. If this is an issue, we could solve it by
revoking CONNECT access, but for now it seems this works.

Closes https://gitlab.com/gitlab-org/gitlab-development-kit/issues/450
2019-02-11 21:30:57 -08:00
Jose Torres 56c267e52c Fix MySQL error when truncating a table that doesn't exist
This adds a conditional statement before truncating the
`schema_migrations` table.

This comit also ports this code to Rails 5.
2019-02-05 17:30:22 -08:00
Rémy Coutable 6b39f55d3f
Add cache to the 'compile-assets' and 'gitlab:assets:compile' jobs
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-02-05 14:04:54 +01: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
Gabriel Mazetto 7bc16889df Refactor Storage Migration
Specs were reviewed and improved to better cover the current behavior.
There was some standardization done as well to facilitate the
implementation of the rollback functionality.

StorageMigratorWorker was extracted to HashedStorage namespace were
RollbackerWorker will live one as well.
2019-01-25 20:26:35 +01:00
Gabriel Mazetto c2c34eba62 Prepare rake task for storage rollback
We are keeping compatibility with existing scheduled jobs.
2019-01-25 20:26:35 +01:00
Rémy Coutable 3a2abc1d50
Enable the Layout/ExtraSpacing cop
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-01-24 13:05:45 +01:00
Michael Kozono 9f80f04059 Prevent admins from attempting hashed storage migration on read only DB 2018-12-19 21:10:00 +00:00
Nick Thomas 7329480412
Fix gitlab:web_hook tasks 2018-12-06 18:37:05 +00:00
Michael Kozono 6855e6b586 Extract system check rake task logic
These changes make the code more reusable, testable, and most
importantly, overrideable.
2018-12-03 13:51:46 -08:00
Nick Thomas c43af89748 Merge branch 'zj-object-pool-path' into 'master'
Rename Repository table to PoolRepository

See merge request gitlab-org/gitlab-ce!23236
2018-11-28 13:07:12 +00:00
Zeger-Jan van de Weg fff7754186
Rename the Repository table to PoolRepository
To separate the different kinds of repositories we have at GitLab this
table will be renamed to pool_repositories. A project can, for now at
least, be member of none, or one of these. The table will get additional
columns in a later merge request where more logic is implemented for the
model.

Further included is a small refactor of logic around hashing ids for the
disk_path, mainly to ensure a previous implementation is reusable.

The disk_path for the pool_repositories table no longer has a NOT NULL
constraint, but given the hashing of the ID requires the DB to assign
the record an ID, an after_create hook is used to update the value.

A related MR is:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23143, adding
tables for 'normal' repositories and wiki_repositories.
2018-11-27 13:41:46 +01:00
Gabriel Mazetto fe2e6c6dc0 Remove Site Statistic
This approach caused many different problems as we tightened
the query execution timeout.
2018-11-26 23:39:05 +01:00
Zeger-Jan van de Weg 358fefc777
Migrate storage checks to Gitaly
Most of these checks are not valuable in the current setup, thus removed
and replaced by Gitaly checking if its read and writeable.

Depends on:
1. https://gitlab.com/gitlab-org/gitaly/merge_requests/675
2018-11-09 09:15:42 +01:00
Rémy Coutable e232ebf7a1 Merge branch 'rake-gitaly-check' into 'master'
Delegate storage health check to Gitaly's health check

Closes gitaly#1336

See merge request gitlab-org/gitlab-ce!22063
2018-11-06 15:08:32 +00:00
Cindy Pallares 75cf72344f
Use gitlab_environment for ldap rake task 2018-10-25 13:56:39 -05:00
Alejandro Rodríguez 098c722542 Add gitlab:gitaly:check task for Gitaly health check
Also, since Gitaly now takes care of checking for storage paths
existence/accessibility, we can remove those check from the
gitlab:gitlab_shell_check task and advance further into 0 direct disk
approach on gitlab-rails
2018-10-23 20:11:10 -03:00
Michael Bisbjerg 51b21050c5 Typo in log message of gitlab-rake gitlab:artifacts:migrate 2018-09-27 13:18:14 +00:00
Dylan Griffith f5f5d6ea1f Resolve "Un-vendor CI templates" 2018-09-26 15:39:27 +00:00
Douglas Barbosa Alexandre 6167615a74 Merge branch 'follow-up-geo-sync-disabled-wikis' into 'master'
CE port of https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/6906

See merge request gitlab-org/gitlab-ce!21903
2018-09-25 17:19:23 +00:00
Valery Sizov 15d011d64d Geo: sync disabled wikis. Stage 2
We started syncing all the wiki regardless of the fact it's disabled or
not. We couldn't do that in one stage because of needing of smoth update
and deprecating things. This is the second stage that finally removes
unused columns in the geo_node_status table.
2018-09-25 17:49:39 +03:00
Cindy Pallares a7e774566e
Enable write to auth_keys file during restore
Fast lookup of authorized SSH keys in the database was ported to CE in
v10.4. This change adds the option to enable the setting via the restore
rake task and assumes yes if the force env variable is set.
2018-09-25 09:34:14 -05:00
Yorick Peterse ec33016bcd Include post migrations when loading the schema
See merge request gitlab-org/gitlab-ce!21689
2018-09-19 12:29:25 +00:00
Balasankar "Balu" C c4668c388f
Add wrapper rake task to migrate all uploads to OS
Add a rake task that will trigger gitlab:uploads:migrate rake task with
different possible arguments, one by one.
2018-09-18 20:26:54 +05:30
DJ Mountney 76cfe4f1fd Ensure the schema is loaded with post_migrations included
If doing a schema load, the post_migrations should also be marked as up,
even if SKIP_POST_DEPLOYMENT_MIGRATIONS was set, otherwise future
migration runs will be broken.
2018-09-11 18:41:14 -07:00
Douwe Maan 1f765ce9ea Merge branch '48778-remove-old-storage-logic-from-import-export' into 'master'
Resolve "Remove old storage logic from Import/Export"

Closes #51144, #50109, #48778, and #51079

See merge request gitlab-org/gitlab-ce!21409
2018-09-07 14:28:25 +00:00
James Lopez f1277fbf0b
refactor code based on feedback 2018-09-07 14:43:51 +02:00
Zeger-Jan van de Weg 3aedccb17a
Port cleanup tasks to use Gitaly
Rake tasks cleaning up the Git storage were still using direct disk
access, which won't work if these aren't attached. To mitigate a
migration issue was created.

To port gitlab:cleanup:dirs, and gitlab:cleanup:repos, a new RPC was
required, ListDirectories. This was implemented in Gitaly, through
https://gitlab.com/gitlab-org/gitaly/merge_requests/868.

To be able to use the new RPC the Gitaly server was bumped to v0.120.

This is an RPC that will not use feature gates, as this doesn't scale on
.com so there is no way to test it at scale. Futhermore, we _know_ it
doesn't scale, but this might be a useful task for smaller instances.

Lastly, the tests are slightly updated to also work when the disk isn't
attached. Eventhough this is not planned, it was very little effort and
thus I applied the boy scout rule.

Closes https://gitlab.com/gitlab-org/gitaly/issues/954
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/40529
2018-09-07 13:58:31 +02:00