Skip to content

Latest commit

 

History

History
103 lines (70 loc) · 2.13 KB

README.md

File metadata and controls

103 lines (70 loc) · 2.13 KB

This project provides the following resources:

  • AWS lambda deployed with serverless that runs a container

  • Codedeploy app for blue-green deployment

  • Nodejs lambda which runs tests

Installation

The Serverless configuration will use the

  1. Setup infrastructure.
cd ../terraform/
terraform apply --var-file=variables.tfvars
  1. Create lambda and alias with serverless (note this only works with Serverless 1.6.4).

An alias is a pointer to a function version.

THis command will setup the main lambda and will link it to the Api Gateway, it will deploy the test lambda and will trigger the CodeDeploy app. which will perform blue-green deployment on each new release.

Installation with alias plugin (do not use it, it has bugs)

cd ../terraform/
terraform apply --var-file=variables.tfvars
  1. Create lambda and alias with serverless (note this only works with Serverless 1.6.4).

An alias is a pointer to a function version.

cd serverless/
serverless deploy --masterAlias=alias1
cd serverless/
serverless deploy 
  1. Setup test lambda.
cd ../test-lambda/
serverless deploy
  1. Deploy a new version of the lambda.
cd serverless/
serverless deploy 
  1. Update deployment-file.json with lambda versions and launch deployment (manually).
cd ../terraform/
aws --region=us-east-1 deploy create-deployment --cli-input-json file://deployment-file.json

Install Jenkins for CICD

During first installation read logs to find first password.

cd ../jenkins
docker-compose up -d 

6.1 Login to Jenkins, add credentials and create a new pipeline. 6.2 Link the pipeline to this repo and to the Jenkinsfile into the jenkins folder. 6.3 Compile the pipeline.

Authentication

Authentication with Cognito

Clean

cd ../serverless/
serverless remove
cd ../terraform/
terraform destroy --var-file=variables.tfvars
cd ../jenkins
docker-compose down 

References