SlideShare a Scribd company logo
1 of 30
Develop, Test & Deploy with Docker
Jonas Schwabe
me.json
Docker
• Containerization instead of virtualization
• Containers are lightweight
• Prebuilt images instead of VM installation
• “Works on my machine!” ⟷ “Works on your machine!”
The Problem
Dependency
• Modern software developers need to handle a lot of dependencies
• Operating environment
• Development tools
• Testing infrastructure
• Build & Deployment tools
• Different projects? Different versions!
• Manually: Tedious, time-consuming
Software parts
• There are multiple separate parts software is being composed of:
• ExtJS 6 Frontend
• Backend Service
• Database Server
• Key-Value Store
• …
• Install / upgrade complicated
• Docker: Get a readable & executable definition of how to install / update the stack
Environments
• The software needs to work on:
• Developer’s computers (Windows / MacOS / Linux)
• CI Server (Linux)
• Staging/Live System (Linux)
• What could possibly go wrong?
Docker - Theory
The Image
• Read-only “template” for a container
• Based on an image which might be based on an image which might be based on…
• Contains:
• OS
• Dependencies
• Software
• Atomic - One service per image
Dockerfile - Define an Image
• Base image
• Add your Software
• Dependencies
• Build
• Run
FROM node:latest
ADD src /opt/demo
WORKDIR /opt/demo
RUN npm install
CMD ["npm", "start"]
The Container
• Derives from an image
• Statefull
• Runs a command or service
• Can interact with other containers
• Acts a lot like a VM
The Host
• Docker runs with modern Linux kernel (> 3.10)
• Mac OS & Windows support is available through lightweight Virtual Machines
• Using Docker feels nearly the same across all systems
• Same CLI for every system
• Containers don’t care about the host
Infrastructure
DockerHub & Registry
• Images can be exported and shared
• Registries distribute images
• Docker Hub hosts loads of public images
• You can host your own registry
CI Workflow Example
• CI Server
• Pulls Dockerfile and source code from your VCS
• Pulls base image from Docker Hub
• Builds an image containing your Project
• Pushes the image to a private/public registry
• The destination server
• Deploys from the private/public registry
Source Code Base Image
Image
Build Dockerfile
Container ContainerContainer
Docker & Sencha
CMD
• Sencha CMD is being packed into the docker image
• Upgrade CMD version seamlessly, everyone is synced after a container pull
• You will never have to upgrade multiple CI nodes after a local CMD upgrade!
Dockerfile
• Image will contain a production app
which is being served by nginx
• For development you can run ‚sencha
app watch‘ instead of nginx
FROM nginx:latest
RUN apt-get update -y && apt-get install -y 
unzip 
openjdk-7-jre 
wget 
nginx
WORKDIR /tmp
RUN wget http://cdn.sencha.com/cmd/6.1.3/no-jre/SenchaCmd-6.1.3-linux-
amd64.sh.zip
RUN unzip SenchaCmd-6.1.3-linux-amd64.sh.zip
COPY conf/senchacmd.varfile /tmp/senchacmd.varfile
RUN /tmp/`find SenchaCmd*.sh` -q -varfile /tmp/senchacmd.varfile -dir "/opt/sencha"
RUN ln -s /opt/sencha/sencha /usr/local/bin/sencha
COPY src /opt/demo
WORKDIR /opt/demo
RUN sencha app build
RUN cp -r build/production/demo /usr/share/nginx/html
Frontend & Backend
• ExtJS developers should not have to worry about their backend
• Install & Upgrade should be as easy as running:
• docker-compose up
• docker-compose up --pull
• It actually is that easy:
docker-compose.yml
• Defines which containers should be
started and how they should interact
• Defines volumes to map a folder in
the container to a folder on the host
• Exposes ports through the Host
version: '2'
services:
db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: your
MYSQL_USER: user
MYSQL_PASSWORD: and
MYSQL_DATABASE: password
back:
build: backend
ports:
- "3000:3000"
links:
- db
front:
build: frontend
ports:
- "1841:1841"
command: sencha app watch
volumes:
- "./frontend/src:/opt/demo"
docker-compose
• After running ‚docker-compose up‘ with the previous definition:
• A database is running
• The backend is running and connected to the database
• The fronted is running through sencha app watch
Example
# git clone git@github.com:jnugh/SenchConExample.git
# cd SenchaConExample
# docker-compose up
[Building front, Pulling DB]
Building back
Step 1 : FROM node:latest
latest: Pulling from library/node
8ad8b3f87b37: Pull complete
751fe39c4d34: Pull complete
ae3b77eefc06: Pull complete
7783aac582ec: Pull complete
393ad8a32e58: Pull complete
2d923dade19b: Pull complete
Digest:
sha256:9cd81e673bde91e503fd5022df5d5ff716b4e518718b2196947b6[…]
Status: Downloaded newer image for node:latest
---> e3e7156ded1f
Step 2 : ADD src /opt/demo
---> a29df260324a
Removing intermediate container 107c296da3f8
Step 3 : WORKDIR /opt/demo
---> Running in 007a0cbdc760
---> caf3f579d11d
Removing intermediate container 007a0cbdc760
Step 4 : RUN npm install
---> Running in 9fd93940d56f
npm info it worked if it ends with ok
npm info using npm@3.10.3
npm info using node@v6.5.0
npm info lifecycle demo@0.0.0~preinstall: demo@0.0.0
npm info linkStuff demo@0.0.0
npm info lifecycle demo@0.0.0~install: demo@0.0.0
npm info lifecycle demo@0.0.0~postinstall: demo@0.0.0
npm info lifecycle demo@0.0.0~prepublish: demo@0.0.0
npm info ok
---> 6a3b6d45e1b8
Removing intermediate container 9fd93940d56f
Step 5 : CMD npm start
---> Running in 9a4d0d11a19b
---> c0bbd78dd304
Removing intermediate container 9a4d0d11a19b
Successfully built c0bbd78dd304
Bootstrap a Dev Environment
Bootstrap a Dev Environment
• Frontend, Backend and DB are up and running as configured
• Focus on the code right away
# docker-compose logs back
Attaching to senchacon2016_back_1
back_1 | npm info it worked if it ends with ok
back_1 | npm info using npm@3.10.3
back_1 | npm info using node@v6.4.0
back_1 | npm info lifecycle demo@0.0.0~prestart: demo@0.0.0
back_1 | npm info lifecycle demo@0.0.0~start: demo@0.0.0
back_1 |
back_1 | > demo@0.0.0 start /opt/demo
back_1 | > node ./bin/www
back_1 |
back_1 | npm info lifecycle demo@0.0.0~poststart: demo@0.0.0
back_1 | npm info ok
back_1 | npm info it worked if it ends with ok
back_1 | npm info using npm@3.10.3
back_1 | npm info using node@v6.4.0
back_1 | npm info lifecycle demo@0.0.0~prestart: demo@0.0.0
back_1 | npm info lifecycle demo@0.0.0~start: demo@0.0.0
back_1 |
back_1 | > demo@0.0.0 start /opt/demo
back_1 | > node ./bin/www
back_1 |
back_1 | GET / 200 5945.959 ms - 170
back_1 | GET /stylesheets/style.css 200 46.090 ms - 111
back_1 | GET /favicon.ico 404 135.085 ms - 905
back_1 | npm info lifecycle demo@0.0.0~poststart: demo@0.0.0
back_1 | npm info ok
# docker-compose logs front
Attaching to senchacon2016_front_1
front_1 | Sencha Cmd v6.1.3.42
front_1 | [INF] Processing Build Descriptor : classic
front_1 | [INF] Starting server on port : 1841
[…]
front_1 | [INF] Writing content to /opt/demo/classic.json
front_1 | [INF] merging 223 input resources into
/opt/demo/build/development/demo/classic/resources
front_1 | [INF] merged 0 resources into
/opt/demo/build/development/demo/classic/resources
front_1 | [INF] merging 18 input resources into /opt/demo/build/development/demo
front_1 | [INF] merged 0 resources into /opt/demo/build/development/demo
front_1 | [INF] Writing content to /opt/demo/sass/example/bootstrap.json
front_1 | [INF] Writing content to /opt/demo/sass/example/bootstrap.js
front_1 | [INF] writing sass content to
/opt/demo/build/temp/development/demo/sass/demo-all.scss.tmp
front_1 | [INF] appending sass content to
/opt/demo/build/temp/development/demo/sass/demo-all.scss.tmp
front_1 | [INF] appending sass content to
/opt/demo/build/temp/development/demo/sass/demo-all.scss.tmp
front_1 | [LOG] Building /opt/demo/build/temp/development/demo/sass/demo-all.scss
front_1 | [INF] Appending content to /opt/demo/bootstrap.js
front_1 | [INF] Writing content to /opt/demo/classic.json
front_1 | [INF] Waiting for changes...
Logs
# docker-compose exec front bash
root@d63736c82620:/opt/demo# sencha generate view demo.view.main.TestView
Sencha Cmd v6.1.3.42
root@d63736c82620:/opt/demo# ls app/view/demo/view/main/TestView* -la
-rw-r--r-- 1 root root 349 Sep 15 10:28 app/view/demo/view/main/TestView.js
-rw-r--r-- 1 root root 155 Sep 15 10:28 app/view/demo/view/main/TestViewController.js
-rw-r--r-- 1 root root 180 Sep 15 10:28 app/view/demo/view/main/TestViewModel.js
Shell
Demo
• Pull this simple demo from: https://github.com/jnugh/SenchConExample
Questions?
Please Take the Survey in the Mobile App
• Navigate to this session in the mobile app
• Click on “Evaluate Session”
• Respondents will be entered into a A to win one of five $50 Amazon gift cards
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe

