Getting started
Install the Statista Remix Stack
Preparation
Read through the documentation and prepare your GitHub repository settings accordingly.
Authenticate with GitHub Package Registry
If you can already download Statista npm packages, you can skip this section.
To access internal npm packages, you need to authenticate with GitHub. Follow these steps:
- Create a personal access token
with the
read:packagesscope. - Run the following command, replacing
<your-github-access-token>with your token:
pnpm config set '//npm.pkg.github.com/:_authToken=<your github access token>'
Create a Remix App Using the Stack
- Create a personal access token using the
CLI or using the
GitHub settings
with the
reposcope. - Run the following command:
pnpx create-remix@2.16.8 your-project --yes --template pit-shared/remix-stack --token 'your-github-personal-access-token'
- Replace
your-projectwith the desired name of your project. - Replace
your-github-personal-access-tokenwith your personal access token.
Central CDN setup
- First, add your origin param configs to the Central CDN. Here is how to do this. Then wait for an approval of the CDN contributors.
AWS environment setup
- Visit the CDK Remix Setup repository and follow the steps in the README.
- You will need to run this shell script once per environment you want to deploy to (usually dev, stage and prod). The script will create the necessary resources in AWS and set up the GitHub OIDC integration. (Make sure to copy the ARN of the role that is created in the output section, you will need it later)
- Switch over to
https://github.com/<org>/<repository>/settings/environmentsand create dev, stage and prod environments - Under the respective environment, scroll down to Environment variables and
create variables for:
AWS_REGIONand puteu-central-1as a valueAWS_GITHUB_OIDC_ROLEand put the formerly copiedARNas a value
- Done!
Monorepo special cases
- If you use a monorepo and want to use this setup for a package, make sure to
make the following adjustments:
- Change the paths to the lock-file in the
scripts/deployment.mtsfile in to target the lock-file in the root of the monorepo - The
deploymentandcdkworkflows for GitHub will also need some adjustments:- For workflow jobs a
working-directoryneeds to be set, e.g.apps/<your-app> - For
onevents a path needs to be set, e.g.paths: [apps/<your-app>/**]
- For workflow jobs a
- Change the paths to the lock-file in the
Troubleshoot
- First setup CDN, then open id connect
- For dev deployments, when your app responses with an error like this
could not load secret at arn:xxxx:secret:dev-env-authorizer/client_encryption_key, take a look at the dev-env-authenticator and how to enable Okta authentication for your AWS account (usage docs)