SlideShare une entreprise Scribd logo
1  sur  24
Télécharger pour lire hors ligne
Building containers
Turbocharged!
Shopify
• All the commerce
• 165k+ merchants, 8 Billion GMV
• 300M+ unique visits/month
• 4000+ containers
• RoR, MySQL, Redis, Memcache, Elasticsearch, Chef, Go,
Podding, Multi-DC,...
Docker at Shopify
• Serving production traffic for over a year
• Gives developers more freedom (and responsibility) around
how applications are being ran
• Offers super fast and reliable deploys1
1
When it works. Warstories are plenty
Building containers
Dockerfiles
Super simple (Dockerfile is essentially shell commands + a
handful of specialized instructions)
Super efficient (Detects changes and skips things that have not
changed)
Super inefficient and complicated for anything nontrivial
Simple, eh?
FROM ruby:2.1.3
RUN apt-get update
RUN apt-get upgrade
RUN apt-get install -qq -y libmysqlclient-dev
RUN useradd --create-home rails_is_fun
WORKDIR /home/rails_is_fun
COPY . /home/rails_is_fun
RUN bundle install
CMD bundle exec unicorn -p 3000
NOPE NOPE NOPE
FROM ruby:2.1.3
RUN apt-get update
RUN apt-get upgrade
RUN apt-get install -qq -y libmysqlclient-dev
RUN useradd --create-home rails_is_fun
WORKDIR /home/rails_is_fun
COPY Gemfile /home/rails_is_fun/Gemfile
COPY Gemfile.lock /home/rails_is_fun/Gemfile.lock
RUN bundle install
COPY . /home/rails_is_fun
CMD bundle exec unicorn -p 3000
Even with this you have no concept of Gem cache, so any
changes to Gemfile essentially means building them from
scratch
Not to mention the burden of apt-get update/upgrade
What about secrets?
When building application containers its pretty common to
have secrets (API keys, DB urls etc.).
Dockerfile doesn't support any temporary/external files. While
building you can't use VOLUMES either
No real solutions. Everything is bad (secrets in plaintext in
layers, external wrappers etc)
#!/bin/bash
gem install ejson
ejson decrypt config/config.production.ejson > config.json
docker build -t rails_is_fun .
rm -rf config.json
The things we needed
• Performance (not only for building a lot of containers but
building a single one quickly)
• Security. We handle money and peoples private
information, so having a secure system is kinda important
• Coordinator for builds
Solution: Write your own builder
Our custom builder Locutus is a Golang app that:
• Listens to webhooks (every commit to GH triggers a build)
• Builds containers
• Pushes to our private registry
• Has a webgui showing the build step-by-step
• Sends hooks about build statuses
• Scales horizontally, eg. we can have N builders
The interesting part, building
We replaced Dockerfiles with prepare, precompile and
compile scripts (vanilla Bash)
These scripts actually represent a different build phase and live
in the app repo
Each phase does a docker run with the script and saves the
container with docker commit.
prepare
is used for your system packages (eg. apt-get install
libmysqlclient-dev).
In this phase we only copy the script itself to our baseimage
We cache this image based on the md5sum of the prepare
During Shopify builds we really rarely have to run this phase
since system level depencies doesn't change often.
precompile
is used for application dependencies and asset building (eg.
bundle install)
Used for creating a folder of wanted artifacts. Only thing that is
persisted is /artifacts
Run on every build, but build upon the previous cache of the
specific app (and branch). So we never end up pulling all gems
because of a Gemfile change etc.
compile
is used for moving the generated arfifacts to correct folders
(eg. .bundle) and finishing setup
Run on every build, but super fast since we are just doing
bunch of mv and rm (to cleanup caches etc. to slim the image)
The result of this phase is the final image we actually can
deploy to be run.
Build times around 40-50 seconds thanks to heavy caching
Containers never see the keys that are used for decrypting
secrets
Questions?
ps. http://www.shopify.com/careers

Contenu connexe

Tendances

Dev objective2015 lets git together
Dev objective2015 lets git togetherDev objective2015 lets git together
Dev objective2015 lets git togetherColdFusionConference
 
Nginx conference 2015
Nginx conference 2015Nginx conference 2015
Nginx conference 2015ING-IT
 
Containers not just for production nov8
Containers not just for production nov8Containers not just for production nov8
Containers not just for production nov8HARITHA HARI
 
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence Parag Gajbhiye
 
