Ken Perkins
Rackspace Developer Experience | @kenperkins
Microsoft shuts down zoom.it, and it needs a new home
Or how I used to solve this problem
"The microservice architectural style [1] is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API"
http://martinfowler.com/articles/microservices.htmlSmall, lightweight apps, designed to do a single task well
But how do we now deploy, configure, and coordinate multiple apps?
Docker is an open source project to pack, ship and run any application as a lightweight container
FROM node:0.10
MAINTAINER Ken Perkins "ken.perkins@rackspace.com"
RUN npm install -g zoomhub-importer
CMD ["/usr/bin/node", "--version"]
warehouse-scale computing on top of a minimal, modern operating system
A highly-available key value store for shared configuration and service discovery
fleet ties together systemd and etcd into a distributed init system
$ coreos-cluster-cli --num-nodes 10 --release beta
--flavor performance1-8 --key-name ken-mbp
Redis, Populate, and Stats, plus the heavy lifters
[Unit]
Description=App Redis
After=docker.service
Requires=docker.service
[Service]
EnvironmentFile=/etc/environment
#Disable service timeout
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker kill %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull redis
ExecStart=/usr/bin/docker run --name %n -p ${COREOS_PRIVATE_IPV4}:6379:6379 redis:latest redis-server --requirepass foo-bar-biz-baz-buz
ExecStartPost=/bin/bash -c '\
while true; do \
/usr/bin/etcdctl set /services/app-redis ${COREOS_PRIVATE_IPV4}:6379 --ttl 10; \
sleep 5; \
done'
ExecStop=/usr/bin/etcdctl rm /services/app-redis
ExecStop=/usr/bin/docker stop %n
[Unit]
Description=ZH Populate Service
Requires=docker.service
Requires=etcd.service
After=docker.service
After=etcd.service
[Service]
EnvironmentFile=/etc/environment
User=core
Restart=no
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill zh-populate
ExecStartPre=-/usr/bin/docker rm zh-populate
ExecStartPre=/usr/bin/docker pull kenperkins/zoomhub-importer
ExecStart=/usr/bin/docker run --name zh-populate \
-e RAX_USERNAME=zoomingservice \
-e RAX_PASSWORD=this-is-not-my-password \
-e RAX_REGION=IAD \
-e ZH_REDIS_PASSWORD=foo-bar-biz-baz-buz \
-e ZH_LOG_LEVEL=info \
kenperkins/zoomhub-importer /usr/bin/zh-populate-queue --useInternal --useEtcd
ExecStop=/usr/bin/docker stop zh-populate
[Unit]
Description=ZH Stats Service
Requires=docker.service
Requires=etcd.service
After=docker.service
After=etcd.service
[Service]
EnvironmentFile=/etc/environment
User=core
Restart=always
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill zh-stats
ExecStartPre=-/usr/bin/docker rm zh-stats
ExecStartPre=/usr/bin/docker pull kenperkins/zoomhub-importer
ExecStart=/usr/bin/docker run --name zh-stats \
-e RAX_USERNAME=zoomingservice \
-e RAX_PASSWORD=this-is-not-my-password \
-e RAX_REGION=IAD \
-e ZH_REDIS_PASSWORD=foo-bar-biz-baz-buz \
-e ZH_LOG_LEVEL=info \
kenperkins/zoomhub-importer /usr/bin/zh-stats --useInternal --useEtcd
ExecStop=/usr/bin/docker stop zh-stats
[Unit]
Description=ZH Blob Importer Service
Requires=docker.service
Requires=etcd.service
After=docker.service
After=etcd.service
[Service]
EnvironmentFile=/etc/environment
User=core
Restart=always
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill %p-%i
ExecStartPre=-/usr/bin/docker rm %p-%i
ExecStartPre=/usr/bin/docker pull kenperkins/zoomhub-importer
ExecStart=/usr/bin/docker run --name %p-%i \
-e RAX_USERNAME=zoomingservice \
-e RAX_PASSWORD=this-is-not-my-password \
-e RAX_REGION=IAD \
-e ZH_REDIS_PASSWORD=foo-bar-biz-baz-buz \
-e ZH_LOG_LEVEL=info \
kenperkins/zoomhub-importer /usr/bin/zh-import-blobs --useInternal --useEtcd
ExecStop=/usr/bin/docker stop %p-%i
[Unit]
Description=ZH DZI Uploader Service
Requires=docker.service
Requires=etcd.service
After=docker.service
After=etcd.service
[Service]
EnvironmentFile=/etc/environment
User=core
Restart=always
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill %p-%i
ExecStartPre=-/usr/bin/docker rm %p-%i
ExecStartPre=/usr/bin/docker pull kenperkins/zoomhub-importer
ExecStart=/usr/bin/docker run --name %p-%i \
-e RAX_USERNAME=zoomingservice \
-e RAX_PASSWORD=this-is-not-my-password \
-e RAX_REGION=IAD \
-e ZH_REDIS_PASSWORD=foo-bar-biz-baz-buz \
-e ZH_LOG_LEVEL=info \
kenperkins/zoomhub-importer /usr/bin/zh-upload-dzis --useInternal --useEtcd
ExecStop=/usr/bin/docker stop %p-%i
Schedule & Start the services