SlideShare a Scribd company logo
A battle tested CI/CD Pipeline
Featuring AWS and Docker
with Jon Christensen
of Kelsus
Gluecon 2018
We were using Heroku or Elastic Beanstalk
Users were the first to notice issues
We had minimal test coverage
We had disorganized logs
We were hackers
This wasn’t going to cut it at scale
• There are too many choices.
• AWS alone adds 5 new features a day.
• So the best way to start CI/CD is
gradually.
• Just like your software itself, CI/CD is
always a work in progress.
I truly believe that one of the best benefits of Docker
is that it forces less experienced developers on
teams to confront head-on some of the things they
don’t know about how computers work and learn
them and incorporate them into their body of
knowledge
"True" continuous deployment requires no manual
intervention or human involvement.
Requires two pillars:
1. Comprehensive, automated integration tests with
broad coverage
2. The ability to rollback quickly (ideally automated) in
case a bad build gets deployed (because your
verification wasn't complete enough)
Dev Test Deploy
Docker Docker Docker
Gitflow Gitflow Gitflow
CircleCI
Volume
Mounts
S3 - KMS
S3 - KMS
AWS ECS
Code
Reviews
AWS ECRUnit Tests
Current CI/CD Tools and Processes
Volume Mounts for Hot Reloads
version:	"2"	
networks:	
		docker-dev:	
				external:	
						name:	dev	
services:	
				api:	
								build:	api/	
								env_file:	.env	
								networks:	
										default:	{}	
										docker-dev:	
												aliases:	
														-	my-restful-service	
								volumes:	
												-	./shared:/var/www/my-restful-service/shared	
								ports:	
												-	"8080:80"	
								links:	
												-	db	
				db:	
								build:	db/	
								env_file:	.env	
								ports:	
												-	"32099:5432"	
								volumes_from:	
												-	data	
				data:	
								image:	postgres	
								restart:	"no"	
								command:	"true"	
								volumes:	
												-	/var/lib/postgresql	
				test:	
								build:	api/	
								environment:	
												APP_ENV:	test	
								command:	"./run_tests_docker.sh"	
								volumes:	
												-	./shared:/var/www/my-restful-service/shared	
								ports:	
												-	"8080:80"	
								links:	
												-	test-db	
				test-db:	
								build:	db/	
								ports:	
												-	5432
		######################	
		#	The	below	container	is	provided		
		#	as	a	developer	convenience.	
		#	It	mounts	the	host	volume	at	the		
		#	project	root	(so	that	both	container	and		
		#	host	are	reading	same	files).	This		
		#	allows	for	hot	reloading	of	code	changes.	
		######################	
		api-dev:	
				build:	api/	
				env_file:	.env	
				volumes:	
						-	.:/var/www/my-restful-service	
				ports:	
						-	"8080:80"	
				links:	
						-	db
Testing has to be a moral mandate
In order to succeed at always
writing tests, the organization as a whole
must treat *not* testing as
unthinkable
Kelsus Git Flow
# Circle CI 2.0 Specification
version: 2
jobs:
build:
# Docker image selected.
docker:
- image: 'kelsus/circleci-node-6.10:1.0'
A walkthrough a CircleCI file
The core thing we do is a build
environment:
# The Service Name must be the same you have
# in your package.json, Dockerfile &
# docker-compose.yml.
SERVICE_NAME: customer-dashboard-server
# Git User Email & Name
GIT_USER_EMAIL: ci@kelsus.com
GIT_USER_NAME: CircleCI
A walkthrough a CircleCI file
Then we set some environment variables
like a GitHub account
steps:
# Checking out the project from the
# repository.
- checkout
- run:
name: Run tests with docker compose.
command: sh ./tests-up.sh
A walkthrough a CircleCI file
Then we checkout code and run tests!
- run:
name: Creating a coverage folder.
command: mkdir -p ./coverage
- run:
name: Copy artifacts from container.
command: docker cp project_test_run_1:/var/www/
$SERVICE_NAME/shared/artifacts/coverage ./coverage
# Prepare Coverage Report on Circle CI
- store_artifacts:
path: ./coverage
destination: coverage
A walkthrough a CircleCI file
Get coverage information and store it
- deploy:
name: Deploy if branch is dev or staging
command: ./deploy/deploy.sh
A walkthrough a CircleCI file
Deploy!
#	When	deployed	to	the	server,	read	the	config	from	the	encrypted	files	on	S3	
if	[[	"$APP_ENV"	==	"development"	||	"$APP_ENV"	==	"staging"	||	"$APP_ENV"	==	"production"	]];	then	
				export	AWS_DEFAULT_REGION=$AWS_REGION	
				S3_CREDENTIALS_BUCKET=$(cat	$CONFIGPATH/package.json	|	jq	"(.kelsus.s3_credentials_bucket)"	—raw-	
output)					
				#	Retrieve	encrypted	credentials	file	from	S3	
				aws	s3	cp	$S3_CREDENTIALS_BUCKET$APP_ENV/$SERVICE_NAME.config	$SERVICE_NAME.config.enc	
				#	Decrypt	
				SERVER_CONFIG_JSON=`aws	kms	decrypt	--ciphertext-blob	fileb://$SERVICE_NAME.config.enc	--query		
Plaintext	--output	text	|	base64	--decode`	
				#	Remove	tmp	file	
				rm	$SERVICE_NAME.config.enc	
					
				if	[	"$CONFIG_INTO_ENV_VARIABLES"	==	"true"	];	then									
								#	Extract	all	entries	in	the	json	and	put	them	on	environment	variables	
								echo	$SERVER_CONFIG_JSON	|	jq	-r	'.config	|	to_entries[]	|	[.key,	.value]	|	@tsv'	>	values.txt	
								while	IFS=$'t'	read	-r	key	value;	do	export	"$key=$value";	done	<	values.txt	
								rm	values.txt									
				else	
								#	Write	the	server	config	file	on	the	config/environment	folder	
								echo	$SERVER_CONFIG_JSON	|	jq	-r	'.config'	>	./dist/config/environment/server.json	
				fi	
fi	
Grabbing secrets from S3
Why ECS?
excerpt from hangops slack
CI/CD is always a work in progress
You’re always about half done
We still need to work on
• Improving database migrations
• Getting off of bash scripts
• Updating how we store secrets
• Look at AWS Code Pipeline
• Better tests — always better tests
Thank you!
— Jon Christensen
Kelsus Inc
www.kelsus.com
www.prodockertraining.com
@jonxtensen

More Related Content

PDF
Exploring Docker in CI/CD
PPTX
How Docker simplifies CI/CD
PDF
Continuous Delivery Pipeline with Docker and Jenkins
PPTX
Continuous Integration With Jenkins Docker SQL Server
PDF
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
PPTX
Next-gen DevOps engineering with Docker and Kubernetes by Antons Kranga
PPT
Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
PDF
calmio-cicd-containers
Exploring Docker in CI/CD
How Docker simplifies CI/CD
Continuous Delivery Pipeline with Docker and Jenkins
Continuous Integration With Jenkins Docker SQL Server
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
Next-gen DevOps engineering with Docker and Kubernetes by Antons Kranga
Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
calmio-cicd-containers

What's hot (20)

PPTX
Docker Indy Meetup - CICD 26-May-2015
PPTX
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-Code
PDF
Testing as a container
PDF
Jenkins & IaC
PDF
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
PPTX
Ci with jenkins docker and mssql belgium
PDF
Testing with Docker
PDF
Continuous Delivery with Jenkins Workflow
PPTX
Continuous Delivery with Jenkins & Kubernetes @ Sky
PDF
2015 05-06-elias weingaertner-docker-intro
PDF
Labels, Labels, Labels
KEY
Make It Cooler: Using Decentralized Version Control
PDF
Git and GitHub for Documentation
PDF
Jenkins vs. AWS CodePipeline (AWS User Group Berlin)
PPTX
CI CD using Docker and Jenkins
PDF
DockerCon SF 2015: Scaling New Services
PPTX
Javaone 2014 - Git & Docker with Jenkins
PPTX
Docker and Selenoid - Make Autotests Great Again
PPTX
Introduction to jenkins
PPTX
An introduction to Atlassian Bitbucket Pipelines
Docker Indy Meetup - CICD 26-May-2015
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-Code
Testing as a container
Jenkins & IaC
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
Ci with jenkins docker and mssql belgium
Testing with Docker
Continuous Delivery with Jenkins Workflow
Continuous Delivery with Jenkins & Kubernetes @ Sky
2015 05-06-elias weingaertner-docker-intro
Labels, Labels, Labels
Make It Cooler: Using Decentralized Version Control
Git and GitHub for Documentation
Jenkins vs. AWS CodePipeline (AWS User Group Berlin)
CI CD using Docker and Jenkins
DockerCon SF 2015: Scaling New Services
Javaone 2014 - Git & Docker with Jenkins
Docker and Selenoid - Make Autotests Great Again
Introduction to jenkins
An introduction to Atlassian Bitbucket Pipelines
Ad

Similar to A battle tested CI/CD Pipeline (20)

PDF
Play Framework + Docker + CircleCI + AWS + EC2 Container Service
PDF
Why so continuous
PDF
Portable CI wGitLab and Github led by Gavin Pickin.pdf
PDF
ContainerDays Boston 2015: "Continuous Delivery with Containers" (Nick Gauthier)
PPTX
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
PDF
The Self-Service Developer - GOTOCon CPH
PDF
Dockercon EU 2014
ODP
Boston Ruby Group - Devops Pipeline
PPT
Docker in the Wild
PPT
Docker in the Wild
PDF
Groovy there's a docker in my application pipeline
PDF
OSMC 2017 | Groovy There is a Docker in my Dashing Pipeline by Kris Buytaert
PPTX
Modern CI/CD in the microservices world with Kubernetes
PDF
Using Docker in CI process
PDF
A Tail of Two Containers: How docker made ci great again
PDF
Containerised Testing at Demonware : PyCon Ireland 2016
PDF
Docker & ci
PDF
ExpoQA 2017 Docker and CI
PPTX
Continuous Integration & Development with Gitlab
PDF
Building a CI/CD Pipeline for PHP apps
Play Framework + Docker + CircleCI + AWS + EC2 Container Service
Why so continuous
Portable CI wGitLab and Github led by Gavin Pickin.pdf
ContainerDays Boston 2015: "Continuous Delivery with Containers" (Nick Gauthier)
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Self-Service Developer - GOTOCon CPH
Dockercon EU 2014
Boston Ruby Group - Devops Pipeline
Docker in the Wild
Docker in the Wild
Groovy there's a docker in my application pipeline
OSMC 2017 | Groovy There is a Docker in my Dashing Pipeline by Kris Buytaert
Modern CI/CD in the microservices world with Kubernetes
Using Docker in CI process
A Tail of Two Containers: How docker made ci great again
Containerised Testing at Demonware : PyCon Ireland 2016
Docker & ci
ExpoQA 2017 Docker and CI
Continuous Integration & Development with Gitlab
Building a CI/CD Pipeline for PHP apps
Ad

Recently uploaded (20)

PPTX
Patient Appointment Booking in Odoo with online payment
PPTX
history of c programming in notes for students .pptx
PDF
Nekopoi APK 2025 free lastest update
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Digital Systems & Binary Numbers (comprehensive )
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Website Design Services for Small Businesses.pdf
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
assetexplorer- product-overview - presentation
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
Patient Appointment Booking in Odoo with online payment
history of c programming in notes for students .pptx
Nekopoi APK 2025 free lastest update
Design an Analysis of Algorithms I-SECS-1021-03
Digital Systems & Binary Numbers (comprehensive )
Why Generative AI is the Future of Content, Code & Creativity?
Website Design Services for Small Businesses.pdf
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
Designing Intelligence for the Shop Floor.pdf
Operating system designcfffgfgggggggvggggggggg
assetexplorer- product-overview - presentation
CHAPTER 2 - PM Management and IT Context
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Advanced SystemCare Ultimate Crack + Portable (2025)
Reimagine Home Health with the Power of Agentic AI​
Adobe Illustrator 28.6 Crack My Vision of Vector Design
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Weekly report ppt - harsh dattuprasad patel.pptx

A battle tested CI/CD Pipeline