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

Rails and Docker in Production at NDrive

Rails and Docker in Production at NDrive

Our experience in deploying Ruby on Rails webservices with Docker and Ansible in Production.

André Freitas

September 24, 2016
Tweet

More Decks by André Freitas

Other Decks in Programming

Transcript

  1. How we build any Rails service? FROM docker.ndrive.com/rails ONBUILD COPY

    Gemfile* /code/ ONBUILD RUN bundle install --without="development test" ONBUILD COPY . /code ONBUILD RUN chown 99:99 -R /code ONBUILD USER 99 ONBUILD ARG version ONBUILD LABEL com.ndrive.version=$version DOCKER_TAG=0.1.0 make docker-build docker-push
  2. - name: container docker: name: auth state: reloaded restart_policy: always

    pull: always net: bridge log_driver: journald image: "docker.ndrive.com/auth:{{ auth.tag }}" ports: - "4001:4001" volumes: - /srv/settings/auth.json:/code/config/settings.json Example of an Ansible Role
  3. Logs - Rails logs to stdout - Container sends logs

    to Journald journalctl CONTAINER_NAME=auth -f
  4. Pros of Docker - Configuration of servers is simple -

    We build all in a single artifact (Docker image) - Less surprises in deployments - Easy to spin up a test environment (CI) - Friend of microservices
  5. Cons of Docker - We need to know how to

    deal with Docker issues - Low maturity in orchestration (maybe Swarm or Rancher in the future) - Risky for databases