Skip to content

Instantly share code, notes, and snippets.

@Elzair
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Elzair/a7f5b625edbf121c5442 to your computer and use it in GitHub Desktop.
Save Elzair/a7f5b625edbf121c5442 to your computer and use it in GitHub Desktop.
hannahci presentation

Hannah: Comparmentalizing Deployment

Hi, my name is Philip Woods, and I am here today to talk about Hannah.

What is Hannah?

First of all, what is Hannah?

To put it simply, Hannah provides Continuous Integration and Continuous Deployment.

It simplifies deploying a connected application, and it is simply simpler to use than other systems.

Hannah Workflow

Let me show you how it works.

First, a developer pushes code to their remote repository.

This is all a person needs to do; Hannah handles the rest.

Next, the host (in this case Bitbucket) notifies Hannah, via webhook, that new code has been added to a repository.

Hannah then checks that said code is on a branch that Hannah is supposed to monitor.

If so, Hannah checks out the new code and runs any unit tests (or other commands its been configured to run).

Then, Hannah builds a Docker image of the app, ships it and finally runs it on every host it has been configured to support.

If any point in this process fails, Hannah immediately stops and writes an error message to a log file.

Monitoring Hannah

Developers can monitor the status of a deployment from their browsers.

Installing Hannah

Hannah requires that Docker and git are already installed.

After that you can execute the listed commands to complete the installation.

Finally, you need to add the generated SSH key to your Bitbucket account to ensure Hannah can access your project.

I have written a script to automatically create a deb package suitable for installing on Ubuntu 14.04.

Configuring Hannah Part 1: Editing Config File

Hannah reads the file /etc/hannahci.yaml for its configuration.

Here is an example config file that has one repository provider (i.e. Bitbucket), and one repository with two different branches – the first deploys to one host; the second deploys to two.

Each repository listed in the config file must have AT LEAST one branch listed under it.

The pre_commands variable details the commands to execute before trying to build a Docker image.

The hosts variable contains data on the hosts running the application.

NOTE: You can run an application on the same system as Hannah, but you still need to configure SSH.

Configuring Hannah Part 2: Cloning Repositories

After adding a repository to the config file, you must manually clone it by executing the listed command.

Configuring Remote Hosts

Hannah provides a script for configuring systems that will host your apps.

You execute the script on the machine Hannah was installed on.

It does require that the host’s SSH server allow key-based authentication.

Conclusion

Change always takes some time to get used to, but consider the possibilities!

Hannah: Simplifying Deployment

A presentation by Philip Woods

What is Hannah?

A Continuous Integration & Deployment Solution for Linux

Aims to simplify releases

Git based deployment

Packages apps using Docker

Simpler to Install, use and maintain than other systems

Hannah Workflow

./workflow.png

Monitoring Hannah

./projects.jpg

Installing Hannah

Requirements

Docker

Git

Installation

sudo apt-get install -y build-essential libgmp zlib1g git
curl -sSL https://get.docker.com/ubuntu/ | sudo sh - 
sudo dpkg -i hannah.deb

Configuring Hannah Part 1: Editing Config File

Config file stored in /etc/hannahci.yaml

Example

version: "0.0.1"

providers:
  - provider_name: "bitbucket"
    repositories:
      - repository_name: "petsafesoftwareteam/rscswitchboard"
        branches:
          - branch_name: "master"
            pre_commands:
              - "npm test"
            hosts:
              - host_name: "example.com"
                run_options: "-v /host:/container -p 4000:4000"
          - branch_name: "test"
            pre_commands:
              - "npm test"
            hosts:
              - host_name: "example.com"
                run_options: "-v /host:/container -p 4000:4000"
              - host_name: "another.example.com"
                run_options: "-v /host2:/container2 -p 4000:4000"

Configuring Hannah Part 2: Cloning Repositories

sudo -u lanaci git clone git@bitbucket.org:petsafesoftwareteam/project.git /home/lanaci/projects/petsafesoftwareteam/project

Configuring Remote Hosts

Hannah provides script: init/setup-remote.sh

Execute script with remote_username@host.name.or.ip.address

Requires key-based authentication on remote SSH server

Conclusion

Consider the possibilities!

http://i62.tinypic.com/20rthea.png
http://i57.tinypic.com/dx1ok0.png
digraph Workflow {
node [shape="box"]
user -> provider [label="git push"]
provider -> hannah [label="Webhook push notification"]
provider [label="repository host"]
hannah -> host1 [label="Deploys built app"]
hannah -> host2 [style=dotted,label="Ditto"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment