Fire Starter is a Github template repository that you can use it to take a website running locally on your machine and deploy it to the cloud using Docker, GitHub Actions, and AWS App Runner.
Please feel free to open an issue if you have any questions or issues.
I built Fire Starter for a talk I gave at the 2022 Grace Hopper Celebration (GHC22). Here are the slides from my talk:
- A developer can trigger different GitHub Actions workflows by pushing a commit or merging to a certain branch.
- These workflows are in
./github/workflows/
.
- These workflows are in
- The GitHub Actions workflows do the following tasks automatically when triggered:
- Use AWS CloudFormation to create cloud infrastructure resources for the website in AWS
- Build and upload Docker container images of the website into AWS Elastic Container Registry (ECR)
- Set up AWS App Runner to pull the most recent Docker image for the website from ECR
- Create App Runner instances running the website ready to receive live traffic
To get started, copy this template repository to create a new repository by clicking "Use this template" on the GitHub home page of this repository.
To create and run your website, you will need npm
and node 16
installed.
Then in the directory where your code is downloaded, run:
cd example-react-app/
npm run start
Go to localhost:3000 and your website will be running.
To use Docker, you will need Docker installed. To run your website out of a Docker container, run:
docker build -t fire-starter .
docker run -p 3000:3000 fire-starter
Go to localhost:3000 and your website will be running.
Several of the GitHub Actions workflows will run automatically if you make a new commit to your repo.
These include "Run Tests" (./github/workflows/test.yaml
) and "Build Image" (./github/workflows/build.yaml
).
Go to the Actions
tab in the GitHub UI to explore actions.
To run the other workflows, follow the steps in the Deploy
section below.
To deploy your website, you will need to create an AWS account.
Note: Some of the AWS infrastructure for this website will cost money to run, so please be aware.
After creating your AWS account, you will need to set up your AWS credentials to authorize GitHub Actions.
- Go to the AWS console and create a stack
in CloudFormation using this template:
./cloudformation/github_iam_role.yaml
. This will create an IAM role for you to use. - Copy the ARN of the
github-user-role
IAM role you created. - Create a secret in GitHub Actions and call it
AWS_GITHUB_ROLE_ARN
and enter the value of the arn from step 2. - Run the "Deploy CloudFormation" action (
/.github/workflows/deploy_cloudformation.yaml
). This will set up AWS infrastructure for ECR and App Runner and create another IAM role. - Copy the arn of the
app-runner-service-role
IAM role you created. - Create a secret in GitHub Actions and call it
AWS_APP_RUNNER_ROLE_ARN
and enter the value of the arn from step 5.
Now you are ready to deploy your site.
- Run the "Build and Deploy" action (
/.github/workflows/build_and_deploy.yaml
). This will deploy your website using App Runner. - Go to the AWS console and go to the App Runner service. You will see a service called
fire-starter-service
. It should have a default domain attached to it. - Click on the default domain and you should see your website running!
- React by React
- What are containers? by Google Cloud
- What is a container? by Docker
- Well-Architected Framework by AWS
- What is AWS App Runner? by AWS
- 7 Places to host your Jamstack site by Pluralsight
- AWS CloudFormation Concepts by AWS
- What is CI/CD? by GitLab
- What is GitHub Actions? by GitHub
- An Illustrated Guide to OAuth and OpenID Connect by Okta