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
The Serverless configuration will use the
- Setup infrastructure.
cd ../terraform/
terraform apply --var-file=variables.tfvars
- 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.
cd ../terraform/
terraform apply --var-file=variables.tfvars
- 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
- Setup test lambda.
cd ../test-lambda/
serverless deploy
- Deploy a new version of the lambda.
cd serverless/
serverless deploy
- 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
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.
cd ../serverless/
serverless remove
cd ../terraform/
terraform destroy --var-file=variables.tfvars
cd ../jenkins
docker-compose down