Post on 30-Jun-2015
description
Flynn
What is Flynn?
Flynn is a set of components for solving ops
What problem needs solving?
● Deploy a web app to multiple servers
● Upgrading dependencies
● Deploy a fault tolerant, scalable database cluster
postgres-db flynn-controller flynn-scheduler
gitreceive
blobstore postgres-api router-api
router-http router-tcpLAYER 1
APPLICATION + DATABASE AWARE SERVICES
LAYER 0flynn-hostdiscoverd
etcd
JOB SCHEDULING + SERVICE DISCOVERY API
flynn-hostdiscoverd
etcd
flynn-hostdiscoverd
etcd
Flynn is divided into two layers
Layer 0: discoverd + etcd
● provides service discovery to the cluster
● runs as a daemon on every node
● listens on port 1111
● communicates with other nodes via etcd
● determine a “leader” for any given service
Layer 0: discoverd + etcd
● register a service as online by periodically sending name, address and attributes to the daemon
● [“redis”, “192.168.1.2:6379”, “password” => “s3cr3t”]
● subscribe to services to be notified when they scale up / down
Layer 0: flynn-host
● runs as a daemon on all nodes
● responsible for starting and tracking local jobs
● pluggable job backend (docker / libvirt-lxc)
● leader holds the state of the cluster
● all job requests sent to the leader
Layer 1
● consists of ~10 components
● loosely coupled
● provides Heroku-like git push deploys
Layer 1: controller
● exposes a JSON REST API to:● create / delete applications● create releases for applications● scale releases● run custom jobs● stream job events● create / delete routes
Layer 1: postgresql
● Publishes credentials via discoverd
● Exposes a REST API for creating users and databases
● Automatic failover via leader changes
Layer 1: scheduler
● responsible for scaling an apps processes
● watches for changes in PostgreSQL
● runs on every node, with only the leader actually scheduling jobs
Layer 1: gitreceived
● An SSH server made specifically for accepting git pushes
● auth script: authchecker $USER $KEY
● receive script: receiver $PATH $COMMIT
Layer 1: flynn-receive
● uses the controller to check user & key
● uses Heroku buildpacks to compile a slug and detect process types
● creates an app release
Layer 1: blobstore
● simple, fast HTTP file service
curl -X PUT -T file http://blobstore/path/to/file
curl http://blobstore/path/to/file
curl -X DELETE http://blobstore/path/to/file
Layer 1: router
● provides HTTP & TCP routing / load balancing to services
● uses discoverd to detect backends● provides REST API for managing routes● stores routes in etcd for high availability● runs on every node
DEMO
TRY IT OUT!
https://flynn.io#flynn on Freenode
github.com/flynn/flynn