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 @@
.settings-content
= 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) }
.settings-header
%h4
= _('Meltano ELT Database Cron Job')
= _('Pseudonymizer Cron Job')
%button.btn.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
= _('Enable or disable Meltano ELT Database Cron Job.')
= _('Enable or disable the Pseudonymizer Cron Job.')
.settings-content
= render 'elt_database_cron_job'
= render 'pseudonymizer'
%section.settings.as-email.no-animate#js-email-settings{ class: ('expanded' if expanded) }
.settings-header
......
class GitlabEltDataDumpWorker
class PseudonymizerWorker
include ApplicationWorker
include CronjobQueue
def perform
return unless Gitlab::CurrentSettings.elt_database_dump_enabled
return unless Gitlab::CurrentSettings.pseudonymizer_enabled?
options = Pseudonymity::Options.new(
config: YAML.load_file(Rails.root.join(Gitlab.config.pseudonymizer.manifest)),
......
......@@ -263,7 +263,7 @@ production: &base
# Remove outdated repository archives
repository_archive_cache_worker:
cron: "0 * * * *"
# Verify custom GitLab Pages domains
pages_domain_verification_cron_worker:
cron: "*/15 * * * *"
......@@ -311,6 +311,9 @@ production: &base
geo_migrated_local_files_clean_up_worker:
cron: "15 */6 * * *"
pseudonymizer_worker:
cron: "0 * * * *"
registry:
# enabled: true
# host: registry.example.com
......@@ -726,11 +729,12 @@ production: &base
# # Specifies Amazon S3 storage class to use for backups, this is optional
# # storage_class: 'STANDARD'
## Pseudonym exporter
## Pseudonymizer exporter
pseudonymizer:
enabled: false
# Tables manifest that specifies the fields to extract and pseudonymize.
# TODO: link to meltano configuration?
manifest: config/pseudonymizer.yml
# remote_directory: 'gitlab-elt'
upload:
# Fog storage connection settings, see http://fog.io/storage/ .
connection:
......@@ -739,7 +743,6 @@ production: &base
# aws_access_key_id: AKIAKIAKI
# aws_secret_access_key: 'secret123'
# # 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:
......@@ -892,6 +895,7 @@ test:
backup:
path: tmp/tests/backups
pseudonymizer:
enabled: false
manifest: config/pseudonymizer.test.yml
upload:
# The remote 'directory' to store the CSV files. For S3, this would be the bucket name.
......@@ -900,8 +904,8 @@ test:
connection:
provider: AWS
region: us-east-1
aws_access_key_id: AWS_ACCESS_KEY_ID
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
aws_access_key_id: minio
aws_secret_access_key: gdk-minio
gitlab_shell:
path: tmp/tests/gitlab-shell/
hooks_path: tmp/tests/gitlab-shell/hooks/
......
......@@ -162,7 +162,6 @@ Settings.gitlab['import_sources'] ||= Gitlab::ImportSources.values
Settings.gitlab['trusted_proxies'] ||= []
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['elt_database_dump_enabled'] = false if Settings.gitlab['elt_database_dump_enabled'].nil?
#
# Elasticseacrh
......@@ -479,6 +478,7 @@ Settings.backup['upload']['storage_class'] ||= nil
# Pseudonymizer
#
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['upload'] ||= Settingslogic.new({ 'remote_directory' => nil, 'connection' => nil })
# Settings.pseudonymizer['upload']['multipart_chunk_size'] ||= 104857600
......
......@@ -206,7 +206,7 @@ ActiveRecord::Schema.define(version: 20180612175636) do
t.string "encrypted_external_auth_client_key_pass_iv"
t.string "email_additional_text"
t.boolean "enforce_terms", default: false
t.boolean "elt_database_dump_enabled"
t.boolean "pseudonymizer_enabled"
end
create_table "approvals", force: :cascade do |t|
......@@ -2279,6 +2279,7 @@ ActiveRecord::Schema.define(version: 20180612175636) do
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_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
create_table "releases", force: :cascade do |t|
......
......@@ -35,20 +35,16 @@ module EE
"and the value is encrypted at rest.")
end
def meltano_elt_database_dump_enabled?
return License.feature_available? :meltano_elt_database_dump
def pseudonymizer_description_text
_("GitLab will run the pseudonymizer cron job which will send pseudoanonymized data to be processed and analyzed.")
end
def meltano_elt_description_text
_("GitLab will run the Meltano ELT cron job which will send pseudoanonymized data to be processed and analyzed.")
def pseudonymizer_disabled_description_text
_("The pseudonymizer database cron job is disabled. When enabled the cron job will send pseudoanonymized data to be processed and analyzed.")
end
def meltano_elt_disabled_description_text
_("The Meltano ELT database cron job is disabled. When 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.")
def pseudonymizer_unavailable_description_text
_("The pseudonymizer cron job is disabled. Once enabled, the cron job will send pseudoanonymized data to be processed and analyzed.")
end
override :visible_attributes
......
......@@ -101,21 +101,21 @@ module EE
slack_app_id: nil,
slack_app_secret: nil,
slack_app_verification_token: nil,
elt_database_dump_enabled: Settings.gitlab['elt_database_dump_enabled'],
pseudonymizer_enabled: Settings.pseudonymizer['enabled'],
)
end
end
def elt_database_dump_available?
License.feature_available? :meltano_elt_database_dump
def pseudonymizer_available?
License.feature_available?(:pseudonymizer)
end
def elt_database_dump_can_be_configured?
Settings.gitlab.elt_database_dump_enabled && License.feature_available?(:meltano_elt_database_dump)
def pseudonymizer_can_be_configured?
Settings.pseudonymizer.enabled && pseudonymizer_available?
end
def elt_database_dump_enabled?
elt_database_dump_can_be_configured? && super
def pseudonymizer_enabled?
pseudonymizer_can_be_configured? && super
end
def should_check_namespace_plan?
......
......@@ -30,8 +30,8 @@ class License < ActiveRecord::Base
related_issues
repository_mirrors
repository_size_limit
scoped_issue_board,
meltano_elt_database_dump
scoped_issue_board
pseudonymizer
].freeze
EEP_FEATURES = EES_FEATURES + %i[
......
......@@ -26,6 +26,6 @@ class AddEltDumpEnabledToApplicationSettings < ActiveRecord::Migration
# disable_ddl_transaction!
def change
add_column :application_settings, :elt_database_dump_enabled, :boolean
add_column :application_settings, :pseudonymizer_enabled, :boolean
end
end
......@@ -46,10 +46,6 @@ namespace :gitlab do
desc 'Configures the database by running migrate, or by loading the schema and seeding if needed'
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?
Rake::Task['db:migrate'].invoke
else
......@@ -75,7 +71,13 @@ namespace :gitlab do
end
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(
config: YAML.load_file(Rails.root.join(Gitlab.config.pseudonymizer.manifest)),
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