Code Monkey home page Code Monkey logo

week-16's Introduction

Week 16 lab

Lint and test and deploy

Week 16 Lab exercises on CI and CD. Using Github actions

This is a rudimentary Express.js based website. Your job is to get the CI fully setup and also the CD to get it deployed to AWS. Make a change and see it re-deployed

Project structure

# main project directories
.
├── app
│   ├── app.js                # main application entrypoint
│   ├── lib                   # our hello greetings library
│   ├── routes                # HTTP route logic contained here
│   └── views                 # HTML templates stored here
├── infra
│   ├── deploy.sh             # main cloudformation launch script placeholder
│   └── ec2-user-data.sh      # script to pre-configure your ec2 instance
├── README.md                 # This doc

Development

# running locally, sits on port 3000 by default
(cd app && DEBUG=* PORT=3000 npm start)
# to test
curl http://localhost:3000/\?language\=gurmukhi
# or launch in browser
firefox http://localhost:3000/?language=gurmukhi

# unit testing
(cd app && npm test)

# linting
(cd app && npm run lint)

# security audit
(cd app && npm aduit)

Your mission

  1. Fork the repo
  2. Get it working locally
  3. implement the missing steps in .github/workflows/main.yaml
    1. Add supply chain scanning and fix any issues
    2. Add unit testing
  4. Create base infra as per two objectives and target arch below
  5. Get infra scripts and continious deployment working by implementing /infra/deploy.sh
  6. Implement the /about page and watch it deploy end-to-end

target AWS arch

Objective 1 - get base infra working - get networking and CI working

  • Create VPC: 10.0.0.0/22
  • Get Github actions to deploy your IaC
  • Create Pub subnet:
    • a: 10.0.0.0/24
  • Create Pvt Subnets:
    • a: 10.0.2.0/24
  • Create IGW
  • Create Public Route Table
  • Create NAT gateway
  • Create Private Route Table

Objective 2 - create secondary infra

  • Clickops a t3.micro instance in a public subnet with port 22,80,8080 open and ssh in
    • Use the infra/ec2-user-data.sh script to get your application working on there
    • ssh ec2-user@<instance-public-ip>
  • Delete that instance and script a t3.micro instance into the private subnet
  • script a Network load balancer (NLB)
  • Connect load balancer to instance
  • Test application via load-balancer

Stick your AWS secrets here

Links

week-16's People

Contributors

jabbasec avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.