You will need the AWS CLI. You can install it via:
brew install awscli
Deployment is done via AWS SAM. You can install it via:
brew install aws-sam-cli --build-from-source
Create a copy of the .env.sample file and rename it .env
Add environment variables to your .env file:
UNIVERSAL_ANALYTICS_GTM_CONTAINER_ID="GTM-XXXXXXX" GOOGLE_ANALYTICS_4_GTM_CONTAINER_ID="GTM-XXXXXXX" GA4_DISABLED="false" UA_DISABLED="true" ANALYTICS_COOKIE_DOMAIN="localhost"
You can run the app in Docker using:
./startup.sh
Please ensure you are using the correct node version locally (Found in Dockerfile)
To build the app
npm install && npm run build
To start the app
npm run build && npm run start
Push your code to GitHub, and run the Deploy dev workflow. This should deploy your code to the dev environment.
To check:
npm run check; # Check all
npm run check:pretty; # Check prettier
npm run check:lint; # Check linting
To fix formatting/linting:
npm run fix; # Fix all
npm run fix:pretty; # Fix prettier
npm run fix:lint; # Fix linting
To setup pre-commit hook
npm run prepare
Deployment relies on several secrets stored in GitHub:
Secret | Description |
---|---|
ARTIFACT_BUCKET_NAME | This is the bucket that the SAM template will be pushed to. |
ECR_REGISTRY | This is the address of the ECR registry. |
GH_ACTIONS_ROLE_ARN | This is the role GitHub actions assumes with permission to push to the artifact bucket (defined by the previsioning pipeline). |
SAM_APP_VALIDATE_ROLE_ARN | This is the role GitHub actions assumes with permission to validate the SAM template (defined by the previsioning pipeline). |
SONAR_TOKEN | This is used to trigger SonarCloud. |