Commit Graph

629 Commits

Author SHA1 Message Date
Yorick Peterse f30089075f
Fixed pagination of web hook logs
For reasons unknown, the logs of a web hook were paginated in memory.
This would result in the "Edit" page of a web hook timing out once it
has more than a few thousand log entries.

This commit makes the following changes:

1. We use LIMIT/OFFSET to paginate the data, instead of doing this in
   memory.

2. We limit the logs to the last two days, just like the documentation
   says (instead of retrieving everything).

3. We change the indexes on "web_hook_logs" so the query to get the data
   can perform a backwards index scan, without the need for a Filter.

These changes combined ensure that Projects::HooksController#edit no
longer times out.
2018-07-03 14:24:17 +02:00
Rémy Coutable 955f0ea57f Merge branch 'patch-28' into 'master'
Update wrong initial setting transfer in application_settings_controller.rb

See merge request gitlab-org/gitlab-ce!20059
2018-06-26 10:39:32 +00:00
Andrei Vukolov 6d2b934d44 Fix initial settings loading at the first run of GitLab installed from source 2018-06-25 17:44:03 +00:00
Lin Jen-Shin b23428d664 Bring changes from EE 2018-06-25 21:11:00 +08:00
Andrei Vukolov 1d116f3ecd Update wrong initial setting transfer in application_settings_controller.rb 2018-06-21 10:08:59 +00:00
Jasper Maes e3046dcabe Rails5 fix Admin::HooksController 2018-06-20 08:30:24 +02:00
Alexis Reigel ce6172e863
allow uploading favicon in appearance settings 2018-06-05 16:20:18 +02:00
Kamil Trzciński c6e95b0440 Improve `Ci::Runner#assign_to` to return a flag whether it succeeded or not 2018-05-31 10:56:41 +02:00
Stan Hu b6125f7045 Fix fast admin counters not working when PostgreSQL has secondaries
This commit does a number of things:

1. Reduces the number of queries needed by perform a single query to get all
the tuples for the relevant rows.

2. Uses a transaction to query the tuple counts to ensure that the data
is retrieved from the primary.

Closes #46742
2018-05-25 22:58:43 -07:00
Rémy Coutable a46929ea2f
Use ApplicationSetting.current_without_cache instead of ApplicationSetting.current where applicable
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-05-23 16:14:43 +02:00
Stan Hu e38938b332 Fix Error 500 viewing admin page due to statement timeouts
Uses PostgreSQL tuple estimates to provide a much faster yet approximate
count. See https://wiki.postgresql.org/wiki/Slow_Counting for more details.
We only use this fast method if the table has been analyzed or vacuumed
within the last hour.

Closes #46255
2018-05-16 08:27:48 -07:00
Dmitriy Zaporozhets 6106cad955
Don't reset application settings oauth providers by mistake
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2018-04-13 18:54:08 +03:00
Dmitriy Zaporozhets bcf7a7e76c
Don't reset application settings import sources
If form does not have import sources checkboxes we should not reset
import sources to empty. This fixes issue when import sources got reset
after user modifies unrelated settings section like GitLab pages

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2018-04-13 14:52:54 +03:00
blackst0ne ac1b5def53 [Rails5] Fix admin/application_settings_controller
The `RAILS5=1 rspec spec/controllers/admin/application_settings_controller_spec.rb`
command throws the error:

Failures:

  1) Admin::ApplicationSettingsController PUT #update falls back to defaults when settings are omitted
      Failure/Error: import_sources = params[:application_setting][:import_sources]

      NoMethodError:
        undefined method `[]' for nil:NilClass
      # ./app/controllers/admin/application_settings_controller.rb:62:in `application_setting_params'

This commit fixes it.
2018-04-11 12:33:11 +11:00
blackst0ne 3d3b46f344 [Rails5] Rename `sort` methods to `sort_by_attribute` 2018-04-04 09:19:47 +00:00
André Luís f8049f4e26 Backport changes in EE MR 4972: System Header and Footer 2018-04-02 14:27:12 +00:00
Toon Claes 9ab43aa762 Add read-only banner to all pages
When the database is in a read-only state, display a banner on each
page informing the user they cannot write to that GitLab instance.

Closes gitlab-org/gitlab-ce#43937.
2018-03-22 20:34:45 +01:00
julien MILLAU 30ef73afac Remove impersonate token from flash scope 2018-03-02 10:10:39 +00:00
Rémy Coutable 1c88d92b3f Improve Member services
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-02-27 16:02:22 +01:00
Clement Ho 95994503c9 Replace $.ajax in admin broadcast messages with axios 2018-02-05 14:59:48 +00:00
Rémy Coutable 4d64524b0d Merge branch 'query-counts' into 'master'
Track and act upon the number of executed SQL queries

See merge request gitlab-org/gitlab-ce!16466
2018-02-05 10:04:43 +00:00
Mario de la Ossa eaada9d706 use Gitlab::UserSettings directly as a singleton instead of including/extending it 2018-02-02 18:39:55 +00:00
Yorick Peterse cca61980d5
Track and act upon the number of executed queries
This ensures that we have more visibility in the number of SQL queries
that are executed in web requests. The current threshold is hardcoded to
100 as we will rarely (maybe once or twice) change it.

In production and development we use Sentry if enabled, in the test
environment we raise an error. This feature is also only enabled in
production/staging when running on GitLab.com as it's not very useful to
other users.
2018-02-01 17:00:46 +01:00
Zeger-Jan van de Weg 94a3dbca33
Gitaly Server info for admin panel
Implements the client side for gitlab-org/gitaly#819. Which is a server
info command. This checks the server version and git binairy version on
the server.

