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:| Value | Details |
|---|---|
| Hub code (region code, uppercase) | For example DE. See the naming convention. |
| Currency | For example EUR. Confirm with the Finance Team. |
| Display name | For example Germany. |
| Vivenu base URL | Always https://vivenu.com. This SOP only ever references PROD. |
| Vivenu API key | The GKL Platform key from the API Key SOP. |
| HMAC secret | Generate it now, for example via jwtsecretkeygenerator.com. It must be generated here because it is created before the webhooks. The base64 encoded value is later pasted into the webhooks. |
| Teams webhook URL | The incoming webhook URL from the Teams Notification SOP. |
| Operator dashboard URL | Always https://admin.uk.fat-kartingleague.com. The uk is from legacy infrastructure. |
| Base website URL | For example https://events.fat-kartingleague.com/DE. |
| Redirect URLs | Event listing, privacy, terms, ready-to-race, landing page. |
Creating the Migration Script
Open the Migrations folder
In the API repository, go to
GklPlatform.API/DbScripts/Migrations. The migrations are numbered .js MongoDB scripts.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.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).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:
Running the Migration on PROD
Connect to the EC2 desktop and open Studio 3T
Connect to the EC2 desktop, open Studio 3T, and connect to the Mongo instance.
Open the Configurations collection
Open the
GklPlatform_PROD database, then open the Configurations collection.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.Open the new hub's document
Identify the new document whose
_id prefix is your new hub code, for example WEB_ENVIRONMENT_CONFIGURATION_DE.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.
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.