Docker Practical Use Cases
Docker Practical Use CasesDocker Practical Use Cases
Docker Practical Use CasesAlexei Yuzhakov
 
Silverstripe CMS 4.9.0 release and beyound
Silverstripe CMS 4.9.0 release and beyoundSilverstripe CMS 4.9.0 release and beyound
Silverstripe CMS 4.9.0 release and beyoundMaximeRainville1
 
Get acquainted with the new ASP.Net 5
Get acquainted with the new ASP.Net 5Get acquainted with the new ASP.Net 5
Get acquainted with the new ASP.Net 5Suyati Technologies
 
[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshift
[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshift[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshift
[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshiftNAVER D2
 
Introduction to Git for developers
Introduction to Git for developersIntroduction to Git for developers
Introduction to Git for developersDmitry Guyvoronsky
 
JS digest. November 2017
JS digest. November 2017JS digest. November 2017
JS digest. November 2017ElifTech
 
Living with microservices at Pipedrive
Living with microservices at PipedriveLiving with microservices at Pipedrive
Living with microservices at PipedriveRenno Reinurm
 
Command box, Package Manager, Automation, REPL
Command box, Package Manager, Automation, REPLCommand box, Package Manager, Automation, REPL
Command box, Package Manager, Automation, REPLColdFusionConference
 
GitBucket: Open source self-hosting Git server built by Scala
GitBucket: Open source self-hosting Git server built by ScalaGitBucket: Open source self-hosting Git server built by Scala
GitBucket: Open source self-hosting Git server built by Scalatakezoe
 
Mój przepis na skalowalną architekturę mikroserwisową? Apollo Federation i Gr...
Mój przepis na skalowalną architekturę mikroserwisową? Apollo Federation i Gr...Mój przepis na skalowalną architekturę mikroserwisową? Apollo Federation i Gr...
Mój przepis na skalowalną architekturę mikroserwisową? Apollo Federation i Gr...The Software House
 
Managing changes to eZPublish Database
Managing changes to eZPublish DatabaseManaging changes to eZPublish Database
Managing changes to eZPublish DatabaseGaetano Giunta
 

Tendances (20)

Dev objective2015 lets git together
Dev objective2015 lets git togetherDev objective2015 lets git together
Dev objective2015 lets git together
 
Nginx conference 2015
Nginx conference 2015Nginx conference 2015
Nginx conference 2015
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Containers not just for production nov8
Containers not just for production nov8Containers not just for production nov8
Containers not just for production nov8
 
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
 
Docker Practical Use Cases
Docker Practical Use CasesDocker Practical Use Cases
Docker Practical Use Cases
 
Silverstripe CMS 4.9.0 release and beyound
Silverstripe CMS 4.9.0 release and beyoundSilverstripe CMS 4.9.0 release and beyound
Silverstripe CMS 4.9.0 release and beyound
 
Get acquainted with the new ASP.Net 5
Get acquainted with the new ASP.Net 5Get acquainted with the new ASP.Net 5
Get acquainted with the new ASP.Net 5
 
[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshift
[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshift[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshift
[D2 COMMUNITY] Open Container Seoul Meetup - Kubernetes를 이용한 서비스 구축과 openshift
 
2015 05-06-elias weingaertner-docker-intro
2015 05-06-elias weingaertner-docker-intro2015 05-06-elias weingaertner-docker-intro
2015 05-06-elias weingaertner-docker-intro
 
Introduction to Git for developers
Introduction to Git for developersIntroduction to Git for developers
Introduction to Git for developers
 
JS digest. November 2017
JS digest. November 2017JS digest. November 2017
JS digest. November 2017
 
Living with microservices at Pipedrive
Living with microservices at PipedriveLiving with microservices at Pipedrive
Living with microservices at Pipedrive
 
Command box, Package Manager, Automation, REPL
Command box, Package Manager, Automation, REPLCommand box, Package Manager, Automation, REPL
Command box, Package Manager, Automation, REPL
 
The Three Musketeers
The Three MusketeersThe Three Musketeers
The Three Musketeers
 
GitBucket: Open source self-hosting Git server built by Scala
GitBucket: Open source self-hosting Git server built by ScalaGitBucket: Open source self-hosting Git server built by Scala
GitBucket: Open source self-hosting Git server built by Scala
 
Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Ma...
Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Ma...Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Ma...
Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Ma...
 
C#: Past, Present and Future
C#: Past, Present and FutureC#: Past, Present and Future
C#: Past, Present and Future
 
Mój przepis na skalowalną architekturę mikroserwisową? Apollo Federation i Gr...
Mój przepis na skalowalną architekturę mikroserwisową? Apollo Federation i Gr...Mój przepis na skalowalną architekturę mikroserwisową? Apollo Federation i Gr...
Mój przepis na skalowalną architekturę mikroserwisową? Apollo Federation i Gr...
 
Managing changes to eZPublish Database
Managing changes to eZPublish DatabaseManaging changes to eZPublish Database
Managing changes to eZPublish Database
 

Similaire à Vincit Teatime 2015.2 - Niko Kurtti: SaaSiin pa(i)nostusta

CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...E. Camden Fisher
 
Docker intro
Docker introDocker intro
Docker introspiddy
 
DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2Docker, Inc.
 
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013dotCloud
 
Docker introduction
Docker introductionDocker introduction
Docker introductionPhuc Nguyen
 
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Productiondevopsdaysaustin
 
Automating CICD Pipeline with GitLab and Docker Containers for Java Applications
Automating CICD Pipeline with GitLab and Docker Containers for Java ApplicationsAutomating CICD Pipeline with GitLab and Docker Containers for Java Applications
Automating CICD Pipeline with GitLab and Docker Containers for Java ApplicationsJelastic Multi-Cloud PaaS
 
MoldCamp - multidimentional testing workflow. CIBox.
MoldCamp  - multidimentional testing workflow. CIBox.MoldCamp  - multidimentional testing workflow. CIBox.
MoldCamp - multidimentional testing workflow. CIBox.Andrii Podanenko
 
How bigtop leveraged docker for build automation and one click hadoop provis...
How bigtop leveraged docker for build automation and  one click hadoop provis...How bigtop leveraged docker for build automation and  one click hadoop provis...
How bigtop leveraged docker for build automation and one click hadoop provis...Evans Ye
 
Dockerize Our Development Machine
Dockerize Our Development MachineDockerize Our Development Machine
Dockerize Our Development MachinePanji Gautama
 
Docker - Portable Deployment
Docker - Portable DeploymentDocker - Portable Deployment
Docker - Portable Deploymentjavaonfly
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerAditya Konarde
 

Similaire à Vincit Teatime 2015.2 - Niko Kurtti: SaaSiin pa(i)nostusta (20)

CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
 
OpenStack Summit
OpenStack SummitOpenStack Summit
OpenStack Summit
 
Docker intro
Docker introDocker intro
Docker intro
 
DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2
 
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
JOSA TechTalks - Docker in Production
JOSA TechTalks - Docker in ProductionJOSA TechTalks - Docker in Production
JOSA TechTalks - Docker in Production
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
 
Docker-Intro
Docker-IntroDocker-Intro
Docker-Intro
 
Automating CICD Pipeline with GitLab and Docker Containers for Java Applications
Automating CICD Pipeline with GitLab and Docker Containers for Java ApplicationsAutomating CICD Pipeline with GitLab and Docker Containers for Java Applications
Automating CICD Pipeline with GitLab and Docker Containers for Java Applications
 
Docker & Daily DevOps
Docker & Daily DevOpsDocker & Daily DevOps
Docker & Daily DevOps
 
Docker and-daily-devops
Docker and-daily-devopsDocker and-daily-devops
Docker and-daily-devops
 
MoldCamp - multidimentional testing workflow. CIBox.
MoldCamp  - multidimentional testing workflow. CIBox.MoldCamp  - multidimentional testing workflow. CIBox.
MoldCamp - multidimentional testing workflow. CIBox.
 
How bigtop leveraged docker for build automation and one click hadoop provis...
How bigtop leveraged docker for build automation and  one click hadoop provis...How bigtop leveraged docker for build automation and  one click hadoop provis...
How bigtop leveraged docker for build automation and one click hadoop provis...
 
Dockerize Our Development Machine
Dockerize Our Development MachineDockerize Our Development Machine
Dockerize Our Development Machine
 
Containers and Docker
Containers and DockerContainers and Docker
Containers and Docker
 
Docker - Portable Deployment
Docker - Portable DeploymentDocker - Portable Deployment
Docker - Portable Deployment
 
Docker mentorweek
Docker mentorweekDocker mentorweek
Docker mentorweek
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 

Plus de VincitOy

Vincit Teatime 2015.2 - Aleksi Häkli: SaaSiin pa(i)nostusta
Vincit Teatime 2015.2 - Aleksi Häkli: SaaSiin pa(i)nostustaVincit Teatime 2015.2 - Aleksi Häkli: SaaSiin pa(i)nostusta
Vincit Teatime 2015.2 - Aleksi Häkli: SaaSiin pa(i)nostustaVincitOy
 
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a gitVincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a gitVincitOy
 
Vincit ankkasarjakuva
Vincit ankkasarjakuvaVincit ankkasarjakuva
Vincit ankkasarjakuvaVincitOy
 
Tampere goes agile 2015
Tampere goes agile 2015Tampere goes agile 2015
Tampere goes agile 2015VincitOy
 
Digijytky kunnossapidossa 2015 - Simsotec
Digijytky kunnossapidossa 2015 - SimsotecDigijytky kunnossapidossa 2015 - Simsotec
Digijytky kunnossapidossa 2015 - SimsotecVincitOy
 
Digijytky kunnossapidossa 2015 - M-Files
Digijytky kunnossapidossa 2015 - M-FilesDigijytky kunnossapidossa 2015 - M-Files
Digijytky kunnossapidossa 2015 - M-FilesVincitOy
 
Digijytky kunnossapidossa 2015 - Oliotalo
Digijytky kunnossapidossa 2015 - OliotaloDigijytky kunnossapidossa 2015 - Oliotalo
Digijytky kunnossapidossa 2015 - OliotaloVincitOy
 
Digijytky kunnossapidossa 2015 - Vincit
Digijytky kunnossapidossa 2015 - VincitDigijytky kunnossapidossa 2015 - Vincit
Digijytky kunnossapidossa 2015 - VincitVincitOy
 
Itseohjautuvan organisaation muutos
Itseohjautuvan organisaation muutosItseohjautuvan organisaation muutos
Itseohjautuvan organisaation muutosVincitOy
 
Vincit markkinointi AMKE VIMMA 2.6.2015
Vincit markkinointi AMKE VIMMA 2.6.2015Vincit markkinointi AMKE VIMMA 2.6.2015
Vincit markkinointi AMKE VIMMA 2.6.2015VincitOy
 
Vincit Teatime 2015 - Case Käyttöauto: Google Glass
Vincit Teatime 2015 - Case Käyttöauto: Google GlassVincit Teatime 2015 - Case Käyttöauto: Google Glass
Vincit Teatime 2015 - Case Käyttöauto: Google GlassVincitOy
 
Vincit Teatime 2015 - Heikki Salo: Case ZenRobotics: JavaScriptin äärirajoilla
Vincit Teatime 2015 - Heikki Salo: Case ZenRobotics: JavaScriptin äärirajoillaVincit Teatime 2015 - Heikki Salo: Case ZenRobotics: JavaScriptin äärirajoilla
Vincit Teatime 2015 - Heikki Salo: Case ZenRobotics: JavaScriptin äärirajoillaVincitOy
 
Vincit Teatime 2015 - Niko Kurtti: Case Shopify: SaaS:n testaaminen, mihin un...
Vincit Teatime 2015 - Niko Kurtti: Case Shopify: SaaS:n testaaminen, mihin un...Vincit Teatime 2015 - Niko Kurtti: Case Shopify: SaaS:n testaaminen, mihin un...
Vincit Teatime 2015 - Niko Kurtti: Case Shopify: SaaS:n testaaminen, mihin un...VincitOy
 
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...VincitOy
 
Implementation of an intelligent car wash service - Vincit Teatime 2013
Implementation of an intelligent car wash service - Vincit Teatime 2013Implementation of an intelligent car wash service - Vincit Teatime 2013
Implementation of an intelligent car wash service - Vincit Teatime 2013VincitOy
 
Projektipäivät 2014: V-Käyrä & Apgar
Projektipäivät 2014: V-Käyrä & ApgarProjektipäivät 2014: V-Käyrä & Apgar
Projektipäivät 2014: V-Käyrä & ApgarVincitOy
 
Vincit V-Käyrä
Vincit V-KäyräVincit V-Käyrä
Vincit V-KäyräVincitOy
 
Need more speed! Pain of mobile app development. Case: Virittäjät
Need more speed! Pain of mobile app development. Case: VirittäjätNeed more speed! Pain of mobile app development. Case: Virittäjät
Need more speed! Pain of mobile app development. Case: VirittäjätVincitOy
 
Trello projektinhallinnan työkaluna
Trello projektinhallinnan työkalunaTrello projektinhallinnan työkaluna
Trello projektinhallinnan työkalunaVincitOy
 
Avaus - Vincit Teatime 2014
Avaus - Vincit Teatime 2014Avaus - Vincit Teatime 2014
Avaus - Vincit Teatime 2014VincitOy
 

Plus de VincitOy (20)

Vincit Teatime 2015.2 - Aleksi Häkli: SaaSiin pa(i)nostusta
Vincit Teatime 2015.2 - Aleksi Häkli: SaaSiin pa(i)nostustaVincit Teatime 2015.2 - Aleksi Häkli: SaaSiin pa(i)nostusta
Vincit Teatime 2015.2 - Aleksi Häkli: SaaSiin pa(i)nostusta
 
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a gitVincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
 
Vincit ankkasarjakuva
Vincit ankkasarjakuvaVincit ankkasarjakuva
Vincit ankkasarjakuva
 
Tampere goes agile 2015
Tampere goes agile 2015Tampere goes agile 2015
Tampere goes agile 2015
 
Digijytky kunnossapidossa 2015 - Simsotec
Digijytky kunnossapidossa 2015 - SimsotecDigijytky kunnossapidossa 2015 - Simsotec
Digijytky kunnossapidossa 2015 - Simsotec
 
Digijytky kunnossapidossa 2015 - M-Files
Digijytky kunnossapidossa 2015 - M-FilesDigijytky kunnossapidossa 2015 - M-Files
Digijytky kunnossapidossa 2015 - M-Files
 
Digijytky kunnossapidossa 2015 - Oliotalo
Digijytky kunnossapidossa 2015 - OliotaloDigijytky kunnossapidossa 2015 - Oliotalo
Digijytky kunnossapidossa 2015 - Oliotalo
 
Digijytky kunnossapidossa 2015 - Vincit
Digijytky kunnossapidossa 2015 - VincitDigijytky kunnossapidossa 2015 - Vincit
Digijytky kunnossapidossa 2015 - Vincit
 
Itseohjautuvan organisaation muutos
Itseohjautuvan organisaation muutosItseohjautuvan organisaation muutos
Itseohjautuvan organisaation muutos
 
Vincit markkinointi AMKE VIMMA 2.6.2015
Vincit markkinointi AMKE VIMMA 2.6.2015Vincit markkinointi AMKE VIMMA 2.6.2015
Vincit markkinointi AMKE VIMMA 2.6.2015
 
Vincit Teatime 2015 - Case Käyttöauto: Google Glass
Vincit Teatime 2015 - Case Käyttöauto: Google GlassVincit Teatime 2015 - Case Käyttöauto: Google Glass
Vincit Teatime 2015 - Case Käyttöauto: Google Glass
 
Vincit Teatime 2015 - Heikki Salo: Case ZenRobotics: JavaScriptin äärirajoilla
Vincit Teatime 2015 - Heikki Salo: Case ZenRobotics: JavaScriptin äärirajoillaVincit Teatime 2015 - Heikki Salo: Case ZenRobotics: JavaScriptin äärirajoilla
Vincit Teatime 2015 - Heikki Salo: Case ZenRobotics: JavaScriptin äärirajoilla
 
Vincit Teatime 2015 - Niko Kurtti: Case Shopify: SaaS:n testaaminen, mihin un...
Vincit Teatime 2015 - Niko Kurtti: Case Shopify: SaaS:n testaaminen, mihin un...Vincit Teatime 2015 - Niko Kurtti: Case Shopify: SaaS:n testaaminen, mihin un...
Vincit Teatime 2015 - Niko Kurtti: Case Shopify: SaaS:n testaaminen, mihin un...
 
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
Improving Code Quality In Medical Software Through Code Reviews - Vincit Teat...
 
Implementation of an intelligent car wash service - Vincit Teatime 2013
Implementation of an intelligent car wash service - Vincit Teatime 2013Implementation of an intelligent car wash service - Vincit Teatime 2013
Implementation of an intelligent car wash service - Vincit Teatime 2013
 
Projektipäivät 2014: V-Käyrä & Apgar
Projektipäivät 2014: V-Käyrä & ApgarProjektipäivät 2014: V-Käyrä & Apgar
Projektipäivät 2014: V-Käyrä & Apgar
 
Vincit V-Käyrä
Vincit V-KäyräVincit V-Käyrä
Vincit V-Käyrä
 
Need more speed! Pain of mobile app development. Case: Virittäjät
Need more speed! Pain of mobile app development. Case: VirittäjätNeed more speed! Pain of mobile app development. Case: Virittäjät
Need more speed! Pain of mobile app development. Case: Virittäjät
 
Trello projektinhallinnan työkaluna
Trello projektinhallinnan työkalunaTrello projektinhallinnan työkaluna
Trello projektinhallinnan työkaluna
 
Avaus - Vincit Teatime 2014
Avaus - Vincit Teatime 2014Avaus - Vincit Teatime 2014
Avaus - Vincit Teatime 2014
 

Dernier

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 

Dernier (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

Vincit Teatime 2015.2 - Niko Kurtti: SaaSiin pa(i)nostusta

  • 2. Shopify • All the commerce • 165k+ merchants, 8 Billion GMV • 300M+ unique visits/month • 4000+ containers • RoR, MySQL, Redis, Memcache, Elasticsearch, Chef, Go, Podding, Multi-DC,...
  • 3.
  • 4.
  • 5. Docker at Shopify • Serving production traffic for over a year • Gives developers more freedom (and responsibility) around how applications are being ran • Offers super fast and reliable deploys1 1 When it works. Warstories are plenty
  • 7. Dockerfiles Super simple (Dockerfile is essentially shell commands + a handful of specialized instructions) Super efficient (Detects changes and skips things that have not changed) Super inefficient and complicated for anything nontrivial
  • 8. Simple, eh? FROM ruby:2.1.3 RUN apt-get update RUN apt-get upgrade RUN apt-get install -qq -y libmysqlclient-dev RUN useradd --create-home rails_is_fun WORKDIR /home/rails_is_fun COPY . /home/rails_is_fun RUN bundle install CMD bundle exec unicorn -p 3000
  • 10. FROM ruby:2.1.3 RUN apt-get update RUN apt-get upgrade RUN apt-get install -qq -y libmysqlclient-dev RUN useradd --create-home rails_is_fun WORKDIR /home/rails_is_fun COPY Gemfile /home/rails_is_fun/Gemfile COPY Gemfile.lock /home/rails_is_fun/Gemfile.lock RUN bundle install COPY . /home/rails_is_fun CMD bundle exec unicorn -p 3000 Even with this you have no concept of Gem cache, so any changes to Gemfile essentially means building them from scratch Not to mention the burden of apt-get update/upgrade
  • 11.
  • 12. What about secrets? When building application containers its pretty common to have secrets (API keys, DB urls etc.). Dockerfile doesn't support any temporary/external files. While building you can't use VOLUMES either No real solutions. Everything is bad (secrets in plaintext in layers, external wrappers etc)
  • 13. #!/bin/bash gem install ejson ejson decrypt config/config.production.ejson > config.json docker build -t rails_is_fun . rm -rf config.json
  • 14. The things we needed • Performance (not only for building a lot of containers but building a single one quickly) • Security. We handle money and peoples private information, so having a secure system is kinda important • Coordinator for builds
  • 15. Solution: Write your own builder
  • 16. Our custom builder Locutus is a Golang app that: • Listens to webhooks (every commit to GH triggers a build) • Builds containers • Pushes to our private registry • Has a webgui showing the build step-by-step • Sends hooks about build statuses • Scales horizontally, eg. we can have N builders
  • 17. The interesting part, building We replaced Dockerfiles with prepare, precompile and compile scripts (vanilla Bash) These scripts actually represent a different build phase and live in the app repo Each phase does a docker run with the script and saves the container with docker commit.
  • 18. prepare is used for your system packages (eg. apt-get install libmysqlclient-dev). In this phase we only copy the script itself to our baseimage We cache this image based on the md5sum of the prepare During Shopify builds we really rarely have to run this phase since system level depencies doesn't change often.
  • 19. precompile is used for application dependencies and asset building (eg. bundle install) Used for creating a folder of wanted artifacts. Only thing that is persisted is /artifacts Run on every build, but build upon the previous cache of the specific app (and branch). So we never end up pulling all gems because of a Gemfile change etc.
  • 20. compile is used for moving the generated arfifacts to correct folders (eg. .bundle) and finishing setup Run on every build, but super fast since we are just doing bunch of mv and rm (to cleanup caches etc. to slim the image) The result of this phase is the final image we actually can deploy to be run.
  • 21. Build times around 40-50 seconds thanks to heavy caching Containers never see the keys that are used for decrypting secrets
  • 22.
  • 23.