Deploying a Flynn Cluster on Brightbox Cloud

Flynn bills itself as a next generation open source Platform as a Service (PaaS).

It can run stateful services as well as the modern ‘Twelve Factor Web Apps’.

It is in active development at the moment, but shows a great deal of promise, with the Heroku buildpack support the most complete. And it’s really easy to run up a cluster to play with on Brightbox Cloud.


I’ve created a Brightbox Platforms repository on GitHub which contains scripts that build a Flynn cluster automatically.

So once you have the Brightbox CLI installed and SSH working, then simply clone the repository and run the Flynn cluster build script.

$ git clone
$ cd brightbox-platforms/flynn
$ ./build-cluster

This will build three 4gb SSD cloud servers, add them to a cluster and front them with a load balancer and a Cloud IP. It takes about 20 minutes to complete, mostly due to downloading the Flynn docker image layers and compiling the ZFS kernel module).

If you don’t fancy firing up the full three servers then you can change the server type and the number of servers easily via options to the script. See the README file in the repository directory for more details.

Building Flynn cluster from trusty base image img-iizdg
Flynn Cluster #1 security group id is grp-yb2k
Building Flynn Cluster #1 layer 0
Creating 3 4gb.ssd (typ-sdipw) servers with image ubuntu-trusty-14.04-amd64-server (img-iizdg) in groups grp-yb2hk with 0.78k of user data

 id         status    type     zone   created_on  image_id   cloud_ip_ids  name            
 srv-rj5st  creating  4gb.ssd  gb1-a  2015-07-21  img-iizdg                Flynn Cluster #1
 srv-5y6xv  creating  4gb.ssd  gb1-b  2015-07-21  img-iizdg                Flynn Cluster #1
 srv-1po19  creating  4gb.ssd  gb1-b  2015-07-21  img-iizdg                Flynn Cluster #1

Waiting for server srv-rj5st to complete build........................................
Waiting for server srv-5y6xv to complete build
Waiting for server srv-1po19 to complete build
Starting server srv-rj5st
Starting server srv-5y6xv
Starting server srv-1po19
Creating a new load balancer
Waiting for server srv-rj5st to complete build
Waiting for server srv-5y6xv to complete build
Waiting for server srv-1po19 to complete build
Mapping cip-m1e98 to interface int-juloz on srv-rj5st

 id         status  public_ip       destination  reverse_dns                           name            
 cip-m1e98  mapped  srv-rj5st  Flynn Cluster #1

Waiting for ssh logon for
Obtaining discovery token for Cluster
Allocating discovery token to other cluster members...
srv-5y6xv Waiting for ssh logon for
srv-1po19 Waiting for ssh logon for
Starting Flynn daemon
srv-rj5st flynn-host start/running, process 1925
srv-5y6xv flynn-host start/running, process 1642
srv-1po19 flynn-host start/running, process 1644

Unmapping cloud ip
Unmapping Cloud IP cip-m1e98

 id         status    public_ip       destination  reverse_dns                           name            
 cip-m1e98  unmapped       Flynn Cluster #1

Waiting for load balancer lba-wiu4c to complete...........
Remapping cloud ip to group
Mapping cip-m1e98 to destination lba-wiu4c

 id         status  public_ip       destination  reverse_dns                           name            
 cip-m1e98  mapped  lba-wiu4c  Flynn Cluster #1

 id         status  public_ip       destination  reverse_dns                           name            
 cip-m1e98  mapped  lba-wiu4c  Flynn Cluster #1

Waiting for ssh logon for
Bootstrapping Flynn Layer 1
14:14:54.948868 check online-hosts
14:14:55.481026 require-env require-env
14:14:55.483490 run-app etcd
14:14:57.205141 run-app flannel
14:14:58.428178 run-app discoverd
14:14:59.768621 wait-hosts wait-hosts
14:15:00.776788 gen-random pg-password
14:15:00.777015 gen-random pg-password 986be995c434583ebad5441482267e74
14:15:00.777032 run-app postgres
14:15:04.126987 gen-random controller-key
14:15:04.127305 gen-random controller-key 98f6589f4554835358d9c449fca27d59
14:15:04.127372 gen-random dashboard-session-secret
14:15:04.127466 gen-random dashboard-session-secret 05efe72a24c212dbd22c72d7bfe926eb
14:15:04.127511 gen-random dashboard-login-token
14:15:04.127610 gen-random dashboard-login-token fd85d929afbb085939f2b2a1b9dd7d41
14:15:04.127683 gen-random name-seed
14:15:04.127817 gen-random name-seed 0bf4124f53c592c8f0d2
14:15:04.127916 gen-random router-sticky-key
14:15:04.128086 gen-random router-sticky-key KS7r9poFwsdwcjtd5enGsXlQ819tudCEeV8UdGF6R0E=
14:15:04.128131 wait postgres-wait
14:15:10.714332 run-app controller
14:15:14.521690 gen-tls-cert controller-cert
14:15:15.994297 gen-tls-cert controller-cert pin: mt3Xen5ttD5W7g+D0RrSDrZ3XdXtLJbHg7w/CkTbo98=
14:15:15.994320 wait controller-wait
14:15:15.996945 add-app controller-inception
14:15:16.154648 add-app postgres-app
14:15:16.247179 add-app etcd-app
14:15:16.351030 add-app flannel-app
14:15:16.544586 add-app discoverd-app
14:15:16.633242 scale-app scheduler-scale
14:15:16.660632 run-app scheduler
14:15:18.901083 deploy-app blobstore
14:15:23.041700 deploy-app router
14:15:26.926597 gen-ssh-key gitreceive-key
14:15:27.625635 deploy-app gitreceive
14:15:28.083080 wait router-wait
14:15:28.747596 add-route gitreceive-route
14:15:28.840825 add-route controller-route
14:15:28.931698 wait controller-route-wait
14:15:29.449639 deploy-app logaggregator
14:15:29.582715 deploy-app taffy
14:15:29.850521 deploy-app dashboard
14:15:30.073191 add-route dashboard-route
14:15:30.103939 wait blobstore-wait
14:15:30.110864 wait gitreceive-wait
14:15:30.111885 log log-complete
14:15:30.112098 log log-complete 

