Luna Repository
Cloning the Luna repository requires Gitlab Access, see Getting Setup
Luna is a mono repo, containing the following sections
cli- Luna CLI toolcli-scripts-legacy- one-off CLI scripts and commands that are used to manipulate data within the Luna databasesclients- Luna front-end clients, including the main luna-front-end and Apollo documentation siteinfrastructure- infrastructure-as-code for some of the foundations of the Luna platformpackages- Custom packages to share across the Luna platform, such as Types, Mocks, utils, strings, etc.platform- common repo scripts, CI/CD config, deploy scripts, shared test config, and Docker imagesservices- Luna services, individual services for each domain that make up the Luna platform
GIT process
Luna currently operates a simple branching strategy and GIT process:
- Our production code branch is
main - Environments utilise branches with name formats of
env/{environment}e.g.env/polaris- multiple developers can add their code into the env branch for deployment - Developers working on new functionality will create a feature branch with name format of
<type>/LI-<number>-<short-description>off themainbranch e.gfeature/LI-1234-short-description - Once development work is complete, the developer will open a merge request from their feature branch, back into the
mainbranch - When a feature branch is merged to
main, this kicks off an automated build of the codemainand a deploy to the staging environment - A manual release step is then used to deploy the code on staging to production
- Releases to production are scheduled after all tickets in staging have been tested
Deploying and Testing your code
Follow the below process when deploying your code. These instructions are the same for FE and BE
- Test your work by running
yarn testand check linting by runningyarn lint - Checkout and pull the latest changes from your target
env/*branch (e.g.env/polaris) so you don't override someone else's changes. - Merge the feature branch changes to that
env/*branch. - Push your changes to the
env/*branch, this will trigger a build and deploy to that environment. You can check the status within GitLab. - Once the code is tested and ready to review open a merge request!
Deploy only some modules (DEPLOY_MODULES)
A pipeline on an env/* branch normally runs every module whose files changed. A pipeline started from the GitLab UI or API, or the first push of a new branch, counts every file as changed, so every module deploys at once and in no order. Set the DEPLOY_MODULES pipeline variable to deploy only the modules you name, in the order you choose (the disaster-recovery rebuild of env/sandbox runs one pipeline per wave this way).
DEPLOY_MODULES is a regular expression in slashes, matched against job names. A module's jobs all start with the same prefix, so name the prefixes and end with ::
/^(service-auth|service-andi|client-luna-front-end):/| Module | Job-name prefix |
|---|---|
services/<dir> | service-<dir> (mcp/ is service-mcp-gateway) |
clients/<dir> | client-<dir> |
infrastructure/<dir> | <dir>-infrastructure |
packages/<dir> | package-<dir> |
platform/ (bootstrap and permissions stacks) | platform |
With DEPLOY_MODULES set on an env/* branch:
- Only jobs whose name matches run. They run whatever changed.
- Audits, unit tests and the
teststage are skipped, so a deploy doesn't wait on them. Client secret scans and the infrastructure cfn-lint (which the deploysneeds:) still run. - Jobs pinned to
env/polaris(data, EKS) stay pinned.infrastructure/wafandinfrastructure/backupshave noenv/*deploy.
When DEPLOY_MODULES is unset, or on main and merge request pipelines, the pipeline behaves as normal.
Start a pipeline from Build > Pipelines > Run pipeline, or with the API ($GITLAB_TOKEN needs the api scope):
curl --request POST \
--header "PRIVATE-TOKEN: $GITLAB_TOKEN" \
--header "Content-Type: application/json" \
--data '{"ref": "env/sandbox", "variables": [{"key": "DEPLOY_MODULES", "value": "/^service-auth:/"}]}' \
"https://gitlab.com/api/v4/projects/71835281/pipeline"WARNING
The value must be wrapped in slashes. A plain list such as service-auth,service-andi matches no job, and GitLab refuses to create an empty pipeline.
The rules live in .luna-platform-deploy-modules-rules in platform/ci/platform/anchors.yml.
Running and testing CLI scripts
New commands should be written as commands in the cli (the Luna CLI), not added to cli-scripts-legacy. Run them — and any existing one-off/legacy scripts — through the Luna CLI, which assumes the correct AWS role for the target environment for you.
- Be sure you have set up AWS CLI authentication first.
- New Luna CLI commands run as
luna -e <env> <command> <subcommand>— see the Luna CLI README. - Existing one-off/legacy scripts in
cli-scripts-legacyyou can run them through the Luna CLI vialuna script run. See Luna CLI - Check your node version with
node -vand make sure you are on version 24 or higher.
NOTE: The Developer role cannot merge MRs so a Maintainer from the team will approve and merge
