Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
fbe18998
Commit
fbe18998
authored
May 31, 2018
by
Jacob Schatz
Committed by
Micaël Bergeron
Jun 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add settings page for enabling gitlab elt database dump.
parent
e461650f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
92 additions
and
5 deletions
+92
-5
app/views/admin/application_settings/_elt_database_cron_job.html.haml
...min/application_settings/_elt_database_cron_job.html.haml
+19
-0
app/views/admin/application_settings/show.html.haml
app/views/admin/application_settings/show.html.haml
+11
-0
app/workers/gitlab_elt_data_dump_worker.rb
app/workers/gitlab_elt_data_dump_worker.rb
+10
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+5
-0
db/schema.rb
db/schema.rb
+4
-1
ee/app/helpers/ee/application_settings_helper.rb
ee/app/helpers/ee/application_settings_helper.rb
+2
-1
ee/app/models/ee/application_setting.rb
ee/app/models/ee/application_setting.rb
+10
-1
ee/db/migrate/20180531221734_add_elt_dump_enabled_to_application_settings.rb
...531221734_add_elt_dump_enabled_to_application_settings.rb
+31
-0
ee/spec/lib/gitlab/pseudonymity_spec.rb
ee/spec/lib/gitlab/pseudonymity_spec.rb
+0
-2
No files found.
app/views/admin/application_settings/_elt_database_cron_job.html.haml
0 → 100644
View file @
fbe18998
=
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
-
can_be_configured
=
@application_setting
.
elt_database_dump_can_be_configured?
.form-check
=
f
.
label
:elt_database_dump_enabled
do
=
f
.
check_box
:elt_database_dump_enabled
,
disabled:
!
can_be_configured
Enable ELT Database Cron Job
.form-text.text-muted
-
if
can_be_configured
GitLab will run a cron job which will send pseudoanonymized data to be processed and analyzed.
-
else
The ELT database cron job is disabled. When enabled the cron job will send pseudoanonymized data to be processed and analyzed.
=
f
.
submit
'Save changes'
,
class:
"btn btn-success"
app/views/admin/application_settings/show.html.haml
View file @
fbe18998
...
...
@@ -237,6 +237,17 @@
.settings-content
=
render
'usage'
%section
.settings.as-usage.no-animate
#js-elt-database-dump-settings
{
class:
(
'expanded'
if
expanded
)
}
.settings-header
%h4
=
_
(
'ELT Database Cron Job'
)
%button
.btn.btn-default.js-settings-toggle
{
type:
'button'
}
=
expanded
?
_
(
'Collapse'
)
:
_
(
'Expand'
)
%p
=
_
(
'Enable or disable ELT Database Cron Job.'
)
.settings-content
=
render
'elt_database_cron_job'
%section
.settings.as-email.no-animate
#js-email-settings
{
class:
(
'expanded'
if
expanded
)
}
.settings-header
%h4
...
...
app/workers/gitlab_elt_data_dump_worker.rb
0 → 100644
View file @
fbe18998
class
GitlabELTDataDumpWorker
include
ApplicationWorker
include
CronjobQueue
def
perform
return
unless
Gitlab
::
CurrentSettings
.
elt_database_dump_enabled
Pseudonymity
::
Table
.
new
.
tables_to_csv
end
end
config/initializers/1_settings.rb
View file @
fbe18998
...
...
@@ -162,6 +162,7 @@ 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'
]
=
true
if
Settings
.
gitlab
[
'elt_database_dump_enabled'
].
nil?
#
# Elasticseacrh
...
...
@@ -370,6 +371,10 @@ Settings.cron_jobs['gitlab_usage_ping_worker'] ||= Settingslogic.new({})
Settings
.
cron_jobs
[
'gitlab_usage_ping_worker'
][
'cron'
]
||=
Settings
.
__send__
(
:cron_for_usage_ping
)
Settings
.
cron_jobs
[
'gitlab_usage_ping_worker'
][
'job_class'
]
=
'GitlabUsagePingWorker'
Settings
.
cron_jobs
[
'gitlab_elt_database_dump'
]
||=
Settingslogic
.
new
({})
Settings
.
cron_jobs
[
'gitlab_elt_database_dump'
][
'cron'
]
||=
'0 23 * * *'
;
Settings
.
cron_jobs
[
'gitlab_elt_database_dump'
][
'job_class'
]
||=
'GitlabELTDataDumpWorker'
;
Settings
.
cron_jobs
[
'schedule_update_user_activity_worker'
]
||=
Settingslogic
.
new
({})
Settings
.
cron_jobs
[
'schedule_update_user_activity_worker'
][
'cron'
]
||=
'30 0 * * *'
Settings
.
cron_jobs
[
'schedule_update_user_activity_worker'
][
'job_class'
]
=
'ScheduleUpdateUserActivityWorker'
...
...
db/schema.rb
View file @
fbe18998
...
...
@@ -206,6 +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"
end
create_table
"approvals"
,
force: :cascade
do
|
t
|
...
...
@@ -1631,6 +1632,7 @@ ActiveRecord::Schema.define(version: 20180612175636) do
t
.
text
"title_html"
t
.
text
"description_html"
t
.
integer
"time_estimate"
t
.
boolean
"squash"
,
default:
false
,
null:
false
t
.
integer
"cached_markdown_version"
t
.
datetime
"last_edited_at"
t
.
integer
"last_edited_by_id"
...
...
@@ -2020,9 +2022,9 @@ ActiveRecord::Schema.define(version: 20180612175636) do
t
.
datetime
"next_execution_timestamp"
t
.
string
"status"
t
.
string
"jid"
t
.
text
"last_error"
t
.
datetime_with_timezone
"last_update_at"
t
.
datetime_with_timezone
"last_successful_update_at"
t
.
text
"last_error"
end
add_index
"project_mirror_data"
,
[
"jid"
],
name:
"index_project_mirror_data_on_jid"
,
using: :btree
...
...
@@ -2277,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
|
...
...
ee/app/helpers/ee/application_settings_helper.rb
View file @
fbe18998
...
...
@@ -55,7 +55,8 @@ module EE
:slack_app_id
,
:slack_app_secret
,
:slack_app_verification_token
,
:allow_group_owners_to_manage_ldap
:allow_group_owners_to_manage_ldap
,
:elt_database_dump_enabled
]
end
...
...
ee/app/models/ee/application_setting.rb
View file @
fbe18998
...
...
@@ -100,11 +100,20 @@ module EE
slack_app_enabled:
false
,
slack_app_id:
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'
],
)
end
end
def
elt_database_dump_can_be_configured?
Settings
.
gitlab
.
elt_database_dump_enabled
end
def
elt_database_dump_enabled
elt_database_dump_can_be_configured?
&&
super
end
def
should_check_namespace_plan?
check_namespace_plan?
&&
(
Rails
.
env
.
test?
||
::
Gitlab
.
dev_env_or_com?
)
end
...
...
ee/db/migrate/20180531221734_add_elt_dump_enabled_to_application_settings.rb
0 → 100644
View file @
fbe18998
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
AddEltDumpEnabledToApplicationSettings
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
# When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the
# migration requires downtime.
# DOWNTIME_REASON = ''
# When using the methods "add_concurrent_index", "remove_concurrent_index" or
# "add_column_with_default" you must disable the use of transactions
# as these methods can not run in an existing transaction.
# When using "add_concurrent_index" or "remove_concurrent_index" methods make sure
# that either of them is the _only_ method called in the migration,
# any other changes should go in a separate migration.
# This ensures that upon failure _only_ the index creation or removing fails
# and can be retried or reverted easily.
#
# To disable transactions uncomment the following line and remove these
# comments:
# disable_ddl_transaction!
def
change
add_column
:application_settings
,
:elt_database_dump_enabled
,
:boolean
end
end
ee/spec/lib/gitlab/pseudonymity_spec.rb
View file @
fbe18998
...
...
@@ -26,8 +26,6 @@ describe Gitlab::Pseudonymity do
project_table_file
=
pseudo
.
tables_to_csv
[
0
]
# Ignore the `.` and `..` in the directory.
entry
=
Dir
.
entries
(
base_dir
)[
2
]
expect
(
project_table_file
.
include?
"projects_"
).
to
be
true
expect
(
project_table_file
.
include?
".csv"
).
to
be
true
columns
=
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment