Have you ever heard the phrase: "Everything works fine on my machine?" Docker is here to rescue you. Running your toolchain, Ext JS application, back-end server, and even your database - all in a standardized container format that can be transported and reused, throughout your process. In this session, you will learn how to automate a typical workflow, including developing, testing, and deploying, by using Docker containers and common continuous integration solutions.
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
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