More Related Content

Viewers also liked

Viewers also liked (20)

SenchaCon 2016: Enterprise Applications, Role Based Access Controls (RBAC) an...
SenchaCon 2016: Enterprise Applications, Role Based Access Controls (RBAC) an...SenchaCon 2016: Enterprise Applications, Role Based Access Controls (RBAC) an...
SenchaCon 2016: Enterprise Applications, Role Based Access Controls (RBAC) an...
 
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
 
SenchaCon 2016: A Data-Driven Application for the Embedded World - Jean-Phili...
SenchaCon 2016: A Data-Driven Application for the Embedded World - Jean-Phili...SenchaCon 2016: A Data-Driven Application for the Embedded World - Jean-Phili...
SenchaCon 2016: A Data-Driven Application for the Embedded World - Jean-Phili...
 
SenchaCon 2016: Upgrading an Ext JS 4.x Application to Ext JS 6.x - Mark Linc...
SenchaCon 2016: Upgrading an Ext JS 4.x Application to Ext JS 6.x - Mark Linc...SenchaCon 2016: Upgrading an Ext JS 4.x Application to Ext JS 6.x - Mark Linc...
SenchaCon 2016: Upgrading an Ext JS 4.x Application to Ext JS 6.x - Mark Linc...
 
SenchaCon 2016: Advanced Techniques for Buidling Ext JS Apps with Electron - ...
SenchaCon 2016: Advanced Techniques for Buidling Ext JS Apps with Electron - ...SenchaCon 2016: Advanced Techniques for Buidling Ext JS Apps with Electron - ...
SenchaCon 2016: Advanced Techniques for Buidling Ext JS Apps with Electron - ...
 
