Intro to CI/CD π» βοΈ
TLDR; This repository is a sample project demonstrating a basic continuous integration (CI) / continuous deployment (CD) setup. This project is in READ ONLY mode.
:warning: Fork this repository in order to use it! If you're following along the videos and trying to run the workflows here, they will not work.
Course attachement
This repository is best consumed while or after following the course attachment π
Project structure
# You can generate this tree with:
# $ tree -a -I '.git|assets|.github|venv|node_modules|images|.DS_Store|*.tfvars|.terraform'
.
βββ .gitignore
βββ CODEOWNERS
βββ LICENSE
βββ README.md
βββ infra
βΒ Β βββ README.md
βΒ Β βββ instances
βΒ Β βββ production
βΒ Β βΒ Β βββ .terraform.lock.hcl
βΒ Β βΒ Β βββ main.tf
βΒ Β βΒ Β βββ terraform.auto.tfvars.example
βΒ Β βββ staging
βΒ Β βββ .terraform.lock.hcl
βΒ Β βββ create_staging_resource.sh
βΒ Β βββ extra_staging.tf.example
βΒ Β βββ main.tf
βΒ Β βββ terraform.tfvars.auto.example
βββ web
βββ README.md
βββ app.js
βββ bin
βΒ Β βββ www
βββ package-lock.json
βββ package.json
βββ public
βΒ Β βββ javascripts
βΒ Β βββ stylesheets
βΒ Β βββ style.css
βββ routes
βΒ Β βββ index.js
βΒ Β βββ users.js
βββ tests
βΒ Β βββ app.test.js
βΒ Β βββ routes.test.js
βββ views
βββ error.jade
βββ index.jade
βββ layout.jade
12 directories, 26 files
infra/images: contains Packer template to build our AWS EC2 AMIinfra/instances: contains our Terraform templates to setup ourstagingandproductionEC2 instancesweb: contains our simple Express web application
Setup
Configure your GitHub repository to run the workflows
Click to expand
-
Navigate to the
Settingsin your repository then toEnvironments
-
Add a new environment and call it
staging(or anything else you like)
-
Enable required reviewers and add your secrets

-
Enable branch protection on the
mainbranch

Test your setup
- Create a new branch from the
mainbranch and make some changes to the app - Push the new branch to GitHub
- Watch the CI workflow being triggered
- Troubleshoot issues as they rise