A small UI was added for administrators, so they can check the status of
the Gitaly server. This is done for each storage the monolith knows.

Because of this commit, gitlab-org/gitlab-ce!15580 is now closed. That
MR removed the Git version too, but didn't replace it with anything.
2018-01-31 08:54:45 +01:00
Douwe Maan 8e9c073a14 Merge branch 'feature/merge-request-system-hook' into 'master'
System hooks for Merge Requests

See merge request gitlab-org/gitlab-ce!14387
2018-01-18 11:37:16 +00:00
Phil Hughes 2af0b083c6 Merge branch 'winh-stop-jobs-modal' into 'master'
Add modal for stopping jobs in admin area

Closes #41305

See merge request gitlab-org/gitlab-ce!16283
2018-01-18 10:53:18 +00:00
Winnie Hellmann 76f16bbf71 Add modal for stopping jobs in admin area 2018-01-18 10:05:40 +01:00
Alexis Reigel 337ced28bc reference triggers.values for permitted parameters 2018-01-17 09:55:00 +01:00
Alexis Reigel eb5e0e921c add missing permitted param 2018-01-17 09:55:00 +01:00
Douwe Maan 536a47b4b7 Merge branch 'sh-migrate-can-push-to-deploy-keys-projects-10-3' into 'security-10-3'
[10.3] Migrate `can_push` column from `keys` to `deploy_keys_project`

See merge request gitlab/gitlabhq!2276

(cherry picked from commit f6ca52d31bac350a23938e0aebf717c767b4710c)

1f2bd3c0 Backport to 10.3
2018-01-16 17:04:51 -08:00
🙈 jacopo beschi 🙉 729f05f0e3 Adds Rubocop rule for line break around conditionals 2018-01-11 16:34:01 +00:00
Rémy Coutable 50d7c356c2
Present member collection at the controller level
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-12-12 18:14:58 +01:00
Bob Van Landuyt f1ae1e39ce Move the circuitbreaker check out in a separate process
Moving the check out of the general requests, makes sure we don't have
any slowdown in the regular requests.

To keep the process performing this checks small, the check is still
performed inside a unicorn. But that is called from a process running
on the same server.

Because the checks are now done outside normal request, we can have a
simpler failure strategy:

The check is now performed in the background every
`circuitbreaker_check_interval`. Failures are logged in redis. The
failures are reset when the check succeeds. Per check we will try
`circuitbreaker_access_retries` times within
`circuitbreaker_storage_timeout` seconds.

When the number of failures exceeds
`circuitbreaker_failure_count_threshold`, we will block access to the
storage.

After `failure_reset_time` of no checks, we will clear the stored
failures. This could happen when the process that performs the checks
is not running.
2017-12-08 09:11:39 +01:00
Markus Koller b8a3931925
Add custom brand text on new project pages 2017-12-04 17:22:59 +01:00
Grzegorz Bizon 354256d04c Merge branch 'refactor-services-for-audit-events-ce' into 'master'
[CE] Refactor controller calls into services

Closes gitlab-ee#3544

See merge request gitlab-org/gitlab-ce!15023
2017-11-03 08:40:00 +00:00
James Lopez 9cb9a86f37 fix typo 2017-11-02 14:33:56 +01:00
James Lopez 32ef7ed7d6 fix specs 2017-11-02 13:14:56 +01:00
Douwe Maan 3f24f9ed18 Add sudo API scope 2017-11-02 11:39:03 +01:00
James Lopez 37eb00ce5b fix specs 2017-11-02 08:49:36 +01:00
James Lopez 232bdd47d9 refactor code 2017-10-31 09:03:59 +01:00
James Lopez 72b7b10d52 add applications controller logic 2017-10-31 09:03:59 +01:00
Rémy Coutable 22ade6e7cb Merge branch '38720-sort-admin-runners' into 'master'
Add sort runners on admin runners

Closes #38720

See merge request gitlab-org/gitlab-ce!14661
2017-10-11 10:04:04 +00:00
Toon Claes d13669716a Create idea of read-only database
In GitLab EE, a GitLab instance can be read-only (e.g. when it's a Geo
secondary node). But in GitLab CE it also might be useful to have the
"read-only" idea around. So port it back to GitLab CE.

Also having the principle of read-only in GitLab CE would hopefully
lead to less errors introduced, doing write operations when there
aren't allowed for read-only calls.

Closes gitlab-org/gitlab-ce#37534.
2017-10-06 22:37:40 +02:00
Douwe Maan 0c0c2ecd99 Merge branch 'master' into digitalmoksha/gitlab-ce-feature/verify_secondary_emails
# Conflicts:
#	app/controllers/admin/users_controller.rb
#	app/controllers/confirmations_controller.rb
#	app/controllers/profiles/emails_controller.rb
#	app/models/user.rb
#	app/services/emails/base_service.rb
#	app/services/emails/destroy_service.rb
#	app/views/devise/mailer/confirmation_instructions.html.haml
#	lib/api/users.rb
#	spec/services/emails/destroy_service_spec.rb
2017-10-05 12:48:22 +02:00
Takuya Noguchi 6aff498426 Add sort runners on admin runners 2017-10-04 00:15:27 +09:00
James Lopez 1dcb711110 refactor emails service 2017-09-28 08:46:39 +02:00
James Lopez 67d06dee30 refactor users update service 2017-09-28 08:46:39 +02:00
James Lopez 4a6ec7c947 refactor some controllers to make them EE friendly 2017-09-28 08:46:39 +02:00
James Lopez 9621dd0c9d refactor services to match EE signature 2017-09-28 08:46:39 +02:00
Brett Walker b2d5379161 fix calls to Emails::DestroyService 2017-09-23 15:24:53 +02:00