Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/00_connection_logger.rb26
-rw-r--r--config/initializers/0_marginalia.rb9
-rw-r--r--config/initializers/1_settings.rb63
-rw-r--r--config/initializers/7_prometheus_metrics.rb18
-rw-r--r--config/initializers/active_record_lifecycle.rb8
-rw-r--r--config/initializers/active_record_transaction_observer.rb2
-rw-r--r--config/initializers/attr_encrypted_no_db_connection.rb19
-rw-r--r--config/initializers/carrierwave_patch.rb2
-rw-r--r--config/initializers/content_security_policy.rb2
-rw-r--r--config/initializers/doorkeeper.rb10
-rw-r--r--config/initializers/elastic_client_setup.rb26
-rw-r--r--config/initializers/omniauth.rb2
-rw-r--r--config/initializers/request_profiler.rb1
-rw-r--r--config/initializers/sidekiq.rb17
-rw-r--r--config/initializers/validate_database_config.rb6
15 files changed, 81 insertions, 130 deletions
diff --git a/config/initializers/00_connection_logger.rb b/config/initializers/00_connection_logger.rb
new file mode 100644
index 00000000000..9f03d13f95f
--- /dev/null
+++ b/config/initializers/00_connection_logger.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+module NewConnectionLogger
+ extend ActiveSupport::Concern
+
+ prepended do |base|
+ base.class_attribute :warn_on_new_connection, default: false
+ end
+
+ class_methods do
+ def new_client(...)
+ if warn_on_new_connection && !ENV['SKIP_LOG_INITIALIZER_CONNECTIONS']
+ cleaned_caller = Gitlab::BacktraceCleaner.clean_backtrace(caller)
+ message = "Database connection should not be called during initializers. Read more at https://docs.gitlab.com/ee/development/rails_initializers.html#database-connections-in-initializers"
+
+ ActiveSupport::Deprecation.warn(message, cleaned_caller)
+
+ warn caller if ENV['DEBUG_INITIALIZER_CONNECTIONS']
+ end
+
+ super
+ end
+ end
+end
+
+ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(NewConnectionLogger)
diff --git a/config/initializers/0_marginalia.rb b/config/initializers/0_marginalia.rb
index 805a9e33347..e88599fd93c 100644
--- a/config/initializers/0_marginalia.rb
+++ b/config/initializers/0_marginalia.rb
@@ -17,11 +17,14 @@ Marginalia::Comment.components = [:application, :correlation_id, :jid, :endpoint
# As mentioned in https://github.com/basecamp/marginalia/pull/93/files,
# adding :line has some overhead because a regexp on the backtrace has
-# to be run on every SQL query. Only enable this in development because
+# to be run on every SQL query. Only enable this in development and test because
# we've seen it slow things down.
-if Rails.env.development?
+if Gitlab.dev_or_test_env?
Marginalia::Comment.components << :line
- Marginalia::Comment.lines_to_ignore = Regexp.union(Gitlab::BacktraceCleaner::IGNORE_BACKTRACES + %w(lib/ruby/gems/ lib/gem_extensions/ lib/ruby/))
+ Marginalia::Comment.lines_to_ignore = Regexp.union(
+ Gitlab::BacktraceCleaner::IGNORE_BACKTRACES + %w[
+ lib/ruby/gems/ lib/gem_extensions/ lib/ruby/ lib/gitlab/marginalia/ gems/
+ ])
end
Gitlab::Marginalia.set_application_name
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index c0dc18c60c9..05d480f267e 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -252,7 +252,7 @@ Settings.gitlab_ci['url'] ||= Settings.__send__(:build_gitlab_ci
Settings['ci_secure_files'] ||= Settingslogic.new({})
Settings.ci_secure_files['enabled'] = true if Settings.ci_secure_files['enabled'].nil?
Settings.ci_secure_files['storage_path'] = Settings.absolute(Settings.ci_secure_files['storage_path'] || File.join(Settings.shared['path'], "ci_secure_files"))
-Settings.ci_secure_files['object_store'] = ObjectStoreSettings.legacy_parse(Settings.ci_secure_files['object_store'])
+Settings.ci_secure_files['object_store'] = ObjectStoreSettings.legacy_parse(Settings.ci_secure_files['object_store'], 'secure_files')
#
# Reply by email
@@ -276,7 +276,7 @@ Settings.artifacts['storage_path'] = Settings.absolute(Settings.artifacts.values
# Settings.artifact['path'] is deprecated, use `storage_path` instead
Settings.artifacts['path'] = Settings.artifacts['storage_path']
Settings.artifacts['max_size'] ||= 100 # in megabytes
-Settings.artifacts['object_store'] = ObjectStoreSettings.legacy_parse(Settings.artifacts['object_store'])
+Settings.artifacts['object_store'] = ObjectStoreSettings.legacy_parse(Settings.artifacts['object_store'], 'artifacts')
#
# Registry
@@ -321,7 +321,7 @@ Settings.pages['secret_file'] ||= Rails.root.join('.gitlab_pages_secret')
# We want pages zip archives to be stored on the same directory as old pages hierarchical structure
# this will allow us to easier migrate existing instances with NFS
Settings.pages['storage_path'] = Settings.pages['path']
-Settings.pages['object_store'] = ObjectStoreSettings.legacy_parse(Settings.pages['object_store'])
+Settings.pages['object_store'] = ObjectStoreSettings.legacy_parse(Settings.pages['object_store'], 'pages')
Settings.pages['local_store'] ||= Settingslogic.new({})
Settings.pages['local_store']['path'] = Settings.absolute(Settings.pages['local_store']['path'] || File.join(Settings.shared['path'], "pages"))
Settings.pages['local_store']['enabled'] = true if Settings.pages['local_store']['enabled'].nil?
@@ -362,7 +362,7 @@ Settings['external_diffs'] ||= Settingslogic.new({})
Settings.external_diffs['enabled'] = false if Settings.external_diffs['enabled'].nil?
Settings.external_diffs['when'] = 'always' if Settings.external_diffs['when'].nil?
Settings.external_diffs['storage_path'] = Settings.absolute(Settings.external_diffs['storage_path'] || File.join(Settings.shared['path'], 'external-diffs'))
-Settings.external_diffs['object_store'] = ObjectStoreSettings.legacy_parse(Settings.external_diffs['object_store'])
+Settings.external_diffs['object_store'] = ObjectStoreSettings.legacy_parse(Settings.external_diffs['object_store'], 'external_diffs')
#
# Git LFS
@@ -370,7 +370,7 @@ Settings.external_diffs['object_store'] = ObjectStoreSettings.legacy_parse(Setti
Settings['lfs'] ||= Settingslogic.new({})
Settings.lfs['enabled'] = true if Settings.lfs['enabled'].nil?
Settings.lfs['storage_path'] = Settings.absolute(Settings.lfs['storage_path'] || File.join(Settings.shared['path'], "lfs-objects"))
-Settings.lfs['object_store'] = ObjectStoreSettings.legacy_parse(Settings.lfs['object_store'])
+Settings.lfs['object_store'] = ObjectStoreSettings.legacy_parse(Settings.lfs['object_store'], 'lfs')
#
# Uploads
@@ -378,7 +378,7 @@ Settings.lfs['object_store'] = ObjectStoreSettings.legacy_parse(Settings.lfs['ob
Settings['uploads'] ||= Settingslogic.new({})
Settings.uploads['storage_path'] = Settings.absolute(Settings.uploads['storage_path'] || 'public')
Settings.uploads['base_dir'] = Settings.uploads['base_dir'] || 'uploads/-/system'
-Settings.uploads['object_store'] = ObjectStoreSettings.legacy_parse(Settings.uploads['object_store'])
+Settings.uploads['object_store'] = ObjectStoreSettings.legacy_parse(Settings.uploads['object_store'], 'uploads')
Settings.uploads['object_store']['remote_directory'] ||= 'uploads'
#
@@ -388,7 +388,7 @@ Settings['packages'] ||= Settingslogic.new({})
Settings.packages['enabled'] = true if Settings.packages['enabled'].nil?
Settings.packages['dpkg_deb_path'] = '/usr/bin/dpkg-deb' if Settings.packages['dpkg_deb_path'].nil?
Settings.packages['storage_path'] = Settings.absolute(Settings.packages['storage_path'] || File.join(Settings.shared['path'], "packages"))
-Settings.packages['object_store'] = ObjectStoreSettings.legacy_parse(Settings.packages['object_store'])
+Settings.packages['object_store'] = ObjectStoreSettings.legacy_parse(Settings.packages['object_store'], 'packages')
#
# Dependency Proxy
@@ -396,7 +396,7 @@ Settings.packages['object_store'] = ObjectStoreSettings.legacy_parse(Settings.p
Settings['dependency_proxy'] ||= Settingslogic.new({})
Settings.dependency_proxy['enabled'] = true if Settings.dependency_proxy['enabled'].nil?
Settings.dependency_proxy['storage_path'] = Settings.absolute(Settings.dependency_proxy['storage_path'] || File.join(Settings.shared['path'], "dependency_proxy"))
-Settings.dependency_proxy['object_store'] = ObjectStoreSettings.legacy_parse(Settings.dependency_proxy['object_store'])
+Settings.dependency_proxy['object_store'] = ObjectStoreSettings.legacy_parse(Settings.dependency_proxy['object_store'], 'dependency_proxy')
# For first iteration dependency proxy uses Rails server to download blobs.
# To ensure acceptable performance we only allow feature to be used with
@@ -410,7 +410,7 @@ Settings.dependency_proxy['enabled'] = false unless Gitlab::Runtime.puma?
Settings['terraform_state'] ||= Settingslogic.new({})
Settings.terraform_state['enabled'] = true if Settings.terraform_state['enabled'].nil?
Settings.terraform_state['storage_path'] = Settings.absolute(Settings.terraform_state['storage_path'] || File.join(Settings.shared['path'], "terraform_state"))
-Settings.terraform_state['object_store'] = ObjectStoreSettings.legacy_parse(Settings.terraform_state['object_store'])
+Settings.terraform_state['object_store'] = ObjectStoreSettings.legacy_parse(Settings.terraform_state['object_store'], 'terraform_state')
#
# Mattermost
@@ -482,9 +482,6 @@ Settings.cron_jobs['import_export_project_cleanup_worker']['job_class'] = 'Impor
Settings.cron_jobs['ci_archive_traces_cron_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['ci_archive_traces_cron_worker']['cron'] ||= '17 * * * *'
Settings.cron_jobs['ci_archive_traces_cron_worker']['job_class'] = 'Ci::ArchiveTracesCronWorker'
-Settings.cron_jobs['requests_profiles_worker'] ||= Settingslogic.new({})
-Settings.cron_jobs['requests_profiles_worker']['cron'] ||= '0 0 * * *'
-Settings.cron_jobs['requests_profiles_worker']['job_class'] = 'RequestsProfilesWorker'
Settings.cron_jobs['remove_expired_members_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['remove_expired_members_worker']['cron'] ||= '10 0 * * *'
Settings.cron_jobs['remove_expired_members_worker']['job_class'] = 'RemoveExpiredMembersWorker'
@@ -629,6 +626,9 @@ Settings.cron_jobs['clusters_integrations_check_prometheus_health_worker']['job_
Settings.cron_jobs['projects_schedule_refresh_build_artifacts_size_statistics_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['projects_schedule_refresh_build_artifacts_size_statistics_worker']['cron'] ||= '2/17 * * * *'
Settings.cron_jobs['projects_schedule_refresh_build_artifacts_size_statistics_worker']['job_class'] = 'Projects::ScheduleRefreshBuildArtifactsSizeStatisticsWorker'
+Settings.cron_jobs['inactive_projects_deletion_cron_worker'] ||= Settingslogic.new({})
+Settings.cron_jobs['inactive_projects_deletion_cron_worker']['cron'] ||= '0 1 * * *'
+Settings.cron_jobs['inactive_projects_deletion_cron_worker']['job_class'] = 'Projects::InactiveProjectsDeletionCronWorker'
Gitlab.ee do
Settings.cron_jobs['analytics_devops_adoption_create_all_snapshots_worker'] ||= Settingslogic.new({})
@@ -664,9 +664,6 @@ Gitlab.ee do
Settings.cron_jobs['geo_secondary_usage_data_cron_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['geo_secondary_usage_data_cron_worker']['cron'] ||= '0 0 * * 0'
Settings.cron_jobs['geo_secondary_usage_data_cron_worker']['job_class'] ||= 'Geo::SecondaryUsageDataCronWorker'
- Settings.cron_jobs['geo_file_download_dispatch_worker'] ||= Settingslogic.new({})
- Settings.cron_jobs['geo_file_download_dispatch_worker']['cron'] ||= '*/1 * * * *'
- Settings.cron_jobs['geo_file_download_dispatch_worker']['job_class'] ||= 'Geo::FileDownloadDispatchWorker'
Settings.cron_jobs['geo_registry_sync_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['geo_registry_sync_worker']['cron'] ||= '*/1 * * * *'
Settings.cron_jobs['geo_registry_sync_worker']['job_class'] ||= 'Geo::RegistrySyncWorker'
@@ -712,9 +709,9 @@ Gitlab.ee do
Settings.cron_jobs['ldap_sync_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['ldap_sync_worker']['cron'] ||= '30 1 * * *'
Settings.cron_jobs['ldap_sync_worker']['job_class'] = 'LdapSyncWorker'
- Settings.cron_jobs['pseudonymizer_worker'] ||= Settingslogic.new({})
- Settings.cron_jobs['pseudonymizer_worker']['cron'] ||= '0 23 * * *'
- Settings.cron_jobs['pseudonymizer_worker']['job_class'] ||= 'PseudonymizerWorker'
+ Settings.cron_jobs['free_user_cap_data_remediation'] ||= Settingslogic.new({})
+ Settings.cron_jobs['free_user_cap_data_remediation']['cron'] ||= '17 6,10,14,18 * * *'
+ Settings.cron_jobs['free_user_cap_data_remediation']['job_class'] = 'Namespaces::FreeUserCapWorker'
Settings.cron_jobs['update_max_seats_used_for_gitlab_com_subscriptions_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['update_max_seats_used_for_gitlab_com_subscriptions_worker']['cron'] ||= '0 12 * * *'
Settings.cron_jobs['update_max_seats_used_for_gitlab_com_subscriptions_worker']['job_class'] = 'UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker'
@@ -739,9 +736,6 @@ Gitlab.ee do
Settings.cron_jobs['users_create_statistics_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['users_create_statistics_worker']['cron'] ||= '2 15 * * *'
Settings.cron_jobs['users_create_statistics_worker']['job_class'] = 'Users::CreateStatisticsWorker'
- Settings.cron_jobs['network_policy_metrics_worker'] ||= Settingslogic.new({})
- Settings.cron_jobs['network_policy_metrics_worker']['cron'] ||= '0 3 * * 0'
- Settings.cron_jobs['network_policy_metrics_worker']['job_class'] = 'NetworkPolicyMetricsWorker'
Settings.cron_jobs['iterations_update_status_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['iterations_update_status_worker']['cron'] ||= '5 0 * * *'
Settings.cron_jobs['iterations_update_status_worker']['job_class'] = 'IterationsUpdateStatusWorker'
@@ -775,6 +769,12 @@ Gitlab.ee do
Settings.cron_jobs['ci_project_mirrors_consistency_check_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['ci_project_mirrors_consistency_check_worker']['cron'] ||= '2-58/4 * * * *'
Settings.cron_jobs['ci_project_mirrors_consistency_check_worker']['job_class'] = 'Database::CiProjectMirrorsConsistencyCheckWorker'
+ Settings.cron_jobs['arkose_blocked_users_report_worker'] ||= Settingslogic.new({})
+ Settings.cron_jobs['arkose_blocked_users_report_worker']['cron'] ||= '0 6 * * *'
+ Settings.cron_jobs['arkose_blocked_users_report_worker']['job_class'] = 'Arkose::BlockedUsersReportWorker'
+ Settings.cron_jobs['ci_runners_stale_group_runners_prune_worker_cron'] ||= Settingslogic.new({})
+ Settings.cron_jobs['ci_runners_stale_group_runners_prune_worker_cron']['cron'] ||= '30 * * * *'
+ Settings.cron_jobs['ci_runners_stale_group_runners_prune_worker_cron']['job_class'] = 'Ci::Runners::StaleGroupRunnersPruneCronWorker'
end
#
@@ -864,16 +864,6 @@ Settings.backup['upload']['storage_class'] ||= nil
Settings.backup['gitaly_backup_path'] ||= Gitlab::Utils.which('gitaly-backup')
#
-# Pseudonymizer
-#
-Gitlab.ee do
- Settings['pseudonymizer'] ||= Settingslogic.new({})
- Settings.pseudonymizer['manifest'] = Settings.absolute(Settings.pseudonymizer['manifest'] || Rails.root.join("config/pseudonymizer.yml"))
- Settings.pseudonymizer['upload'] ||= Settingslogic.new({ 'remote_directory' => nil, 'connection' => nil })
- # Settings.pseudonymizer['upload']['multipart_chunk_size'] ||= 104857600
-end
-
-#
# Git
#
Settings['git'] ||= Settingslogic.new({})
@@ -979,15 +969,10 @@ Settings.monitoring.sidekiq_exporter['log_enabled'] ||= false
Settings.monitoring.sidekiq_exporter['address'] ||= 'localhost'
Settings.monitoring.sidekiq_exporter['port'] ||= 8082
-# TODO: Once we split out health checks from SidekiqExporter, we
-# should not let this default to the same settings anymore; we only
-# do this for back-compat currently.
-# https://gitlab.com/gitlab-org/gitlab/-/issues/345804
Settings.monitoring['sidekiq_health_checks'] ||= Settingslogic.new({})
-Settings.monitoring.sidekiq_health_checks['enabled'] ||= Settings.monitoring.sidekiq_exporter['enabled']
-Settings.monitoring.sidekiq_health_checks['log_enabled'] ||= Settings.monitoring.sidekiq_exporter['log_enabled']
-Settings.monitoring.sidekiq_health_checks['address'] ||= Settings.monitoring.sidekiq_exporter['address']
-Settings.monitoring.sidekiq_health_checks['port'] ||= Settings.monitoring.sidekiq_exporter['port']
+Settings.monitoring.sidekiq_health_checks['enabled'] ||= false
+Settings.monitoring.sidekiq_health_checks['address'] ||= 'localhost'
+Settings.monitoring.sidekiq_health_checks['port'] ||= 8092
Settings.monitoring['web_exporter'] ||= Settingslogic.new({})
Settings.monitoring.web_exporter['enabled'] ||= false
diff --git a/config/initializers/7_prometheus_metrics.rb b/config/initializers/7_prometheus_metrics.rb
index 6953de670a7..a8e8bdf2c9f 100644
--- a/config/initializers/7_prometheus_metrics.rb
+++ b/config/initializers/7_prometheus_metrics.rb
@@ -58,24 +58,6 @@ end
# context (i.e. not in the Rails console or rspec) and when users have enabled metrics.
return if Rails.env.test? || !Gitlab::Runtime.application? || !Gitlab::Metrics.prometheus_metrics_enabled?
-if Gitlab::Runtime.sidekiq? && (!ENV['SIDEKIQ_WORKER_ID'] || ENV['SIDEKIQ_WORKER_ID'] == '0')
- # The single worker outside of a sidekiq-cluster, or the first worker (sidekiq_0)
- # in a cluster of processes, is responsible for serving health checks.
- #
- # Do not clean the metrics directory here - the supervisor script should
- # have already taken care of that.
- Sidekiq.configure_server do |config|
- config.on(:startup) do
- # In https://gitlab.com/gitlab-org/gitlab/-/issues/345804 we are looking to
- # only serve health-checks from a worker process; for backwards compatibility
- # we still go through the metrics exporter server, but start to configure it
- # with the new settings keys.
- exporter_settings = Settings.monitoring.sidekiq_health_checks
- Gitlab::Metrics::Exporter::SidekiqExporter.instance(exporter_settings).start
- end
- end
-end
-
Gitlab::Cluster::LifecycleEvents.on_master_start do
Gitlab::Metrics.gauge(:deployments, 'GitLab Version', {}, :max).set({ version: Gitlab::VERSION, revision: Gitlab.revision }, 1)
diff --git a/config/initializers/active_record_lifecycle.rb b/config/initializers/active_record_lifecycle.rb
index 92cc1d81617..73df2b41a04 100644
--- a/config/initializers/active_record_lifecycle.rb
+++ b/config/initializers/active_record_lifecycle.rb
@@ -5,7 +5,9 @@
if defined?(ActiveRecord::Base) && !Gitlab::Runtime.sidekiq?
Gitlab::Cluster::LifecycleEvents.on_worker_start do
ActiveSupport.on_load(:active_record) do
- ActiveRecord::Base.establish_connection # rubocop: disable Database/EstablishConnection
+ # rubocop:disable Database/MultipleDatabases
+ ActiveRecord::Base.establish_connection # rubocop:disable Database/EstablishConnection
+ # rubocop:enable Database/MultipleDatabases
Gitlab::AppLogger.debug("ActiveRecord connection established")
end
@@ -18,8 +20,8 @@ if defined?(ActiveRecord::Base)
# the following is highly recommended for Rails + "preload_app true"
# as there's no need for the master process to hold a connection
- ActiveRecord::Base.connection.disconnect!
+ ActiveRecord::Base.clear_all_connections! # rubocop:disable Database/MultipleDatabases
- Gitlab::AppLogger.debug("ActiveRecord connection disconnected")
+ Gitlab::AppLogger.debug("ActiveRecord connections disconnected")
end
end
diff --git a/config/initializers/active_record_transaction_observer.rb b/config/initializers/active_record_transaction_observer.rb
index b90b3a39ac1..1dc7b55ed5a 100644
--- a/config/initializers/active_record_transaction_observer.rb
+++ b/config/initializers/active_record_transaction_observer.rb
@@ -3,7 +3,7 @@
return unless Gitlab.com? || Gitlab.dev_or_test_env?
Gitlab::Application.configure do
- if Feature.feature_flags_available? && ::Feature.enabled?(:active_record_transactions_tracking, type: :ops, default_enabled: :yaml)
+ if Feature.feature_flags_available? && ::Feature.enabled?(:active_record_transactions_tracking, type: :ops)
Gitlab::Database::Transaction::Observer.register!
end
end
diff --git a/config/initializers/attr_encrypted_no_db_connection.rb b/config/initializers/attr_encrypted_no_db_connection.rb
index 91eef7d0a5c..d9e943bd249 100644
--- a/config/initializers/attr_encrypted_no_db_connection.rb
+++ b/config/initializers/attr_encrypted_no_db_connection.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+raise 'This patch is only tested with attr_encrypted v3.1.0' unless AttrEncrypted::Version.string == '3.1.0'
+
module AttrEncrypted
module Adapters
module ActiveRecord
@@ -11,23 +13,6 @@ module AttrEncrypted
false
end
- # Prevent attr_encrypted from checking out a database connection
- # indefinitely. The result of this method is only used when the former
- # is true, but it is called unconditionally, so there is still value to
- # ensuring the connection is released
- def attribute_instance_methods_as_symbols
- # Use with_connection so the connection doesn't stay pinned to the thread.
- connected = ::ActiveRecord::Base.connection_pool.with_connection(&:active?) rescue false
-
- if connected
- # Call version from AttrEncrypted::Adapters::ActiveRecord
- super
- else
- # Call version from AttrEncrypted, i.e., `super` with regards to AttrEncrypted::Adapters::ActiveRecord
- AttrEncrypted.instance_method(:attribute_instance_methods_as_symbols).bind(self).call
- end
- end
-
protected
# The attr_encrypted gem is not actively maintained
diff --git a/config/initializers/carrierwave_patch.rb b/config/initializers/carrierwave_patch.rb
index a9c74478541..6053154489f 100644
--- a/config/initializers/carrierwave_patch.rb
+++ b/config/initializers/carrierwave_patch.rb
@@ -22,7 +22,7 @@ module CarrierWave
# multithreaded uploads (https://github.com/fog/fog-aws/pull/579).
# Multithreaded uploads are essential for copying large amounts of data
# within the request timeout.
- if ::Feature.enabled?(:s3_multithreaded_uploads, default_enabled: true) && fog_provider == 'AWS'
+ if ::Feature.enabled?(:s3_multithreaded_uploads) && fog_provider == 'AWS'
# AWS SDK uses 10 threads by default and a multipart chunk size of 10 MB
file.concurrency = 10
file.multipart_chunk_size = 10485760
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb
index 3c6606066cd..f7c3f4e98b5 100644
--- a/config/initializers/content_security_policy.rb
+++ b/config/initializers/content_security_policy.rb
@@ -7,8 +7,6 @@ csp_settings['report_only'] = false if csp_settings['report_only'].nil?
csp_settings['directives'] ||= {}
if csp_settings['enabled']
- csp_settings['directives'] = ::Gitlab::ContentSecurityPolicy::ConfigLoader.default_directives if csp_settings['directives'].empty?
-
# See https://guides.rubyonrails.org/security.html#content-security-policy
Rails.application.config.content_security_policy do |policy|
loader = ::Gitlab::ContentSecurityPolicy::ConfigLoader.new(csp_settings['directives'].to_h)
diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb
index 25bf164c96a..7827ad8f168 100644
--- a/config/initializers/doorkeeper.rb
+++ b/config/initializers/doorkeeper.rb
@@ -37,13 +37,6 @@ Doorkeeper.configure do
# Authorization Code expiration time (default 10 minutes).
# authorization_code_expires_in 10.minutes
- # Access token expiration time (default 2 hours).
- # Until 15.0, applications can opt-out of expiring tokens.
- # Removal issue: https://gitlab.com/gitlab-org/gitlab/-/issues/340848
- custom_access_token_expires_in do |context|
- context.client&.expire_access_tokens ? 2.hours : Float::INFINITY
- end
-
# Reuse access token for the same resource owner within an application (disabled by default)
# Rationale: https://github.com/doorkeeper-gem/doorkeeper/issues/383
reuse_access_token
@@ -97,11 +90,10 @@ Doorkeeper.configure do
# strings and the flows they enable are:
#
# "authorization_code" => Authorization Code Grant Flow
- # "implicit" => Implicit Grant Flow
# "password" => Resource Owner Password Credentials Grant Flow
# "client_credentials" => Client Credentials Grant Flow
#
- grant_flows %w(authorization_code implicit password client_credentials)
+ grant_flows %w(authorization_code password client_credentials)
# Under some circumstances you might want to have applications auto-approved,
# so that the user skips the authorization step.
diff --git a/config/initializers/elastic_client_setup.rb b/config/initializers/elastic_client_setup.rb
index 67b5032a2ee..dd68a3f7999 100644
--- a/config/initializers/elastic_client_setup.rb
+++ b/config/initializers/elastic_client_setup.rb
@@ -19,32 +19,6 @@ Gitlab.ee do
Elasticsearch::Model::ClassMethods.prepend GemExtensions::Elasticsearch::Model::Client
Elasticsearch::Model.singleton_class.prepend GemExtensions::Elasticsearch::Model::Client
- # This monkey patch cannot be handled by prepend like the above since this
- # module is included into other classes.
- module Elasticsearch
- module Model
- module Response
- module Base
- if Gem::Version.new(Elasticsearch::Model::VERSION) >= Gem::Version.new('7.0.0')
- raise "elasticsearch-model was upgraded, please remove this monkey patch in #{__FILE__}"
- end
-
- # Handle ES7 API where total is returned as an object. This
- # change is taken from the V7 gem
- # https://github.com/elastic/elasticsearch-rails/commit/9c40f630e1b549f0b7889fe33dcd826b485af6fc
- # and can be removed when we upgrade the gem to V7
- def total
- if response.response['hits']['total'].respond_to?(:keys)
- response.response['hits']['total']['value']
- else
- response.response['hits']['total']
- end
- end
- end
- end
- end
- end
-
### Modified from elasticsearch-model/lib/elasticsearch/model/searching.rb
module Elasticsearch
diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb
index 24040d7b076..2c7034f758d 100644
--- a/config/initializers/omniauth.rb
+++ b/config/initializers/omniauth.rb
@@ -12,7 +12,7 @@ if Gitlab::Auth::Ldap::Config.enabled?
end
OmniAuth.config.full_host =
- if Feature.feature_flags_available? && ::Feature.enabled?(:omniauth_initializer_fullhost_proc, default_enabled: :yaml)
+ if Feature.feature_flags_available? && ::Feature.enabled?(:omniauth_initializer_fullhost_proc)
Gitlab::AppLogger.debug("Using OmniAuth proc initializer")
Gitlab::OmniauthInitializer.full_host
else
diff --git a/config/initializers/request_profiler.rb b/config/initializers/request_profiler.rb
index c368568ec51..7b588ded1ea 100644
--- a/config/initializers/request_profiler.rb
+++ b/config/initializers/request_profiler.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
Rails.application.configure do |config|
- config.middleware.use(Gitlab::RequestProfiler::Middleware)
config.middleware.use(Gitlab::Middleware::Speedscope)
config.middleware.use(Gitlab::Middleware::MemoryReport)
end
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index 25984c45318..29df6da6ef1 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -8,13 +8,13 @@ end
def enable_reliable_fetch?
return true unless Feature::FlipperFeature.table_exists?
- Feature.enabled?(:gitlab_sidekiq_reliable_fetcher, type: :ops, default_enabled: true)
+ Feature.enabled?(:gitlab_sidekiq_reliable_fetcher, type: :ops)
end
def enable_semi_reliable_fetch_mode?
return true unless Feature::FlipperFeature.table_exists?
- Feature.enabled?(:gitlab_sidekiq_enable_semi_reliable_fetcher, type: :ops, default_enabled: true)
+ Feature.enabled?(:gitlab_sidekiq_enable_semi_reliable_fetcher, type: :ops)
end
# Custom Queues configuration
@@ -56,13 +56,24 @@ Sidekiq.configure_server do |config|
config.on :startup do
# Clear any connections that might have been obtained before starting
# Sidekiq (e.g. in an initializer).
- ActiveRecord::Base.clear_all_connections!
+ ActiveRecord::Base.clear_all_connections! # rubocop:disable Database/MultipleDatabases
# Start monitor to track running jobs. By default, cancel job is not enabled
# To cancel job, it requires `SIDEKIQ_MONITOR_WORKER=1` to enable notification channel
Gitlab::SidekiqDaemon::Monitor.instance.start
Gitlab::SidekiqDaemon::MemoryKiller.instance.start if enable_sidekiq_memory_killer && use_sidekiq_daemon_memory_killer
+
+ first_sidekiq_worker = !ENV['SIDEKIQ_WORKER_ID'] || ENV['SIDEKIQ_WORKER_ID'] == '0'
+ health_checks = Settings.monitoring.sidekiq_health_checks
+
+ # Start health-check in-process server
+ if first_sidekiq_worker && health_checks.enabled
+ Gitlab::HealthChecks::Server.instance(
+ address: health_checks.address,
+ port: health_checks.port
+ ).start
+ end
end
if enable_reliable_fetch?
diff --git a/config/initializers/validate_database_config.rb b/config/initializers/validate_database_config.rb
index d5e73cdc1ee..d381dbac2ed 100644
--- a/config/initializers/validate_database_config.rb
+++ b/config/initializers/validate_database_config.rb
@@ -4,12 +4,6 @@ if Gitlab::Utils.to_boolean(ENV['SKIP_DATABASE_CONFIG_VALIDATION'], default: fal
return
end
-if Rails.application.config.uses_legacy_database_config
- warn "WARNING: This installation of GitLab uses a deprecated syntax for 'config/database.yml'. " \
- "The support for this syntax will be removed in 15.0. " \
- "More information can be found here: https://gitlab.com/gitlab-org/gitlab/-/issues/338182"
-end
-
if configurations = ActiveRecord::Base.configurations.configurations
if configurations.first.name != Gitlab::Database::MAIN_DATABASE_NAME
raise "ERROR: This installation of GitLab uses unsupported 'config/database.yml'. " \