SenchaCon 2016: Theming the Modern Toolkit - Phil Guerrant
SenchaCon 2016: Theming the Modern Toolkit - Phil Guerrant   SenchaCon 2016: Theming the Modern Toolkit - Phil Guerrant
SenchaCon 2016: Theming the Modern Toolkit - Phil Guerrant
 
Building Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoBuilding Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff Stano
 
SenchaCon 2016: Accessibility, Teamwork & Ext JS: A Customer Success Story - ...
SenchaCon 2016: Accessibility, Teamwork & Ext JS: A Customer Success Story - ...SenchaCon 2016: Accessibility, Teamwork & Ext JS: A Customer Success Story - ...
SenchaCon 2016: Accessibility, Teamwork & Ext JS: A Customer Success Story - ...
 
SenchaCon 2016: Integrating Geospatial Maps & Big Data Using CartoDB via Ext ...
SenchaCon 2016: Integrating Geospatial Maps & Big Data Using CartoDB via Ext ...SenchaCon 2016: Integrating Geospatial Maps & Big Data Using CartoDB via Ext ...
SenchaCon 2016: Integrating Geospatial Maps & Big Data Using CartoDB via Ext ...
 
SenchaCon 2016: The Modern Toolchain - Ross Gerbasi
SenchaCon 2016: The Modern Toolchain - Ross Gerbasi   SenchaCon 2016: The Modern Toolchain - Ross Gerbasi
SenchaCon 2016: The Modern Toolchain - Ross Gerbasi
 
