Commit 97be319f authored by Micaël Bergeron's avatar Micaël Bergeron

reworking the configuration

parent beed849d
= form_for @application_setting, url: admin_application_settings_path, html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting)
%fieldset
.form-group.row
.offset-sm-2.col-sm-10
- is_enabled = @application_setting.elt_database_dump_enabled?
- is_available = @application_setting.elt_database_dump_available?
.form-check
= f.label :elt_database_dump_enabled do
= f.check_box :elt_database_dump_enabled, disabled: !is_available
Enable Meltano Database Cron Job
.form-text.text-muted
- if is_enabled
= meltano_elt_description_text
- else
- if is_available
= meltano_elt_disabled_description_text
- else
= meltano_elt_unavailable_description_text
= f.submit 'Save changes', class: "btn btn-success"
...@@ -237,17 +237,17 @@ ...@@ -237,17 +237,17 @@
.settings-content .settings-content
= render 'usage' = render 'usage'
- if meltano_elt_database_dump_enabled? - if License.feature_available?(:pseudonymizer)
%section.settings.as-usage.no-animate#js-elt-database-dump-settings{ class: ('expanded' if expanded) } %section.settings.as-usage.no-animate#js-elt-database-dump-settings{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
= _('Meltano ELT Database Cron Job') = _('Pseudonymizer Cron Job')
%button.btn.btn-default.js-settings-toggle{ type: 'button' } %button.btn.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand') = expanded ? _('Collapse') : _('Expand')
%p %p
= _('Enable or disable Meltano ELT Database Cron Job.') = _('Enable or disable the Pseudonymizer Cron Job.')
.settings-content .settings-content
= render 'elt_database_cron_job' = render 'pseudonymizer'
%section.settings.as-email.no-animate#js-email-settings{ class: ('expanded' if expanded) } %section.settings.as-email.no-animate#js-email-settings{ class: ('expanded' if expanded) }
.settings-header .settings-header
......
class GitlabEltDataDumpWorker class PseudonymizerWorker
include ApplicationWorker include ApplicationWorker
include CronjobQueue include CronjobQueue
def perform def perform
return unless Gitlab::CurrentSettings.elt_database_dump_enabled return unless Gitlab::CurrentSettings.pseudonymizer_enabled?
options = Pseudonymity::Options.new( options = Pseudonymity::Options.new(
config: YAML.load_file(Rails.root.join(Gitlab.config.pseudonymizer.manifest)), config: YAML.load_file(Rails.root.join(Gitlab.config.pseudonymizer.manifest)),
......
...@@ -263,7 +263,7 @@ production: &base ...@@ -263,7 +263,7 @@ production: &base
# Remove outdated repository archives # Remove outdated repository archives
repository_archive_cache_worker: repository_archive_cache_worker:
cron: "0 * * * *" cron: "0 * * * *"
# Verify custom GitLab Pages domains # Verify custom GitLab Pages domains
pages_domain_verification_cron_worker: pages_domain_verification_cron_worker:
cron: "*/15 * * * *" cron: "*/15 * * * *"
...@@ -311,6 +311,9 @@ production: &base ...@@ -311,6 +311,9 @@ production: &base
geo_migrated_local_files_clean_up_worker: geo_migrated_local_files_clean_up_worker:
cron: "15 */6 * * *" cron: "15 */6 * * *"
pseudonymizer_worker:
cron: "0 * * * *"
registry: registry:
# enabled: true # enabled: true
# host: registry.example.com # host: registry.example.com
...@@ -726,11 +729,12 @@ production: &base ...@@ -726,11 +729,12 @@ production: &base
# # Specifies Amazon S3 storage class to use for backups, this is optional # # Specifies Amazon S3 storage class to use for backups, this is optional
# # storage_class: 'STANDARD' # # storage_class: 'STANDARD'
## Pseudonym exporter ## Pseudonymizer exporter
pseudonymizer: pseudonymizer:
enabled: false
# Tables manifest that specifies the fields to extract and pseudonymize. # Tables manifest that specifies the fields to extract and pseudonymize.
# TODO: link to meltano configuration?
manifest: config/pseudonymizer.yml manifest: config/pseudonymizer.yml
# remote_directory: 'gitlab-elt'
upload: upload:
# Fog storage connection settings, see http://fog.io/storage/ . # Fog storage connection settings, see http://fog.io/storage/ .
connection: connection:
...@@ -739,7 +743,6 @@ production: &base ...@@ -739,7 +743,6 @@ production: &base
# aws_access_key_id: AKIAKIAKI # aws_access_key_id: AKIAKIAKI
# aws_secret_access_key: 'secret123' # aws_secret_access_key: 'secret123'
# # The remote 'directory' to store the CSV files. For S3, this would be the bucket name. # # The remote 'directory' to store the CSV files. For S3, this would be the bucket name.
# remote_directory: 'gitlab-elt'
## GitLab Shell settings ## GitLab Shell settings
gitlab_shell: gitlab_shell:
...@@ -892,6 +895,7 @@ test: ...@@ -892,6 +895,7 @@ test:
backup: backup:
path: tmp/tests/backups path: tmp/tests/backups
pseudonymizer: pseudonymizer:
enabled: false
manifest: config/pseudonymizer.test.yml manifest: config/pseudonymizer.test.yml
upload: upload:
# The remote 'directory' to store the CSV files. For S3, this would be the bucket name. # The remote 'directory' to store the CSV files. For S3, this would be the bucket name.
...@@ -900,8 +904,8 @@ test: ...@@ -900,8 +904,8 @@ test:
connection: connection:
provider: AWS provider: AWS
region: us-east-1 region: us-east-1
aws_access_key_id: AWS_ACCESS_KEY_ID aws_access_key_id: minio
aws_secret_access_key: AWS_SECRET_ACCESS_KEY aws_secret_access_key: gdk-minio
gitlab_shell: gitlab_shell:
path: tmp/tests/gitlab-shell/ path: tmp/tests/gitlab-shell/
hooks_path: tmp/tests/gitlab-shell/hooks/ hooks_path: tmp/tests/gitlab-shell/hooks/
......
...@@ -162,7 +162,6 @@ Settings.gitlab['import_sources'] ||= Gitlab::ImportSources.values ...@@ -162,7 +162,6 @@ Settings.gitlab['import_sources'] ||= Gitlab::ImportSources.values
Settings.gitlab['trusted_proxies'] ||= [] Settings.gitlab['trusted_proxies'] ||= []
Settings.gitlab['no_todos_messages'] ||= YAML.load_file(Rails.root.join('config', 'no_todos_messages.yml')) Settings.gitlab['no_todos_messages'] ||= YAML.load_file(Rails.root.join('config', 'no_todos_messages.yml'))
Settings.gitlab['usage_ping_enabled'] = true if Settings.gitlab['usage_ping_enabled'].nil? Settings.gitlab['usage_ping_enabled'] = true if Settings.gitlab['usage_ping_enabled'].nil?
Settings.gitlab['elt_database_dump_enabled'] = false if Settings.gitlab['elt_database_dump_enabled'].nil?
# #
# Elasticseacrh # Elasticseacrh
...@@ -479,6 +478,7 @@ Settings.backup['upload']['storage_class'] ||= nil ...@@ -479,6 +478,7 @@ Settings.backup['upload']['storage_class'] ||= nil
# Pseudonymizer # Pseudonymizer
# #
Settings['pseudonymizer'] ||= Settingslogic.new({}) Settings['pseudonymizer'] ||= Settingslogic.new({})
Settings.pseudonymizer['enabled'] = false if Settings.pseudonymizer['enabled'].nil?
Settings.pseudonymizer['manifest'] = Settings.pseudonymizer['manifest'] || "lib/pseudonymity/manifest.yml" Settings.pseudonymizer['manifest'] = Settings.pseudonymizer['manifest'] || "lib/pseudonymity/manifest.yml"
Settings.pseudonymizer['upload'] ||= Settingslogic.new({ 'remote_directory' => nil, 'connection' => nil }) Settings.pseudonymizer['upload'] ||= Settingslogic.new({ 'remote_directory' => nil, 'connection' => nil })
# Settings.pseudonymizer['upload']['multipart_chunk_size'] ||= 104857600 # Settings.pseudonymizer['upload']['multipart_chunk_size'] ||= 104857600
......
...@@ -206,7 +206,7 @@ ActiveRecord::Schema.define(version: 20180612175636) do ...@@ -206,7 +206,7 @@ ActiveRecord::Schema.define(version: 20180612175636) do
t.string "encrypted_external_auth_client_key_pass_iv" t.string "encrypted_external_auth_client_key_pass_iv"
t.string "email_additional_text" t.string "email_additional_text"
t.boolean "enforce_terms", default: false t.boolean "enforce_terms", default: false
t.boolean "elt_database_dump_enabled" t.boolean "pseudonymizer_enabled"
end end
create_table "approvals", force: :cascade do |t| create_table "approvals", force: :cascade do |t|
...@@ -2279,6 +2279,7 @@ ActiveRecord::Schema.define(version: 20180612175636) do ...@@ -2279,6 +2279,7 @@ ActiveRecord::Schema.define(version: 20180612175636) do
end end
add_index "redirect_routes", ["path"], name: "index_redirect_routes_on_path", unique: true, using: :btree add_index "redirect_routes", ["path"], name: "index_redirect_routes_on_path", unique: true, using: :btree
add_index "redirect_routes", ["path"], name: "index_redirect_routes_on_path_text_pattern_ops", using: :btree, opclasses: {"path"=>"varchar_pattern_ops"}
add_index "redirect_routes", ["source_type", "source_id"], name: "index_redirect_routes_on_source_type_and_source_id", using: :btree add_index "redirect_routes", ["source_type", "source_id"], name: "index_redirect_routes_on_source_type_and_source_id", using: :btree
create_table "releases", force: :cascade do |t| create_table "releases", force: :cascade do |t|
......
...@@ -35,20 +35,16 @@ module EE ...@@ -35,20 +35,16 @@ module EE
"and the value is encrypted at rest.") "and the value is encrypted at rest.")
end end
def meltano_elt_database_dump_enabled? def pseudonymizer_description_text
return License.feature_available? :meltano_elt_database_dump _("GitLab will run the pseudonymizer cron job which will send pseudoanonymized data to be processed and analyzed.")
end end
def meltano_elt_description_text def pseudonymizer_disabled_description_text
_("GitLab will run the Meltano ELT cron job which will send pseudoanonymized data to be processed and analyzed.") _("The pseudonymizer database cron job is disabled. When enabled the cron job will send pseudoanonymized data to be processed and analyzed.")
end end
def meltano_elt_disabled_description_text def pseudonymizer_unavailable_description_text
_("The Meltano ELT database cron job is disabled. When enabled the cron job will send pseudoanonymized data to be processed and analyzed.") _("The pseudonymizer cron job is disabled. Once enabled, the cron job will send pseudoanonymized data to be processed and analyzed.")
end
def meltano_elt_unavailable_description_text
_("The Meltano ELT database cron job is disabled. Once enabled, the cron job will send pseudoanonymized data to be processed and analyzed.")
end end
override :visible_attributes override :visible_attributes
......
...@@ -101,21 +101,21 @@ module EE ...@@ -101,21 +101,21 @@ module EE
slack_app_id: nil, slack_app_id: nil,
slack_app_secret: nil, slack_app_secret: nil,
slack_app_verification_token: nil, slack_app_verification_token: nil,
elt_database_dump_enabled: Settings.gitlab['elt_database_dump_enabled'], pseudonymizer_enabled: Settings.pseudonymizer['enabled'],
) )
end end
end end
def elt_database_dump_available? def pseudonymizer_available?
License.feature_available? :meltano_elt_database_dump License.feature_available?(:pseudonymizer)
end end
def elt_database_dump_can_be_configured? def pseudonymizer_can_be_configured?
Settings.gitlab.elt_database_dump_enabled && License.feature_available?(:meltano_elt_database_dump) Settings.pseudonymizer.enabled && pseudonymizer_available?
end end
def elt_database_dump_enabled? def pseudonymizer_enabled?
elt_database_dump_can_be_configured? && super pseudonymizer_can_be_configured? && super
end end
def should_check_namespace_plan? def should_check_namespace_plan?
......
...@@ -30,8 +30,8 @@ class License < ActiveRecord::Base ...@@ -30,8 +30,8 @@ class License < ActiveRecord::Base
related_issues related_issues
repository_mirrors repository_mirrors
repository_size_limit repository_size_limit
scoped_issue_board, scoped_issue_board
meltano_elt_database_dump pseudonymizer
].freeze ].freeze
EEP_FEATURES = EES_FEATURES + %i[ EEP_FEATURES = EES_FEATURES + %i[
......
...@@ -26,6 +26,6 @@ class AddEltDumpEnabledToApplicationSettings < ActiveRecord::Migration ...@@ -26,6 +26,6 @@ class AddEltDumpEnabledToApplicationSettings < ActiveRecord::Migration
# disable_ddl_transaction! # disable_ddl_transaction!
def change def change
add_column :application_settings, :elt_database_dump_enabled, :boolean add_column :application_settings, :pseudonymizer_enabled, :boolean
end end
end end
...@@ -46,10 +46,6 @@ namespace :gitlab do ...@@ -46,10 +46,6 @@ namespace :gitlab do
desc 'Configures the database by running migrate, or by loading the schema and seeding if needed' desc 'Configures the database by running migrate, or by loading the schema and seeding if needed'
task configure: :environment do task configure: :environment do
unless License.feature_available? :meltano_elt_database_dump
raise "The Meltano ELT extract is not available with this license."
end
if ActiveRecord::Base.connection.tables.any? if ActiveRecord::Base.connection.tables.any?
Rake::Task['db:migrate'].invoke Rake::Task['db:migrate'].invoke
else else
...@@ -75,7 +71,13 @@ namespace :gitlab do ...@@ -75,7 +71,13 @@ namespace :gitlab do
end end
desc 'Output pseudonymity dump of selected tables' desc 'Output pseudonymity dump of selected tables'
task pseudonymity_dump: :environment do task pseudonymizer: :environment do
unless License.feature_available? :pseudonymizer
raise "The pseudonymizer is not available with this license."
end
abort "Pseudonymizer disabled." unless Gitlab::CurrentSettings.pseudonymizer_enabled?
options = Pseudonymity::Options.new( options = Pseudonymity::Options.new(
config: YAML.load_file(Rails.root.join(Gitlab.config.pseudonymizer.manifest)), config: YAML.load_file(Rails.root.join(Gitlab.config.pseudonymizer.manifest)),
start_at: Time.now.utc start_at: Time.now.utc
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment