Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Shipping Node

Shipping Node

CoreOS + Docker talk on how to deploy node.js in a cluster environment presented at OneShot Budapest

PatrickHeneise

November 21, 2014
Tweet

More Decks by PatrickHeneise

Other Decks in Technology

Transcript

  1. –Michael Brunton-Spall, Velocity EU 2014, @bruntonspall “Developers are simple people.

    They don't to know how `apt` works; don’t need to know. They just want their application deployed.” “They just know enough to be dangerous.”
  2. SSH LOGIN you maybe forgot to add your ssh public

    key to the deployment, so you’ll have to enter some weird complicated password you got into your mailbox and then enter another keyword and again, just to make sure …
  3. Configure all the things! Get stuck Call your sysadmin buddy

    / operations hours later … Runs like a beast!
  4. LET’S START SIMPLE 1. Package your app into a Docker

    image 2. Create a cloud-config file 3. Provision Virtual Machines/Machines with CoreOS 4. There’s no step 4
  5. FROM centos:centos7 MAINTAINER Patrick Heneise <[email protected]> # Enable EPEL for

    Node.js RUN rpm -Uvh http://mirror.uv.es/mirror/fedora-epel/7/x86_64/e/epel- release-7-2.noarch.rpm # Install Node.js and npm RUN yum update -y RUN yum install -y make GraphicsMagick npm # Bundle app source COPY . /src # Install app dependencies RUN cd /src; npm install CMD ["node", "/src/app.js"]
  6. #cloud-config coreos: etcd: discovery: https://discovery.etcd.io/<token> addr: $private_ipv4:4001 peer-addr: $private_ipv4:7001 fleet:

    public-ip: $private_ipv4 units: - name: etcd.service command: start - name: fleet.service command: start
  7. PACK YOUR THINGS run boot2docker docker build -t ‘you/yourrepo’ .

    docker run you/yourrepo docker push you/yourrepo
  8. - name: oneshot.service command: start enable: true content: | [Unit]

    Description=OneShot Cat Image Processor After=docker.service Requires=docker.service [Service] TimeoutStartSec=0 ExecStartPre=-/usr/bin/docker kill imagebox ExecStartPre=-/usr/bin/docker rm imagebox ExecStartPre=/usr/bin/docker pull patrickheneise/oneshot-docker-demo ExecStart=/usr/bin/docker run --name imagebox patrickheneise/oneshot- docker-demo ExecStop=/usr/bin/docker stop imagebox
  9. Run a CoreOS cluster on your host as vm Run

    a CoreOS cluster in staging/testing Run all the tests/lints/… on a live cluster Deploy to various clusters So many possibilities!
  10. STUFF THAT WAS USED IN THE DEMO Docker App: https://github.com/PatrickHeneise/oneshot-docker-demo

    Docker Image: https://hub.docker.com/u/patrickheneise/oneshot-docker- demo I HAZ CATZ: https://github.com/PatrickHeneise/oneshot-queue-up Display all the cats: https://github.com/PatrickHeneise/oneshot-image- stream