Flynn bootstrapping complete. Install the Flynn CLI (see for instructions) and paste the line below into a terminal window:

flynn cluster add -g -p mt3Xen5ttD5W7g+D0RrSDrZ3XdXtLJbHg7w/CkTbo98= default 98f6589f4554835358d9c449fca27d59

The built-in dashboard can be accessed at
Reconfiguring LB to web mode
Updating load balancer lba-wiu4c
lba-wiu4c        active        2015-07-21        cip-m1e98        srv-rj5st,srv-5y6xv,srv-1po19        Flynn Cluster #1

The script tells you the final steps that you have to complete to get you admin access to the new cluster. Firstly, install the Flynn CLI locally (see for instructions).

Then run the cluster add command that the script gave you, which contains a couple of initial authentication tokens. In this case it looks like this:

$ flynn cluster add -g -p mt3Xen5ttD5W7g+D0RrSDrZ3XdXtLJbHg7w/CkTbo98= default 98f6589f4554835358d9c449fca27d59

Cluster "default" added and set as default.

Then add your SSH key, for git access:

$ flynn key add ~/.ssh/ 
Key c4:cc:dd:f1:26:8b:93:53:0b:0f:8a:c5:ff:aa:a3:a6 added.

And you’re ready to deploy an app!

Deploy an app

Once you have the Flynn CLI configured you can deploy applications really easily. As well as the Node.js example in the documentation, running up a Herokuised Rails app is pretty straightforward.

First clone the app. We’ll use a sample Heroku rails app here

$ git clone

Then create an app for it on the Flynn cluster

$ cd ruby-rails-sample

$ flynn create sample
Created sample

And create a PostgreSQL resource for it too, and link it together

$ flynn resource add postgres
Created resource fe7ce1dcdc7d4809b1c0d5f135060fbf and release 28967974b7144080bdea97bcc8d1679d.

$ flynn env set DATABASE_URL=$(export $(flynn env | xargs); echo "postgres://$PGUSER:$PGPASSWORD@$PGHOST:5432/$PGDATABASE")
Created release 466fdc5d72884a8ca1cdbc61e50a30d0.

The Flynn CLI adds a git remote for you named flynn, so just git push to it to deploy

$ git push flynn master
Counting objects: 231, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (126/126), done.
Writing objects: 100% (231/231), 38.81 KiB | 0 bytes/s, done.
Total 231 (delta 89), reused 231 (delta 89)
-----> Building sample...
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.2.1
-----> Installing dependencies using 1.9.7
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Fetching gem metadata from
       Fetching version metadata from
       Fetching dependency metadata from
       Bundle complete! 14 Gemfile dependencies, 53 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into ./vendor/bundle.
       Bundle completed (46.10s)
       Cleaning up the bundler cache.
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       I, [2015-07-29T12:17:37.474627 #1123]  INFO -- : Writing /tmp/build/public/assets/application-47fe71a3b34a93e1929c175b1755d405.js
       I, [2015-07-29T12:17:37.492033 #1123]  INFO -- : Writing /tmp/build/public/assets/application-c06dd6a542ea15147e6794e03643f87c.css
       Asset precompilation completed (5.71s)
       Cleaning assets
       Running: rake assets:clean
-----> Discovering process types
       Procfile declares types -> web
       Default process types for Ruby -> rake, console, web, worker
-----> Compiled slug size is 31M
-----> Creating release...
=====> Application deployed
=====> Waiting for web job to start...
=====> Default web formation scaled to 1
To ssh://
 * [new branch]      master -> master

And finally just get Flynn to run the Rails db migrations

$ flynn run rake db:migrate
(64.7ms)  CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
(15.4ms)  CREATE UNIQUE INDEX  "unique_schema_migrations" ON "schema_migrations"  ("version")

Then run flynn route and see the web address of the app:

$ flynn route
ROUTE                                    SERVICE     ID  sample-web  http/fbfeccf0-f9b8-4d2d-bd3b-5c87d9061dab

Paste that into a web browser to get the familiar ‘Hello World’ response.

Get started now!

So there we are, up and running with Flynn in less than half an hour. We’ll be blogging how to do the same with Deis and Kubernetes soon.

And we’re working on making it easier and easier to bootstrap complex distributed systems like Flynn on Brightbox Cloud, so stay tuned!

If you’re not already a Brightbox customer you can get signed up in 2 minutes. We’ll even apply an automatic £20 credit to get you started playing with your very own Flynn Cluster.

Recent posts

Get started with Brightbox Sign up takes just two minutes...