Store jitsu js code on project after initialization
What does this MR do and why?
- In Add interface to create analytics stack for pro... (!95999 - merged) we created an interface by which a GitLab project can initialize the required Jitsu configuration via a service object.
- However, in that MR we didn't pass the generated JS token back to GitLab which will need to be displayed to the user.
- This MR adds a new database column to
Project
and stores the value there.
How to set up and validate locally
-
Set up the devkit and start it running.
docker-compose up
-
In this branch, run
rails c
to open the rails console -
Enable the feature flag
Feature.enable(:cube_api_proxy)
-
Set the required application settings:
The Jitsu attributes are set up when first configuring your jitsu instance.
ApplicationSetting.current.update(jitsu_project_xid: 'XXXXXXXXXX', jitsu_host: 'http://localhost:8000', clickhouse_connection_string: 'http://test:test@clickhouse:8123', jitsu_administrator_email: 'XXXXXXX', jitsu_administrator_password: 'XXXXXXX') reload!
-
Find a project on the console:
project = Project.find(PROJECT_ID)
-
Run
ProductAnalytics::InitializeStackService.new(container: project).execute
-
Ensure that a sidekiq job was enqueued.
-
Check the project and make sure that the Jitsu key has been stored:
project.project_setting.jitsu_key
-
In the Jitsu configurator, ensure that a new API key (with the project ID) has been created, along with a new associated connection to a clickhouse destination.
👇
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
/related #371206 (closed)