SlideShare a Scribd company logo
Continuous deployment
of Rails apps
on AWS OpsWorks
Slovenia Ruby User group meetup Monday, June 23rd,
2014
Text
$ whoami
Tomaลพ Zaman, founder of Codeable, @TomazZaman,
http://zaman.io
Geek, father of four, skydiver
SCRUM FTW!
Sprints (14 days)
Dailys (15 min each
day)
User stories (1:1:1)
Only way to do CI!
Git workflow
Master -> Staging
Master -> Feature
Feature -> Staging
Feature -> Master (pull
request, once feature
done)
Master always deployable!
Gemnasium
One simple task: Report
outdated gems
via email
CodeClimate
Automated code review
HipChat + Emails
Foreman (Uncle Bob,
cleancoders.com)
SOLID + other principles
recommendations on
refactoring
Travis CI
.travis.yml - Instructions how
to build a testing instance,
how to run tests, matrices,โ€ฆ
HipChat webhook
Email web hook
Deploys to staging env.
pings CodeClimate
A bit expensive
Text
AWS OpsWorks
Makinโ€™ it easy to deploy stuff
How it compares to Heroku
A bit more work to get started
more moving parts youโ€™re responsible for
similar pricing
Much more control (with great power comes great responsibility, Peter)
More complex CLI
Same integration with other services
Documentation is overly complex, lacking examples
Having all services under the same roof can be good or bad
Doesnโ€™t enforce 12 factors, but not hard to follow them on your own
Primary elements:
Text
Stacks
A primary entity in OpsWorks, holding all other
like Layers, Apps
Text
Layers
Layer is a โ€œboxโ€ for ordinary EC2 instances that
perform the same role, such as host Rails apps.
Text
Apps
Represent an individual app which is also a
repo on GitHub
Chef
Your worst nightmare.
But itโ€™s awesome!
Written in Ruby, itโ€™s an
โ€œautomation platformโ€
Deployments (how they
work)
A set of instructions to be ran on CLI or Webhook call
All application instances pull application from GitHub
Chef takes over to call deployment hooks (even custom
ones)
Unicorn forks without downtime
If any step of the deployment goes wrong, the old app keeps
being served (again, no downtime!)
deploy/before_restart.rb & co.
Other AWS tools
Amazon RDS
ElastiCache
Route 53
Virtual Cloud
Elastic IPs
Elastic Load Balancers (with
health checking)
S3
Text
Logging
Need to use external service such as Loggly, Papertrail, so
logs need to go into Syslog (not 100% mandatory, but
easier)
Async
Many possibilities to solve
this
OpsWorks doesnโ€™t have a
dedicated Worker layer
Possibility: Custom Chef
recipe
Solution: Rake tasks +
deployment hook
bundle exec rake sidekiq:start
Configuration
Can be tricky, many
possible approaches
Hook into Stack JSON
and create a YML file on
deployment, via
deployment hook
(tutorial: http://zaman.io)
Recap
merge into staging triggers Travis and Gemnasium
Travis runs tests, reports green or red
Travis reports to HipChat, CodeClimate
Manually run deployment rake task which initiates deployment via CLI
OpsWorks pulls latest master on servers in the layer that app is being
deployed to
If no errors, Unicorn forks itself and runs rake tasks that restart async
(Sidekiq) workers
Everything visible on Papertrail
Questions?

More Related Content

PPT
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
ย 
PDF
OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...
ย 
PPTX
CTU June 2011 - C# 5.0 - ASYNC & Await
ย 
PPTX
C# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
ย 
PPTX
Run C++ as serverless with GCP Cloud Functions
PPTX
End to-end async and await
ย 
ODP
JRuby - Everything in a single process
ย 
PDF
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
ย 
OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...
ย 
CTU June 2011 - C# 5.0 - ASYNC & Await
ย 
C# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
ย 
Run C++ as serverless with GCP Cloud Functions
End to-end async and await
ย 
JRuby - Everything in a single process
ย 
The Mysteries Of JavaScript-Fu (RailsConf Ediition)

What's hot (20)

PDF
Super combinators
PDF
gRPC @ Weaveworks
PPT
Asynchronous Programming in C# - Part 1
PPTX
C# 5 deep drive into asynchronous programming
PPTX
Async in .NET
ย 
PPTX
Designing a Docker Stack for Symfony apps: lessons learned
PPTX
Async and Await on the Server
PDF
The Shape of Speed
PPTX
Async Programming in C# 5
PDF
WilmingtonJS - React Native Under the Hood
PDF
Improving your workflow with gulp
PDF
Front-end development automation with Grunt
ย 
PDF
Gulp - the streaming build system
PDF
Simulation in R and Python
PDF
Daniel Steigerwald: EsteJS - javascriptovรฉ aplikace robusnฤ›, modulรกrnฤ› a komf...
ย 
PDF
The Web We Weave :: How Web Developers Think About Performance
PPTX
ITea&Coffee: React best practices
PPSX
Async-await best practices in 10 minutes
PDF
COSCUP 2017 - infrastructure As Code
PDF
Using Async in your Mobile Apps - Marek Safar
ย 
Super combinators
gRPC @ Weaveworks
Asynchronous Programming in C# - Part 1
C# 5 deep drive into asynchronous programming
Async in .NET
ย 
Designing a Docker Stack for Symfony apps: lessons learned
Async and Await on the Server
The Shape of Speed
Async Programming in C# 5
WilmingtonJS - React Native Under the Hood
Improving your workflow with gulp
Front-end development automation with Grunt
ย 
Gulp - the streaming build system
Simulation in R and Python
Daniel Steigerwald: EsteJS - javascriptovรฉ aplikace robusnฤ›, modulรกrnฤ› a komf...
ย 
The Web We Weave :: How Web Developers Think About Performance
ITea&Coffee: React best practices
Async-await best practices in 10 minutes
COSCUP 2017 - infrastructure As Code
Using Async in your Mobile Apps - Marek Safar
ย 
Ad

Similar to Continuous deployment of Rails apps on AWS OpsWorks (20)

PDF
Cannibalising The Google App Engine
PDF
Zepto and the rise of the JavaScript Micro-Frameworks
PPTX
Lessons Learned From Applications That Kicked Titanium's Ass
PPT
Functional Testing Swing Applications with Frankenstein
ODP
Bostonrb Amazon Talk
PDF
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
PDF
Austin Web Architecture
ZIP
Message Queues in Ruby - An Overview
PPT
GWT is Smarter Than You
PPTX
End-to-end CI/CD deployments of containerized applications using AWS services
ODP
EuRuKo JRuby Talk 2008
PDF
Function as a Service
PDF
Real world Webapp
PPT
The 90-Day Startup with Google AppEngine for Java
KEY
Google App Engine Java, Groovy and Gaelyk
PPTX
Why Ruby on Rails rocks from a .net developer eye
KEY
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
PDF
Cloud Computing Bootcamp On The Google App Engine [v1.1]
PDF
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
PPT
Ruby On Google App Engine 2nd Athens Ruby Me
Cannibalising The Google App Engine
Zepto and the rise of the JavaScript Micro-Frameworks
Lessons Learned From Applications That Kicked Titanium's Ass
Functional Testing Swing Applications with Frankenstein
Bostonrb Amazon Talk
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Austin Web Architecture
Message Queues in Ruby - An Overview
GWT is Smarter Than You
End-to-end CI/CD deployments of containerized applications using AWS services
EuRuKo JRuby Talk 2008
Function as a Service
Real world Webapp
The 90-Day Startup with Google AppEngine for Java
Google App Engine Java, Groovy and Gaelyk
Why Ruby on Rails rocks from a .net developer eye
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Cloud Computing Bootcamp On The Google App Engine [v1.1]
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
Ruby On Google App Engine 2nd Athens Ruby Me
Ad

Recently uploaded (20)

PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PDF
Vigrab.top โ€“ Online Tool for Downloading and Converting Social Media Videos a...
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PPTX
artificial intelligence overview of it and more
PPT
Ethics in Information System - Management Information System
PDF
Smart Home Technology for Health Monitoring (www.kiu.ac.ug)
PDF
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
PDF
mera desh ae watn.(a source of motivation and patriotism to the youth of the ...
PPTX
newyork.pptxirantrafgshenepalchinachinane
PPTX
SAP Ariba Sourcing PPT for learning material
PPT
250152213-Excitation-SystemWERRT (1).ppt
PDF
Sims 4 Historia para lo sims 4 para jugar
PPTX
Introduction to cybersecurity and digital nettiquette
PPTX
Database Information System - Management Information System
PPTX
presentation_pfe-universite-molay-seltan.pptx
PDF
๐Ÿ’ฐ ๐”๐Š๐“๐ˆ ๐Š๐„๐Œ๐„๐๐€๐๐†๐€๐ ๐Š๐ˆ๐๐„๐‘๐Ÿ’๐ƒ ๐‡๐€๐‘๐ˆ ๐ˆ๐๐ˆ ๐Ÿ๐ŸŽ๐Ÿ๐Ÿ“ ๐Ÿ’ฐ
ย 
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PPTX
Digital Literacy And Online Safety on internet
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
Vigrab.top โ€“ Online Tool for Downloading and Converting Social Media Videos a...
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
Design_with_Watersergyerge45hrbgre4top (1).ppt
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
artificial intelligence overview of it and more
Ethics in Information System - Management Information System
Smart Home Technology for Health Monitoring (www.kiu.ac.ug)
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
mera desh ae watn.(a source of motivation and patriotism to the youth of the ...
newyork.pptxirantrafgshenepalchinachinane
SAP Ariba Sourcing PPT for learning material
250152213-Excitation-SystemWERRT (1).ppt
Sims 4 Historia para lo sims 4 para jugar
Introduction to cybersecurity and digital nettiquette
Database Information System - Management Information System
presentation_pfe-universite-molay-seltan.pptx
๐Ÿ’ฐ ๐”๐Š๐“๐ˆ ๐Š๐„๐Œ๐„๐๐€๐๐†๐€๐ ๐Š๐ˆ๐๐„๐‘๐Ÿ’๐ƒ ๐‡๐€๐‘๐ˆ ๐ˆ๐๐ˆ ๐Ÿ๐ŸŽ๐Ÿ๐Ÿ“ ๐Ÿ’ฐ
ย 
Module 1 - Cyber Law and Ethics 101.pptx
Digital Literacy And Online Safety on internet

Continuous deployment of Rails apps on AWS OpsWorks

  • 1. Continuous deployment of Rails apps on AWS OpsWorks Slovenia Ruby User group meetup Monday, June 23rd, 2014
  • 2. Text $ whoami Tomaลพ Zaman, founder of Codeable, @TomazZaman, http://zaman.io Geek, father of four, skydiver
  • 3. SCRUM FTW! Sprints (14 days) Dailys (15 min each day) User stories (1:1:1) Only way to do CI!
  • 4. Git workflow Master -> Staging Master -> Feature Feature -> Staging Feature -> Master (pull request, once feature done) Master always deployable!
  • 5. Gemnasium One simple task: Report outdated gems via email
  • 6. CodeClimate Automated code review HipChat + Emails Foreman (Uncle Bob, cleancoders.com) SOLID + other principles recommendations on refactoring
  • 7. Travis CI .travis.yml - Instructions how to build a testing instance, how to run tests, matrices,โ€ฆ HipChat webhook Email web hook Deploys to staging env. pings CodeClimate A bit expensive
  • 8. Text AWS OpsWorks Makinโ€™ it easy to deploy stuff
  • 9. How it compares to Heroku A bit more work to get started more moving parts youโ€™re responsible for similar pricing Much more control (with great power comes great responsibility, Peter) More complex CLI Same integration with other services Documentation is overly complex, lacking examples Having all services under the same roof can be good or bad Doesnโ€™t enforce 12 factors, but not hard to follow them on your own Primary elements:
  • 10. Text Stacks A primary entity in OpsWorks, holding all other like Layers, Apps
  • 11. Text Layers Layer is a โ€œboxโ€ for ordinary EC2 instances that perform the same role, such as host Rails apps.
  • 12. Text Apps Represent an individual app which is also a repo on GitHub
  • 13. Chef Your worst nightmare. But itโ€™s awesome! Written in Ruby, itโ€™s an โ€œautomation platformโ€
  • 14. Deployments (how they work) A set of instructions to be ran on CLI or Webhook call All application instances pull application from GitHub Chef takes over to call deployment hooks (even custom ones) Unicorn forks without downtime If any step of the deployment goes wrong, the old app keeps being served (again, no downtime!) deploy/before_restart.rb & co.
  • 15. Other AWS tools Amazon RDS ElastiCache Route 53 Virtual Cloud Elastic IPs Elastic Load Balancers (with health checking) S3
  • 16. Text Logging Need to use external service such as Loggly, Papertrail, so logs need to go into Syslog (not 100% mandatory, but easier)
  • 17. Async Many possibilities to solve this OpsWorks doesnโ€™t have a dedicated Worker layer Possibility: Custom Chef recipe Solution: Rake tasks + deployment hook bundle exec rake sidekiq:start
  • 18. Configuration Can be tricky, many possible approaches Hook into Stack JSON and create a YML file on deployment, via deployment hook (tutorial: http://zaman.io)
  • 19. Recap merge into staging triggers Travis and Gemnasium Travis runs tests, reports green or red Travis reports to HipChat, CodeClimate Manually run deployment rake task which initiates deployment via CLI OpsWorks pulls latest master on servers in the layer that app is being deployed to If no errors, Unicorn forks itself and runs rake tasks that restart async (Sidekiq) workers Everything visible on Papertrail