SenchaCon 2016: Turbocharge your Ext JS App - Per Minborg, Anselm McClain, Jo...
SenchaCon 2016: Turbocharge your Ext JS App - Per Minborg, Anselm McClain, Jo...SenchaCon 2016: Turbocharge your Ext JS App - Per Minborg, Anselm McClain, Jo...
SenchaCon 2016: Turbocharge your Ext JS App - Per Minborg, Anselm McClain, Jo...
 
SenchaCon 2016: Creating a Flexible and Usable Industry Specific Solution - D...
SenchaCon 2016: Creating a Flexible and Usable Industry Specific Solution - D...SenchaCon 2016: Creating a Flexible and Usable Industry Specific Solution - D...
SenchaCon 2016: Creating a Flexible and Usable Industry Specific Solution - D...
 
SenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
SenchaCon 2016: Modernizing the Ext JS Class System - Don GriffinSenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
SenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
 
SenchaCon 2016: Refine Enterprise Applications by Focusing on U0ser Experienc...
SenchaCon 2016: Refine Enterprise Applications by Focusing on U0ser Experienc...SenchaCon 2016: Refine Enterprise Applications by Focusing on U0ser Experienc...
SenchaCon 2016: Refine Enterprise Applications by Focusing on U0ser Experienc...
 
SenchaCon 2016: How to Give your Sencha App Real-time Web Performance - James...
SenchaCon 2016: How to Give your Sencha App Real-time Web Performance - James...SenchaCon 2016: How to Give your Sencha App Real-time Web Performance - James...
SenchaCon 2016: How to Give your Sencha App Real-time Web Performance - James...
 
SenchaCon 2016: Handling Undo-Redo in Sencha Applications - Nickolay Platonov
SenchaCon 2016: Handling Undo-Redo in Sencha Applications - Nickolay PlatonovSenchaCon 2016: Handling Undo-Redo in Sencha Applications - Nickolay Platonov
SenchaCon 2016: Handling Undo-Redo in Sencha Applications - Nickolay Platonov
 
SenchaCon 2016: Developing and Delivering Quality Code, Frequently - Neil Manvar
SenchaCon 2016: Developing and Delivering Quality Code, Frequently - Neil ManvarSenchaCon 2016: Developing and Delivering Quality Code, Frequently - Neil Manvar
SenchaCon 2016: Developing and Delivering Quality Code, Frequently - Neil Manvar
 
SenchaCon 2016: Oracle Forms Modernisation - Owen Pagan
SenchaCon 2016: Oracle Forms Modernisation - Owen PaganSenchaCon 2016: Oracle Forms Modernisation - Owen Pagan
SenchaCon 2016: Oracle Forms Modernisation - Owen Pagan
 
SenchaCon 2016: Web Development at the Speed of Thought: Succeeding in the Ap...
SenchaCon 2016: Web Development at the Speed of Thought: Succeeding in the Ap...SenchaCon 2016: Web Development at the Speed of Thought: Succeeding in the Ap...
SenchaCon 2016: Web Development at the Speed of Thought: Succeeding in the Ap...
 
