Post on 13-Apr-2017
Mesos on CoreOS Docker Seoul Meetup #4 / Sep 5, 2015
by @subicura (김충섭)
@subicuraPurpleworks Developer Ruby on Rails AngularJS, ReactJS CoreOS, Docker Openframeworks, OpenGL
• Deploy • Capistrano • Docker • CoreOS • Mesos • Mesos on CoreOS
• Demo
!DEPLOY
1. CAPISTRANORemote multi-server automation tool
!1. Get latest source
2. Install dependencies 3. Restart
!1. Get latest source
2. Install dependencies 3. Restart
Failed to install dependencies!!
Why???
conflicting library version ruby version is too old gcc version is too old
8080 port already in use unknown error…
Googling!!
successfully deploy!!
but,
migration to another server or scale out?
2. DOCKERnew container technology
Docker is an open platform for building, shipping and running distributed applications.
before(capistrano)
!
!after(docker)
!Docker Images
before
$ cd$ git clone git://github.com/sstephenson/rbenv.git .rbenv $ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc$ echo 'eval "$(rbenv init -)"' >> ~/.zshrc$ exec $SHELL$ mkdir -p ~/.rbenv/plugins$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build$ git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash$ rbenv install 2.2.2$ rbenv global 2.2.2$ ruby install bundler……
after
docker run -p 80:80 app
MySQL Postgresql MongoDB
Redis RabbitMQ
Nginx Rails Application
…
Let’s start to make docker image!
http://www.slideshare.net/MichaelDucy/the-future-of-everything-37344357
The Future of Everything
http://www.slideshare.net/MichaelDucy/the-future-of-everything-37344357
How to deploy to remote server?
docker -H $TARGET_DEPLOY_TCP pull $DOCKER_REGISTRY_NAME:latest docker -H $TARGET_DEPLOY_TCP stop $DOCKER_APP_NAMEdocker -H $TARGET_DEPLOY_TCP rm $DOCKER_APP_NAMEdocker -H $TARGET_DEPLOY_TCP run -d --name $DOCKER_APP_NAME \ -p 80:80 \ -p 443:443 \ -v /data/www:/var/www/upload \ $DOCKER_REGISTRY_NAME:latest
Docker Host
docker daemon
centurion
3. CoreOSfor container
CoreOS is designed to give you compute
capacity that is dynamically scaled and managed
A Minimal Operating System Painless Updating
Docker Containers Clustered By Default
A highly-available key value store
/services/web/web_1 172.17.8.101:49155
valuekey
directory
Fleet
Distributed init system
Great tools Great features
Powerful
Require install agent (*not ansible) Too many feature
Fleet is enough?
Fleet
Distribute systemd = low-level Difficult cluster resource management
(No check CPU/Memory/Storage) Lack of health check option
Lack of rolling restarts strategy Lack of GUI tool
4. MesosA distributed systems kernel
Program against your datacenter like it’s a single pool of resources
http://techcrunch.com/2014/06/09/mesosphere-grabs-10m-in-series-a-funding-to-transform-datacenters/
Mesos began as a research project in the UC Berkeley RAD Lab
Twitter, Facebook, Apple, Airbnb, Netflix, eBay, … using mesos
efficient resource isolation and sharing across distributed applications
supports a high availability mode (with Marathon)
support docker (from 0.20.0)
UI available
Job Scheduler (with Chronos)
support Hadoop, Kafka, Spark
mesos (with marathon)
fleet
configuration JSON low-level shell command
cluster resource management
yes no
health check http with many option process check
rolling restart strategy
yes no
GUI yes no
Mesos on CoreOS
bootstrapping a cluster system
Fleet
DEMO
Master
Slave
Slave
Slave
zookeeper mesos master(5050) marathon(8080)
Master
Slave
Slave
Slave
mesos slave
mesos slave
mesos slave
zookeeper mesos master(5050) marathon(8080)
echo test
Deploy and manage containers
echo test
web server x 3
Deploy and manage containers
echo test
web server x 3
fleet-ui
Deploy and manage containers
Service Discovery
172.17.8.101:31524
172.17.8.102:31512
172.17.8.103:31533
172.17.8.101:31524
172.17.8.102:315
172.17.8.103:315
/services ㄴwhoami ㄴ1 - 172.17.8.101:31524 ㄴ2 - 172.17.8.102:31512 ㄴ3 - 172.17.8.103:31533
Registrator
Master
Slave
Slave
Slave
mesos slave
mesos slave
mesos slave
registrator
registrator
registrator
zookeeper mesos master(5050) marathon(8080)
172.17.8.101:31524
172.17.8.102:315
172.17.8.103:315
/services
"
CHANGE!?
confd
172.17.8.101:31524
172.17.8.102:315
172.17.8.103:315
/services
"
CHANGE!?
Update Config
Reloadwhoami.sample.com -172.17.8.101:31524 -172.17.8.102:31512 -172.17.8.103:31533
Master
Slave
Slave
Slave
mesos slave
mesos slave
mesos slavenginx-confd(80)
registrator
registrator
registrator
zookeeper mesos master(5050) marathon(8080)
Thank you!
Reference
✓ https://www.docker.com/ ✓ http://coreos.com ✓ http://mesos.apache.org/ ✓ https://mesosphere.github.io/marathon/ ✓ https://github.com/gliderlabs/registrator ✓ https://github.com/kelseyhightower/confd
Sample Source
✓ https://github.com/subicura/mesos-on-coreos