$30 off During Our Annual Pro Sale. View Details »

Deploying Applications to the Docker Ecosystem ...

Deploying Applications to the Docker Ecosystem - SVCC (Sunday) 2015

Slides from the Sunday (October 4th) version (some fixes and couple of new slides) of my talk at the Silicon Valley Code Camp. Has extra slides with links to some more details.

Ted M. Young

October 04, 2015
Tweet

More Decks by Ted M. Young

Other Decks in Programming

Transcript

  1. Ted M. Young @jitterted [email protected] http://about.me/tedmyoung Thank you for attending

    my talk, I hope that you learned something worthy of your time. Interested in learning more? Contact me about my upcoming on-line video learning course that goes into much more depth, and walks you through creating and deploying scalable applications. If you need help incorporating the Docker Ecosystem into your applications or Continuous Integration system, I am available for training and consulting.
  2. Ted M. Young @jitterted [email protected] http://about.me/tedmyoung Here are some links

    to things I mentioned during my talk (missed something? Contact me!): Linux OSes to use for Docker Hosting: * CoreOS (ships with Docker and other tools): https://www.coreos.com * Ubuntu (14.04 or later) Distributed/High-Availability Configuration tools * Apache Zookeeper: https://zookeeper.apache.org * etcd (CoreOS): https://github.com/coreos/etcd Docker Container Hosting in the Cloud (just a sampling!): * Google Container Engine: https://cloud.google.com/container-engine/ * Amazon EC2 Container Service: https://aws.amazon.com/ecs/ * Tutum: https://www.tutum.co * Joyent: https://www.joyent.com
  3. Running Doc Generator Tool • Make sure you have Python

     And make sure it's Python 2.7  No, not Python 3, it needs 2.7 • Install pip  $ python get-pip.py  Did it work? • Install sphinx  $ pip install sphinx  argh…
  4. Running Doc Generator Tool $ docker run -v /mydocpath:/doc \

    minimum2scp/sphinx \ "cd /doc; make html"
  5. FROM nginx:1.7 MAINTAINER Ted M. Young "[email protected]" RUN rm /etc/nginx/nginx.conf

    /etc/nginx/mime.types \ && mkdir /etc/nginx/ssl COPY nginx.conf /etc/nginx/nginx.conf COPY mime.types /etc/nginx/mime.types COPY default /etc/nginx/sites-enabled/default COPY default-ssl /etc/nginx/sites-available/default-ssl # This will add the expanded tar file ADD www.tar /var/www EXPOSE 80 443 VOLUME /var/log/nginx CMD ["nginx"]
  6. FROM mongo:2.6 ADD init-mongo.js /usr/local/bin/init-mongo.js # Define working directory (where

    commands below will be executed) WORKDIR /usr/local/bin ENTRYPOINT ["mongo"] CMD ["--host", "mongodb", "init-mongo.js"]
  7. FROM debian:wheezy # add our user and group first to

    make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mongodb && useradd -r -g mongodb mongodb RUN apt-get update \ && apt-get install -y curl numactl \ && rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root RUN gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \ && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ && gpg --verify /usr/local/bin/gosu.asc \ && rm /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu ENV MONGO_RELEASE_FINGERPRINT DFFA3DCF326E302C4787673A01C4E7FAAAB2461C RUN gpg --keyserver pool.sks-keyservers.net --recv-keys $MONGO_RELEASE_FINGERPRINT ENV MONGO_VERSION 2.6.9 RUN curl -SL "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-$MONGO_VERSION.tgz" -o mongo.tgz \ && curl -SL "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-$MONGO_VERSION.tgz.sig" -o mongo.tgz.sig \ && gpg --verify mongo.tgz.sig \ && tar -xvf mongo.tgz -C /usr/local --strip-components=1 \ && rm mongo.tgz* VOLUME /data/db COPY docker-entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] EXPOSE 27017 CMD ["mongod"]
  8. nginx: image: nginx:latest links: apiservice apiservice: image: api-service:latest links: -

    logstash - redis - postgres - elastic logstash: image: logstash:latest links: - apiservice elastic: image: elasticsearch:latest postgres: image: … docker-compose.yml
  9. Resource Manager • Tracks state of  Node (host machine)

     CPU  RAM  Storage • Fulfills requests
  10. Scheduler • Assigns workloads to machines • Decides which task/job/thing

    to start • When to start it • When to stop/kill it
  11. Replication Controller "ensures that a specified number of pod 'replicas'

    are running at any one time" •Too many? Kill it.
  12. Replication Controller "ensures that a specified number of pod 'replicas'

    are running at any one time" •Too many? Kill it. •Too few? Start some.
  13. Replication Controller "ensures that a specified number of pod 'replicas'

    are running at any one time" •Not enough? Start some. •Too many? Kill them. •Failed? Start more.