Overview
A new hub region is added to the GKL Platform through a MongoDB migration. You write a new migration script in the API repository based on a previous one, commit it, then run it against the production database via Studio 3T on the EC2 desktop. Finally you adjust the new region’s web environment configuration and the go-live flags. The migration does two things:- Pushes a new entry into the
REGION_CONFIGURATIONdocument with the new hub’s settings. - Copies an existing hub’s other configuration documents (such as its
WEB_ENVIRONMENT_CONFIGURATION) and re-inserts them with the new hub code in the_id.
WEB_ENVIRONMENT_CONFIGURATION document to set the correct values for the new hub.
Prerequisites
Gather the following values before starting. They populate the new region entry and the web environment configuration:Creating the Migration Script
1
Open the Migrations folder
In the API repository, go to
GklPlatform.API/DbScripts/Migrations. The migrations are numbered .js MongoDB scripts.2
Copy the most recent add-hub migration
Copy the latest add-hub migration (for example
033_add_germany_hub.js) to a new file, incrementing the number prefix and naming it for the new hub, for example 034_add_<hub>_hub.js.3
Change the parameters for the new hub
Update the values in the Leave
REGION_CONFIGURATION push to match the new hub. Only the parameters change, the logic stays the same:isActive and showOnWebsite as false for now. They are switched on later (see Go-live flags).4
Check the copy block
The second block of the script finds an existing hub’s documents and re-inserts them with the new hub code. Make sure it copies from a suitable source hub and writes to the new code, for example:You can change individual values in the copied documents later, for example the currency in the
WEB_ENVIRONMENT_CONFIGURATION document and the event types.5
Commit and push
Save the new migration, then commit and push it to the repository.
Running the Migration on PROD
1
Copy the migration script
Copy the full contents of your new migration script.
2
Connect to the EC2 desktop and open Studio 3T
Connect to the EC2 desktop, open Studio 3T, and connect to the Mongo instance.
3
Open the Configurations collection
Open the
GklPlatform_PROD database, then open the Configurations collection.4
Paste and run the migration
Paste the migration into the shell for the
Configurations collection and run it. Confirm any DEV values have been changed to PROD before running.Editing the New Region Web Environment Configuration
Because the copy block duplicated an existing hub’s documents, the new region’s web environment configuration still holds the source hub’s values. Update it for the new hub.1
Find the web environment documents
In the
Configurations collection, run a find on _id: /WEB_ENV/.2
Open the new hub's document
Identify the new document whose
_id prefix is your new hub code, for example WEB_ENVIRONMENT_CONFIGURATION_DE.3
Set the currency and other parameters
Edit that document to set the currency and the other hub-specific parameters, such as the redirect URLs (
eventListingRedirect, privacyRedirect, termsRedirect, r2rExplanationRedirect, landingPageRedirect). Compare against an existing live hub’s WEB_ENVIRONMENT_CONFIGURATION document to see which values are region-specific.Go-live Flags
Two flags on the new region entry control when the hub becomes active. Both start asfalse.
1
Set isActive to true
Set
"isActive": true when you are ready to start ingesting via the Vivenu webhook and want to see the hub on the operational dashboard.2
Set showOnWebsite to true
Set
"showOnWebsite": true when making a test payment before release, or when the deployment team is ready to release the website to the public.