SlideShare a Scribd company logo
1 of 18
Download to read offline
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

What's hot

DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and ComposeDockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
Docker, Inc.
 
DockerCon SF 2015: Scaling New Services
DockerCon SF 2015: Scaling New ServicesDockerCon SF 2015: Scaling New Services
DockerCon SF 2015: Scaling New Services
Docker, Inc.
 
Docker and Selenoid - Make Autotests Great Again
Docker and Selenoid - Make Autotests Great Again Docker and Selenoid - Make Autotests Great Again
Docker and Selenoid - Make Autotests Great Again
COMAQA.BY
 

What's hot (20)

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

Similar to A battle tested CI/CD Pipeline

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

DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
 
How (and why) to roll your own Docker SaaS
How (and why) to roll your own Docker SaaSHow (and why) to roll your own Docker SaaS
How (and why) to roll your own Docker SaaS
 
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
 
DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2
 
Common primitives in Docker environments
Common primitives in Docker environmentsCommon primitives in Docker environments
Common primitives in Docker environments
 
ContainerDayVietnam2016: Dockerize a small business
ContainerDayVietnam2016: Dockerize a small businessContainerDayVietnam2016: Dockerize a small business
ContainerDayVietnam2016: Dockerize a small business
 
Continuous Delivery with Docker and Amazon ECS
Continuous Delivery with Docker and Amazon ECSContinuous Delivery with Docker and Amazon ECS
Continuous Delivery with Docker and Amazon ECS
 
Setting up CI/CD pipeline with Kubernetes and Kublr step-by-step
Setting up CI/CD pipeline with Kubernetes and Kublr step-by-stepSetting up CI/CD pipeline with Kubernetes and Kublr step-by-step
Setting up CI/CD pipeline with Kubernetes and Kublr step-by-step
 
Setting up CI/CD Pipeline with Kubernetes and Kublr step by-step
Setting up CI/CD Pipeline with Kubernetes and Kublr step by-stepSetting up CI/CD Pipeline with Kubernetes and Kublr step by-step
Setting up CI/CD Pipeline with Kubernetes and Kublr step by-step
 
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
 
Container on azure
Container on azureContainer on azure
Container on azure
 
Tech Talk: DevOps at LeanIX @ Startup Camp Berlin
Tech Talk: DevOps at LeanIX @ Startup Camp BerlinTech Talk: DevOps at LeanIX @ Startup Camp Berlin
Tech Talk: DevOps at LeanIX @ Startup Camp Berlin
 
R meetup 20161011v2
R meetup 20161011v2R meetup 20161011v2
R meetup 20161011v2
 
HOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLDHOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLD
 
Gradle - From minutes to seconds: minimizing build times
Gradle - From minutes to seconds: minimizing build timesGradle - From minutes to seconds: minimizing build times
Gradle - From minutes to seconds: minimizing build times
 
Going Production with Docker and Swarm
Going Production with Docker and SwarmGoing Production with Docker and Swarm
Going Production with Docker and Swarm
 
Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker a...
Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker a...Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker a...
Continuos Integration and Delivery: from Zero to Hero with TeamCity, Docker a...
 
Mihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate EverythingMihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate Everything
 
Docker meetup Mountain View - Bernstein
Docker meetup Mountain View - BernsteinDocker meetup Mountain View - Bernstein
Docker meetup Mountain View - Bernstein
 
Continuous Integration & Development with Gitlab
Continuous Integration & Development with GitlabContinuous Integration & Development with Gitlab
Continuous Integration & Development with Gitlab
 

Recently uploaded

Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
drm1699
 

Recently uploaded (20)

Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit MilanWorkshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
 
Transformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksTransformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with Links
 
Rapidoform for Modern Form Building and Insights
Rapidoform for Modern Form Building and InsightsRapidoform for Modern Form Building and Insights
Rapidoform for Modern Form Building and Insights
 
Workshop - Architecting Innovative Graph Applications- GraphSummit Milan
Workshop -  Architecting Innovative Graph Applications- GraphSummit MilanWorkshop -  Architecting Innovative Graph Applications- GraphSummit Milan
Workshop - Architecting Innovative Graph Applications- GraphSummit Milan
 
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
 
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
 
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4jGraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
 
Effective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeConEffective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeCon
 
Novo Nordisk: When Knowledge Graphs meet LLMs
Novo Nordisk: When Knowledge Graphs meet LLMsNovo Nordisk: When Knowledge Graphs meet LLMs
Novo Nordisk: When Knowledge Graphs meet LLMs
 
Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?
 
Abortion Clinic In Pongola ](+27832195400*)[ 🏥 Safe Abortion Pills In Pongola...
Abortion Clinic In Pongola ](+27832195400*)[ 🏥 Safe Abortion Pills In Pongola...Abortion Clinic In Pongola ](+27832195400*)[ 🏥 Safe Abortion Pills In Pongola...
Abortion Clinic In Pongola ](+27832195400*)[ 🏥 Safe Abortion Pills In Pongola...
 
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
 
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
 
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
 
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
 
Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024
 
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
 
Microsoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMicrosoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdf
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea Goulet
 
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaUNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
 

A battle tested CI/CD Pipeline