Don't stop Deploying


Your Host this Afternoon

Alex Fernández

Software developer with 15+ years experience
Currently at MediaSmart Mobile
Shameless tinkerer since forever
@pinchito, alexfernandez, alejandrofer


Who automatizes the automatizer?


types of Tests

Unit tests

Integration tests / system tests

Load tests

Automatic tests — are the bests!

Better than the rests!


Design a control API

Start and stop the system using the API

Self-contained tests: clean-up

Three basic rules:

  • One single button
  • Fail fast and loudly
  • No human intervention

Make your life easier

Make your systems easy to test

Practical Session 1

Clone node.js project addPath

git clone

Verify integration tests

Break tests and see what happens, then fix them

Tech Spec

Web service on port 12322

Adds two numbers in the path

URL: /1/2, returns 3

\=> 3

MIME type: text/plain

If any of the values is not a number, use 0


Unit test

Integration test

Load test

Added to test.js

Run as npm test



Oh yeah baby

Integration Environment

Between Development and Production

Also called: preproduction, replica, build env

Enough data to run all tests

Populated with a script


Continuous Integration

Store unit and integration tests

Run the whole suite with every change

Check if something has broken

For any new error, introduce a new test

Why Integrate All the Time?

Close the gap between development and tests

Safety net for developers

Notice errors when the code is fresh

Shorten development cycles!


Tool for continuous integration

Creates an environment for every run

Free for open source projects

It is, of course, open source

Practical Session 2

Integrate addPath with Travis-CI

Create account on Travis-CI

Activate project

Add .travis.yml

Push something

Bonus Round!

Show build stats

Break tests...

... push to repo...

... then fix tests

Change build status

Send pull request to main repo


Rails Equivalent

Project: add_path

Same spec

Run tests: rake test

.travis.yml for Ruby


Amateurs talk about programming

Professionals care about deployment


Deploying Code

Put your code into production

Different servers, different rules

With node:
git pull
npm install
restart [service]


Do the manual way...

Or do the cool way: with code

DevOps for the win!

Three basic rules:

  • One single button
  • Fail fast and loudly
  • No human intervention

Make your life easier

Make your systems easy to deploy

Continuous Deployment

Too much of a good thing?

Shorten deployment cycles

Don't let changes accumulate

Stability increases (paradoxically!)

Test Before Deploying

Run all test suites

Verify results

Certify quality

A small but essential addition:

git pull
npm install
npm test
restart [service]

Practical Session 3

Create a deployment script

Run manual deployment

Run automatic deployment

Add Webhook to GitHub

Deployment package

Install deployment:

$ sudo npm install -g deployment


$ deployment-run --help
$ deployment-server --help

--testdir: integration directory

--dir: production directory

--exec: command to run

Run Deployments

Run local deployment:

 $ deployment-run --testdir .
--testdir: integration directory

Create deployment server:

 $ deployment-server --token ks9cfwyy862wf56a --testdir .
Access to run automatic deployment:


GitHub WebHook

Access GitHub repo Settings

Go to Service Hooks

Add Webhook URLs


Rails Deployment

Run tests with rake test

Deployment with Capistrano

Local and remote deployment



From one Server to Many

Horizontal architecture

One deployment, many servers

Production: listen to signal

Integration: send signals


Travis-CI to the Rescue

Use Travis-CI as integration environment

Add a WebHook to the build

Notify all production servers

Notify hub that notifies servers

Practical Session 4

Teams with two IronHackers:

  • Integration server
  • Production server

Configure production server

Configure integration server

Run continuous deployment

Configure Production Server

Run deployment server:

 $ deployment-server --token production --dir .

Access server:


Get production IP address:
 $ ifconfig

Configure Integration Server

Run integration server:

 $ URL="http://[prodIP]:3470/deploy/production"
$ deployment-run --token integration --testdir . --exec "wget $URL"

Upon completion notifies production.

Access server:

And watch it do its magic!


Bonus Track


Proactive Monitoring

Let alarms, alerts and warnings come to you

Every alarm must have:

  • A cause
  • An alert system
  • An action associated

Make your life easier

Make your systems easy to monitor

Practical Session 5

Watch notifications from a continuous deployment system

Watch a monitoring system in action

Watch how an alert is created



Ironhack: Deployment

By Alex Fernández

Ironhack: Deployment

Continuous Deployment workshop for IronHack

  • 3,241

More from Alex Fernández