SenchaCon 2016: Being Productive with the New Sencha Fiddle - Mitchell Simoens
SenchaCon 2016: Being Productive with the New Sencha Fiddle - Mitchell Simoens  SenchaCon 2016: Being Productive with the New Sencha Fiddle - Mitchell Simoens
SenchaCon 2016: Being Productive with the New Sencha Fiddle - Mitchell Simoens
 

Similar to SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe

Was liberty profile and docker
Was liberty profile and dockerWas liberty profile and docker
Was liberty profile and docker
sflynn073
 

Similar to SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe (20)

Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous Integration
 
Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
 
[NYC Meetup] Docker at Nuxeo
[NYC Meetup] Docker at Nuxeo[NYC Meetup] Docker at Nuxeo
[NYC Meetup] Docker at Nuxeo
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
 
Docker presentasjon java bin
Docker presentasjon java binDocker presentasjon java bin
Docker presentasjon java bin
 
Develop with docker 2014 aug
Develop with docker 2014 augDevelop with docker 2014 aug
Develop with docker 2014 aug
 
[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101
 
Detailed Introduction To Docker
Detailed Introduction To DockerDetailed Introduction To Docker
Detailed Introduction To Docker
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Deliver Python Apps with Docker
Deliver Python Apps with DockerDeliver Python Apps with Docker
Deliver Python Apps with Docker
 
Killer Docker Workflows for Development
Killer Docker Workflows for DevelopmentKiller Docker Workflows for Development
Killer Docker Workflows for Development
 
ContainerDayVietnam2016: Dockerize a small business
ContainerDayVietnam2016: Dockerize a small businessContainerDayVietnam2016: Dockerize a small business
ContainerDayVietnam2016: Dockerize a small business
 
Experts Live Europe 2017 - Why you should care about Docker - an introduction
Experts Live Europe 2017 - Why you should care about Docker - an introductionExperts Live Europe 2017 - Why you should care about Docker - an introduction
Experts Live Europe 2017 - Why you should care about Docker - an introduction
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
WebSphere Application Server Liberty Profile and Docker
WebSphere Application Server Liberty Profile and DockerWebSphere Application Server Liberty Profile and Docker
WebSphere Application Server Liberty Profile and Docker
 
Was liberty profile and docker
Was liberty profile and dockerWas liberty profile and docker
Was liberty profile and docker
 
Continuous Integration with Docker on AWS
Continuous Integration with Docker on AWSContinuous Integration with Docker on AWS
Continuous Integration with Docker on AWS
 
Intro docker and demo monitor on docker
Intro docker and demo monitor on dockerIntro docker and demo monitor on docker
Intro docker and demo monitor on docker
 

More from Sencha

More from Sencha (20)

Breathe New Life into Your Existing JavaScript Applications with Web Components
Breathe New Life into Your Existing JavaScript Applications with Web ComponentsBreathe New Life into Your Existing JavaScript Applications with Web Components
Breathe New Life into Your Existing JavaScript Applications with Web Components
 
Ext JS 6.6 Highlights
Ext JS 6.6 HighlightsExt JS 6.6 Highlights
Ext JS 6.6 Highlights
 
Sencha Roadshow 2017: BufferedStore Internals featuring eyeworkers interactiv...
Sencha Roadshow 2017: BufferedStore Internals featuring eyeworkers interactiv...Sencha Roadshow 2017: BufferedStore Internals featuring eyeworkers interactiv...
Sencha Roadshow 2017: BufferedStore Internals featuring eyeworkers interactiv...
 
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
 
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App TestingSencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
 
Sencha Roadshow 2017: What's New in Sencha Test
Sencha Roadshow 2017: What's New in Sencha TestSencha Roadshow 2017: What's New in Sencha Test
Sencha Roadshow 2017: What's New in Sencha Test
 
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
 
Sencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
Sencha Roadshow 2017: Modernizing the Ext JS Class System and ToolingSencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
Sencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
 
Sencha Roadshow 2017: Sencha Best Practices: Coworkee App
Sencha Roadshow 2017: Sencha Best Practices: Coworkee App Sencha Roadshow 2017: Sencha Best Practices: Coworkee App
Sencha Roadshow 2017: Sencha Best Practices: Coworkee App
 
Sencha Roadshow 2017: Mobile First or Desktop First
Sencha Roadshow 2017: Mobile First or Desktop FirstSencha Roadshow 2017: Mobile First or Desktop First
Sencha Roadshow 2017: Mobile First or Desktop First
 
Sencha Roadshow 2017: Innovations in Ext JS 6.5 and Beyond
Sencha Roadshow 2017: Innovations in Ext JS 6.5 and BeyondSencha Roadshow 2017: Innovations in Ext JS 6.5 and Beyond
Sencha Roadshow 2017: Innovations in Ext JS 6.5 and Beyond
 
Leveraging React and GraphQL to Create a Performant, Scalable Data Grid
Leveraging React and GraphQL to Create a Performant, Scalable Data GridLeveraging React and GraphQL to Create a Performant, Scalable Data Grid
Leveraging React and GraphQL to Create a Performant, Scalable Data Grid
 
Learn Key Insights from The State of Web Application Testing Research Report
Learn Key Insights from The State of Web Application Testing Research ReportLearn Key Insights from The State of Web Application Testing Research Report
Learn Key Insights from The State of Web Application Testing Research Report
 
Introducing ExtReact: Adding Powerful Sencha Components to React Apps
Introducing ExtReact: Adding Powerful Sencha Components to React AppsIntroducing ExtReact: Adding Powerful Sencha Components to React Apps
Introducing ExtReact: Adding Powerful Sencha Components to React Apps
 
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark BrocatoSenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
 
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
 
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
 
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web AppsSenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
 
Ext JS Architecture Best Practices - Mitchell Simeons
Ext JS Architecture Best Practices - Mitchell SimeonsExt JS Architecture Best Practices - Mitchell Simeons
Ext JS Architecture Best Practices - Mitchell Simeons
 
SenchaCon 2016: Mobile First? Desktop First? Or Should you Think Universal Ap...
SenchaCon 2016: Mobile First? Desktop First? Or Should you Think Universal Ap...SenchaCon 2016: Mobile First? Desktop First? Or Should you Think Universal Ap...
SenchaCon 2016: Mobile First? Desktop First? Or Should you Think Universal Ap...
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
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...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe

  • 1. Develop, Test & Deploy with Docker Jonas Schwabe
  • 3. Docker • Containerization instead of virtualization • Containers are lightweight • Prebuilt images instead of VM installation • “Works on my machine!” ⟷ “Works on your machine!”
  • 5. Dependency • Modern software developers need to handle a lot of dependencies • Operating environment • Development tools • Testing infrastructure • Build & Deployment tools • Different projects? Different versions! • Manually: Tedious, time-consuming
  • 6. Software parts • There are multiple separate parts software is being composed of: • ExtJS 6 Frontend • Backend Service • Database Server • Key-Value Store • … • Install / upgrade complicated • Docker: Get a readable & executable definition of how to install / update the stack
  • 7. Environments • The software needs to work on: • Developer’s computers (Windows / MacOS / Linux) • CI Server (Linux) • Staging/Live System (Linux) • What could possibly go wrong?
  • 9. The Image • Read-only “template” for a container • Based on an image which might be based on an image which might be based on… • Contains: • OS • Dependencies • Software • Atomic - One service per image
  • 10. Dockerfile - Define an Image • Base image • Add your Software • Dependencies • Build • Run FROM node:latest ADD src /opt/demo WORKDIR /opt/demo RUN npm install CMD ["npm", "start"]
  • 11. The Container • Derives from an image • Statefull • Runs a command or service • Can interact with other containers • Acts a lot like a VM
  • 12. The Host • Docker runs with modern Linux kernel (> 3.10) • Mac OS & Windows support is available through lightweight Virtual Machines • Using Docker feels nearly the same across all systems • Same CLI for every system • Containers don’t care about the host
  • 14. DockerHub & Registry • Images can be exported and shared • Registries distribute images • Docker Hub hosts loads of public images • You can host your own registry
  • 15. CI Workflow Example • CI Server • Pulls Dockerfile and source code from your VCS • Pulls base image from Docker Hub • Builds an image containing your Project • Pushes the image to a private/public registry • The destination server • Deploys from the private/public registry Source Code Base Image Image Build Dockerfile Container ContainerContainer
  • 17. CMD • Sencha CMD is being packed into the docker image • Upgrade CMD version seamlessly, everyone is synced after a container pull • You will never have to upgrade multiple CI nodes after a local CMD upgrade!
  • 18. Dockerfile • Image will contain a production app which is being served by nginx • For development you can run ‚sencha app watch‘ instead of nginx FROM nginx:latest RUN apt-get update -y && apt-get install -y unzip openjdk-7-jre wget nginx WORKDIR /tmp RUN wget http://cdn.sencha.com/cmd/6.1.3/no-jre/SenchaCmd-6.1.3-linux- amd64.sh.zip RUN unzip SenchaCmd-6.1.3-linux-amd64.sh.zip COPY conf/senchacmd.varfile /tmp/senchacmd.varfile RUN /tmp/`find SenchaCmd*.sh` -q -varfile /tmp/senchacmd.varfile -dir "/opt/sencha" RUN ln -s /opt/sencha/sencha /usr/local/bin/sencha COPY src /opt/demo WORKDIR /opt/demo RUN sencha app build RUN cp -r build/production/demo /usr/share/nginx/html
  • 19. Frontend & Backend • ExtJS developers should not have to worry about their backend • Install & Upgrade should be as easy as running: • docker-compose up • docker-compose up --pull • It actually is that easy:
  • 20. docker-compose.yml • Defines which containers should be started and how they should interact • Defines volumes to map a folder in the container to a folder on the host • Exposes ports through the Host version: '2' services: db: image: mariadb environment: MYSQL_ROOT_PASSWORD: your MYSQL_USER: user MYSQL_PASSWORD: and MYSQL_DATABASE: password back: build: backend ports: - "3000:3000" links: - db front: build: frontend ports: - "1841:1841" command: sencha app watch volumes: - "./frontend/src:/opt/demo"
  • 21. docker-compose • After running ‚docker-compose up‘ with the previous definition: • A database is running • The backend is running and connected to the database • The fronted is running through sencha app watch
  • 23. # git clone git@github.com:jnugh/SenchConExample.git # cd SenchaConExample # docker-compose up [Building front, Pulling DB] Building back Step 1 : FROM node:latest latest: Pulling from library/node 8ad8b3f87b37: Pull complete 751fe39c4d34: Pull complete ae3b77eefc06: Pull complete 7783aac582ec: Pull complete 393ad8a32e58: Pull complete 2d923dade19b: Pull complete Digest: sha256:9cd81e673bde91e503fd5022df5d5ff716b4e518718b2196947b6[…] Status: Downloaded newer image for node:latest ---> e3e7156ded1f Step 2 : ADD src /opt/demo ---> a29df260324a Removing intermediate container 107c296da3f8 Step 3 : WORKDIR /opt/demo ---> Running in 007a0cbdc760 ---> caf3f579d11d Removing intermediate container 007a0cbdc760 Step 4 : RUN npm install ---> Running in 9fd93940d56f npm info it worked if it ends with ok npm info using npm@3.10.3 npm info using node@v6.5.0 npm info lifecycle demo@0.0.0~preinstall: demo@0.0.0 npm info linkStuff demo@0.0.0 npm info lifecycle demo@0.0.0~install: demo@0.0.0 npm info lifecycle demo@0.0.0~postinstall: demo@0.0.0 npm info lifecycle demo@0.0.0~prepublish: demo@0.0.0 npm info ok ---> 6a3b6d45e1b8 Removing intermediate container 9fd93940d56f Step 5 : CMD npm start ---> Running in 9a4d0d11a19b ---> c0bbd78dd304 Removing intermediate container 9a4d0d11a19b Successfully built c0bbd78dd304 Bootstrap a Dev Environment
  • 24. Bootstrap a Dev Environment • Frontend, Backend and DB are up and running as configured • Focus on the code right away
  • 25. # docker-compose logs back Attaching to senchacon2016_back_1 back_1 | npm info it worked if it ends with ok back_1 | npm info using npm@3.10.3 back_1 | npm info using node@v6.4.0 back_1 | npm info lifecycle demo@0.0.0~prestart: demo@0.0.0 back_1 | npm info lifecycle demo@0.0.0~start: demo@0.0.0 back_1 | back_1 | > demo@0.0.0 start /opt/demo back_1 | > node ./bin/www back_1 | back_1 | npm info lifecycle demo@0.0.0~poststart: demo@0.0.0 back_1 | npm info ok back_1 | npm info it worked if it ends with ok back_1 | npm info using npm@3.10.3 back_1 | npm info using node@v6.4.0 back_1 | npm info lifecycle demo@0.0.0~prestart: demo@0.0.0 back_1 | npm info lifecycle demo@0.0.0~start: demo@0.0.0 back_1 | back_1 | > demo@0.0.0 start /opt/demo back_1 | > node ./bin/www back_1 | back_1 | GET / 200 5945.959 ms - 170 back_1 | GET /stylesheets/style.css 200 46.090 ms - 111 back_1 | GET /favicon.ico 404 135.085 ms - 905 back_1 | npm info lifecycle demo@0.0.0~poststart: demo@0.0.0 back_1 | npm info ok # docker-compose logs front Attaching to senchacon2016_front_1 front_1 | Sencha Cmd v6.1.3.42 front_1 | [INF] Processing Build Descriptor : classic front_1 | [INF] Starting server on port : 1841 […] front_1 | [INF] Writing content to /opt/demo/classic.json front_1 | [INF] merging 223 input resources into /opt/demo/build/development/demo/classic/resources front_1 | [INF] merged 0 resources into /opt/demo/build/development/demo/classic/resources front_1 | [INF] merging 18 input resources into /opt/demo/build/development/demo front_1 | [INF] merged 0 resources into /opt/demo/build/development/demo front_1 | [INF] Writing content to /opt/demo/sass/example/bootstrap.json front_1 | [INF] Writing content to /opt/demo/sass/example/bootstrap.js front_1 | [INF] writing sass content to /opt/demo/build/temp/development/demo/sass/demo-all.scss.tmp front_1 | [INF] appending sass content to /opt/demo/build/temp/development/demo/sass/demo-all.scss.tmp front_1 | [INF] appending sass content to /opt/demo/build/temp/development/demo/sass/demo-all.scss.tmp front_1 | [LOG] Building /opt/demo/build/temp/development/demo/sass/demo-all.scss front_1 | [INF] Appending content to /opt/demo/bootstrap.js front_1 | [INF] Writing content to /opt/demo/classic.json front_1 | [INF] Waiting for changes... Logs
  • 26. # docker-compose exec front bash root@d63736c82620:/opt/demo# sencha generate view demo.view.main.TestView Sencha Cmd v6.1.3.42 root@d63736c82620:/opt/demo# ls app/view/demo/view/main/TestView* -la -rw-r--r-- 1 root root 349 Sep 15 10:28 app/view/demo/view/main/TestView.js -rw-r--r-- 1 root root 155 Sep 15 10:28 app/view/demo/view/main/TestViewController.js -rw-r--r-- 1 root root 180 Sep 15 10:28 app/view/demo/view/main/TestViewModel.js Shell
  • 27. Demo • Pull this simple demo from: https://github.com/jnugh/SenchConExample
  • 29. Please Take the Survey in the Mobile App • Navigate to this session in the mobile app • Click on “Evaluate Session” • Respondents will be entered into a A to win one of five $50 Amazon gift cards