SlideShare a Scribd company logo
1 of 17
Download to read offline
Docker for JS Developer
Nguyen Sy Thanh Son
thanhson1085@gmail.com
@thanhson1085
https://sonnguyen.ws
Developer@Sigma IT Solutions
(Git/DevOps) Lecturer@Techmaster
A Big Fan of Open Source
Member of Docker Hanoi (https://www.facebook.com/dockerhanoi/)
Building a Starter Project
Requirements:
Architecture: Microservices
Culture: DevOps
Backend: NodeJS
Frontend/CMS: AngularJS
Database: MongoDB
Cache/Queue: Redis
Gateway: Nginx
APIs
NPM
ExpressJS
Packages
node-config
winston
mongoose
momentjs
mocha
redis
+-- api-seed
¦ +-- apis
¦ +-- config
¦ +-- Dockerfile
¦ +-- docs
¦ +-- entrypoint.sh
¦ +-- helpers
¦ +-- index.js
¦ +-- middlewares
¦ +-- models
¦ +-- node_modules
¦ +-- package.json
¦ +-- queues
¦ +-- README.md
¦ +-- test
¦ +-- views
APIs - Dockerfile
$ cat api-seed/Dockerfile
FROM mhart/alpine-node:4.4
MAINTAINER Nguyen Sy Thanh Son
RUN npm install -g pm2
WORKDIR /build
COPY ./ /build
EXPOSE 3000
RUN chmod +x /build/entrypoint.sh
RUN cp /build/config/default.json
/build/config/local.json
ENTRYPOINT ["/build/entrypoint.sh"]
$ cat api-seed/entrypoint.sh
#!/bin/sh
cd /build
pm2 start -x --no-daemon index.js
$ docker build -t thanhson1085/api-seed
$ docker push thanhson1085/api-seed
CMS
AngularJS
SB Admin 2
Bower Packages
angular
angular-ui-router
oclazyload
angular-resource
angular-translate
angular-bootstrap
"dependencies": {
"angular": "^1.4.0",
"angular-animate": "^1.5.7",
"bootstrap-sass-official": "^3.2.0",
"angular-touch": "^1.4.0",
"angular-ui-router": "^0.2.18",
"oclazyload": "^1.0.9",
"font-awesome": "fontawesome#^4.6.3",
"angular-resource": "^1.5.7",
"angular-cookies": "^1.5.7",
"angular-bootstrap": "^1.3.3",
"angular-translate": "^2.11.0",
"angular-translate-storage-local": "^2.11.0",
"angular-translate-loader-static-files": "^2.11.0",
"angular-loading-bar": "^0.9.0",
"jquery": "2.2.3"
},
CMS - Dockerfile
$ cat site-seed/Dockerfile
FROM nginx:1.11-alpine
MAINTAINER Nguyen Sy Thanh Son
COPY ./dist/ /usr/share/nginx/html/
EXPOSE 80 443
CMD ["nginx", "-g", "daemon off;"]
+-- site-seed
¦ +-- app
¦ +-- bower_components
¦ +-- bower.json
¦ +-- config
¦ +-- dist
¦ +-- Dockerfile
¦ +-- Gruntfile.js
¦ +-- node_modules
¦ +-- package.json
¦ +-- README.md
¦ +-- test
$ docker build -t thanhson1085/site-seed
$ docker push thanhson1085/site-seed
Orchestration
Orchestration
version: "2"
services:
apis:
image: thanhson1085/api-seed
depends_on:
- db
- redis
networks:
- front-net
- back-net
site:
image: thanhson1085/site-seed
networks:
- front-net
redis:
image: redis:alpine
container_name: redis
networks:
- back-net
db:
image: mongo:3.2
container_name: db
volumes:
- "mongodb:/data/db"
networks:
- back-net
gateway:
image: nginx
container_name: gateway
volumes:
- ./app.template:/etc/nginx/conf.d/default.conf
- ./nginx.template:/etc/nginx/nginx.conf
ports:
- "80:80"
- "443:443"
depends_on:
- apis
networks:
- front-net
volumes:
mongodb:
networks:
front-net:
back-net:
docker-compose.yml
Gateway - Nginx
upstream backend {
server apis:3000;
}
upstream frontend {
server site;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
location /api/ {
rewrite ^/api/(.*)$ /api/$1 break;
proxy_pass http://backend/;
}
location / {
proxy_pass http://frontend/;
}
}
gateway:
image: nginx
container_name: gateway
volumes:
- ./app.template:/etc/nginx/conf.d/default.conf
- ./nginx.template:/etc/nginx/nginx.conf
ports:
- "80:80"
- "443:443"
depends_on:
- apis
networks:
- front-net
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get install -y whois git unzip wget curl
sudo useradd -m -p `mkpasswd password` -s /bin/bash dev
sudo usermod -a -G sudo dev
SHELL
config.vm.provision :shell, path: "./ops/init.sh"
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = 1024
vb.cpus = 2
end
config.vm.define "nodeone" do |n1|
n1.vm.hostname = "nodeone"
n1.vm.network "private_network", ip: "172.20.20.20"
n1.vm.provision :shell, path: "./ops/nodeone.sh"
end
config.vm.define "nodetwo" do |n2|
n2.vm.hostname = "nodetwo"
n2.vm.network "private_network", ip: "172.20.20.21"
n2.vm.provision :shell, path: "./ops/nodetwo.sh"
end
FROM mhart/alpine-node:4.4
MAINTAINER Nguyen Sy Thanh Son
RUN npm install -g pm2
WORKDIR /build
COPY ./ /build
EXPOSE 3000
RUN chmod +x /build/entrypoint.sh
RUN cp /build/config/default.json
/build/config/local.json
ENTRYPOINT ["/build/entrypoint.sh"]
Development Steps
DEMO
https://github.com/thanhson1085/bean-seed
vagrant up
Q&A

More Related Content

What's hot

Docker Container As A Service - March 2016
Docker Container As A Service - March 2016Docker Container As A Service - March 2016
Docker Container As A Service - March 2016Patrick Chanezon
 
Compare Docker deployment options in the public cloud
Compare Docker deployment options in the public cloudCompare Docker deployment options in the public cloud
Compare Docker deployment options in the public cloudSreenivas Makam
 
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)Nils De Moor
 
Docker serverless v1.0
Docker serverless v1.0Docker serverless v1.0
Docker serverless v1.0Thomas Chacko
 
DockerDay2015: Docker orchestration for sysadmin
DockerDay2015: Docker orchestration for sysadminDockerDay2015: Docker orchestration for sysadmin
DockerDay2015: Docker orchestration for sysadminDocker-Hanoi
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slidesDocker, Inc.
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker ComposeAjeet Singh Raina
 
Deploying apps with Docker and Kubernetes
Deploying apps with Docker and KubernetesDeploying apps with Docker and Kubernetes
Deploying apps with Docker and KubernetesDaniel Fenton
 
Docker 1.9 Feature Overview
Docker 1.9 Feature OverviewDocker 1.9 Feature Overview
Docker 1.9 Feature OverviewSreenivas Makam
 
Dockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Dockerizing Windows Server Applications by Ender Barillas and Taylor BrownDockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Dockerizing Windows Server Applications by Ender Barillas and Taylor BrownDocker, Inc.
 
Docker on Google App Engine
Docker on Google App EngineDocker on Google App Engine
Docker on Google App EngineDocker, Inc.
 
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth RushgroveThe Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth RushgroveDocker, Inc.
 
Docker for PHP Developers - Jetbrains
Docker for PHP Developers - JetbrainsDocker for PHP Developers - Jetbrains
Docker for PHP Developers - JetbrainsChris Tankersley
 
Continuous Deployment with Jenkins on Kubernetes
Continuous Deployment with Jenkins on KubernetesContinuous Deployment with Jenkins on Kubernetes
Continuous Deployment with Jenkins on KubernetesMatt Baldwin
 
Container Days Boston - Kubernetes in production
Container Days Boston - Kubernetes in productionContainer Days Boston - Kubernetes in production
Container Days Boston - Kubernetes in productionMike Splain
 
Introduction to Docker Compose | Docker Intermediate Workshop
Introduction to Docker Compose | Docker Intermediate WorkshopIntroduction to Docker Compose | Docker Intermediate Workshop
Introduction to Docker Compose | Docker Intermediate WorkshopAjeet Singh Raina
 
Container orchestration from theory to practice
Container orchestration from theory to practiceContainer orchestration from theory to practice
Container orchestration from theory to practiceDocker, Inc.
 

What's hot (20)

Docker Container As A Service - March 2016
Docker Container As A Service - March 2016Docker Container As A Service - March 2016
Docker Container As A Service - March 2016
 
Compare Docker deployment options in the public cloud
Compare Docker deployment options in the public cloudCompare Docker deployment options in the public cloud
Compare Docker deployment options in the public cloud
 
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
 
Docker serverless v1.0
Docker serverless v1.0Docker serverless v1.0
Docker serverless v1.0
 
DockerDay2015: Docker orchestration for sysadmin
DockerDay2015: Docker orchestration for sysadminDockerDay2015: Docker orchestration for sysadmin
DockerDay2015: Docker orchestration for sysadmin
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker Compose
 
Deploying apps with Docker and Kubernetes
Deploying apps with Docker and KubernetesDeploying apps with Docker and Kubernetes
Deploying apps with Docker and Kubernetes
 
Docker 1.9 Feature Overview
Docker 1.9 Feature OverviewDocker 1.9 Feature Overview
Docker 1.9 Feature Overview
 
Dockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Dockerizing Windows Server Applications by Ender Barillas and Taylor BrownDockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Dockerizing Windows Server Applications by Ender Barillas and Taylor Brown
 
Docker and stuff
Docker and stuffDocker and stuff
Docker and stuff
 
Docker on Google App Engine
Docker on Google App EngineDocker on Google App Engine
Docker on Google App Engine
 
Docker 101 Checonf 2016
Docker 101 Checonf 2016Docker 101 Checonf 2016
Docker 101 Checonf 2016
 
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth RushgroveThe Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
 
Docker for PHP Developers - Jetbrains
Docker for PHP Developers - JetbrainsDocker for PHP Developers - Jetbrains
Docker for PHP Developers - Jetbrains
 
Continuous Deployment with Jenkins on Kubernetes
Continuous Deployment with Jenkins on KubernetesContinuous Deployment with Jenkins on Kubernetes
Continuous Deployment with Jenkins on Kubernetes
 
Docker & Kubernetes intro
Docker & Kubernetes introDocker & Kubernetes intro
Docker & Kubernetes intro
 
Container Days Boston - Kubernetes in production
Container Days Boston - Kubernetes in productionContainer Days Boston - Kubernetes in production
Container Days Boston - Kubernetes in production
 
Introduction to Docker Compose | Docker Intermediate Workshop
Introduction to Docker Compose | Docker Intermediate WorkshopIntroduction to Docker Compose | Docker Intermediate Workshop
Introduction to Docker Compose | Docker Intermediate Workshop
 
Container orchestration from theory to practice
Container orchestration from theory to practiceContainer orchestration from theory to practice
Container orchestration from theory to practice
 

Similar to ContainerDayVietnam2016: Docker for JS Developer

Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetesBen Hall
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Ben Hall
 
Amazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to productionAmazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to productionPaolo latella
 
Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Bo-Yi Wu
 
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 environmentSumedt Jitpukdebodin
 
The Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud NativeThe Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud NativeBen Hall
 
Docker in Production - IPC 2016
Docker in Production - IPC 2016Docker in Production - IPC 2016
Docker in Production - IPC 2016Robert Lemke
 
Ruby on Rails and Docker - Why should I care?
Ruby on Rails and Docker - Why should I care?Ruby on Rails and Docker - Why should I care?
Ruby on Rails and Docker - Why should I care?Adam Hodowany
 
GDG Lima - Docker Compose
GDG Lima - Docker ComposeGDG Lima - Docker Compose
GDG Lima - Docker ComposeMario IC
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceBen Hall
 
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 Cloud-native applications with Java and Kubernetes - Yehor Volkov Cloud-native applications with Java and Kubernetes - Yehor Volkov
Cloud-native applications with Java and Kubernetes - Yehor VolkovKuberton
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Cosimo Streppone
 
Deploying configurable frontend web application containers
Deploying configurable frontend web application containersDeploying configurable frontend web application containers
Deploying configurable frontend web application containersJosé Moreira
 
How Honestbee Does CI/CD on Kubernetes - Vincent DeSmet
How Honestbee Does CI/CD on Kubernetes - Vincent DeSmetHow Honestbee Does CI/CD on Kubernetes - Vincent DeSmet
How Honestbee Does CI/CD on Kubernetes - Vincent DeSmetDevOpsDaysJKT
 
MeaNstack on Docker
MeaNstack on DockerMeaNstack on Docker
MeaNstack on DockerDaniel Ku
 
Docker, the Future of DevOps
Docker, the Future of DevOpsDocker, the Future of DevOps
Docker, the Future of DevOpsandersjanmyr
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionBen Hall
 
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDrupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDropsolid
 
K8s best practices from the field!
K8s best practices from the field!K8s best practices from the field!
K8s best practices from the field!DoiT International
 

Similar to ContainerDayVietnam2016: Docker for JS Developer (20)

Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
Amazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to productionAmazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to production
 
Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署
 
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
 
The Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud NativeThe Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud Native
 
Docker in Production - IPC 2016
Docker in Production - IPC 2016Docker in Production - IPC 2016
Docker in Production - IPC 2016
 
Ruby on Rails and Docker - Why should I care?
Ruby on Rails and Docker - Why should I care?Ruby on Rails and Docker - Why should I care?
Ruby on Rails and Docker - Why should I care?
 
GDG Lima - Docker Compose
GDG Lima - Docker ComposeGDG Lima - Docker Compose
GDG Lima - Docker Compose
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
 
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 Cloud-native applications with Java and Kubernetes - Yehor Volkov Cloud-native applications with Java and Kubernetes - Yehor Volkov
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 
Deploying configurable frontend web application containers
Deploying configurable frontend web application containersDeploying configurable frontend web application containers
Deploying configurable frontend web application containers
 
How Honestbee Does CI/CD on Kubernetes - Vincent DeSmet
How Honestbee Does CI/CD on Kubernetes - Vincent DeSmetHow Honestbee Does CI/CD on Kubernetes - Vincent DeSmet
How Honestbee Does CI/CD on Kubernetes - Vincent DeSmet
 
MeaNstack on Docker
MeaNstack on DockerMeaNstack on Docker
MeaNstack on Docker
 
Docker, the Future of DevOps
Docker, the Future of DevOpsDocker, the Future of DevOps
Docker, the Future of DevOps
 
Sheep it
Sheep itSheep it
Sheep it
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDrupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
 
K8s best practices from the field!
K8s best practices from the field!K8s best practices from the field!
K8s best practices from the field!
 

More from Docker-Hanoi

ContainerDayVietnam2016: Lesson Leanred on Docker 1.12 and Swarm Mode
ContainerDayVietnam2016: Lesson Leanred on Docker 1.12 and Swarm ModeContainerDayVietnam2016: Lesson Leanred on Docker 1.12 and Swarm Mode
ContainerDayVietnam2016: Lesson Leanred on Docker 1.12 and Swarm ModeDocker-Hanoi
 
ContainerDayVietnam2016: Docker 1.12 at OpenFPT
ContainerDayVietnam2016: Docker 1.12 at OpenFPTContainerDayVietnam2016: Docker 1.12 at OpenFPT
ContainerDayVietnam2016: Docker 1.12 at OpenFPTDocker-Hanoi
 
ContainerDayVietnam2016: Containers with OpenStack
ContainerDayVietnam2016: Containers with OpenStackContainerDayVietnam2016: Containers with OpenStack
ContainerDayVietnam2016: Containers with OpenStackDocker-Hanoi
 
Azure Container Service
Azure Container ServiceAzure Container Service
Azure Container ServiceDocker-Hanoi
 
Docker-Ha Noi- Year end 2015 party
Docker-Ha Noi- Year end 2015 partyDocker-Ha Noi- Year end 2015 party
Docker-Ha Noi- Year end 2015 partyDocker-Hanoi
 
DockerDay2015: Introduction to OpenStack Magnum
DockerDay2015: Introduction to OpenStack MagnumDockerDay2015: Introduction to OpenStack Magnum
DockerDay2015: Introduction to OpenStack MagnumDocker-Hanoi
 
DockerDay2015: Keynote
DockerDay2015: KeynoteDockerDay2015: Keynote
DockerDay2015: KeynoteDocker-Hanoi
 
DockerDay2015: Deploy Apps on IBM Bluemix
DockerDay2015: Deploy Apps on IBM BluemixDockerDay2015: Deploy Apps on IBM Bluemix
DockerDay2015: Deploy Apps on IBM BluemixDocker-Hanoi
 
DockerDay2015: Docker Security
DockerDay2015: Docker SecurityDockerDay2015: Docker Security
DockerDay2015: Docker SecurityDocker-Hanoi
 
DockerDay2015: Docker orchestration for developers
DockerDay2015: Docker orchestration for developersDockerDay2015: Docker orchestration for developers
DockerDay2015: Docker orchestration for developersDocker-Hanoi
 
DockerDay2015: Docker Networking
DockerDay2015: Docker NetworkingDockerDay2015: Docker Networking
DockerDay2015: Docker NetworkingDocker-Hanoi
 
DockerDay2015: Getting started with Google Container Engine
DockerDay2015: Getting started with Google Container EngineDockerDay2015: Getting started with Google Container Engine
DockerDay2015: Getting started with Google Container EngineDocker-Hanoi
 
DockerDay2015: Build and monitor a load balanced web application with Docker ...
DockerDay2015: Build and monitor a load balanced web application with Docker ...DockerDay2015: Build and monitor a load balanced web application with Docker ...
DockerDay2015: Build and monitor a load balanced web application with Docker ...Docker-Hanoi
 
DockerDay2015: Introduction to Dockerfile
DockerDay2015: Introduction to DockerfileDockerDay2015: Introduction to Dockerfile
DockerDay2015: Introduction to DockerfileDocker-Hanoi
 
DockerDay2015: Getting started with Docker
DockerDay2015: Getting started with DockerDockerDay2015: Getting started with Docker
DockerDay2015: Getting started with DockerDocker-Hanoi
 
DockerDay2015: Microsoft and Docker
DockerDay2015: Microsoft and DockerDockerDay2015: Microsoft and Docker
DockerDay2015: Microsoft and DockerDocker-Hanoi
 
DockerDay 2015: From months to minutes - How GE appliances brought docker int...
DockerDay 2015: From months to minutes - How GE appliances brought docker int...DockerDay 2015: From months to minutes - How GE appliances brought docker int...
DockerDay 2015: From months to minutes - How GE appliances brought docker int...Docker-Hanoi
 

More from Docker-Hanoi (17)

ContainerDayVietnam2016: Lesson Leanred on Docker 1.12 and Swarm Mode
ContainerDayVietnam2016: Lesson Leanred on Docker 1.12 and Swarm ModeContainerDayVietnam2016: Lesson Leanred on Docker 1.12 and Swarm Mode
ContainerDayVietnam2016: Lesson Leanred on Docker 1.12 and Swarm Mode
 
ContainerDayVietnam2016: Docker 1.12 at OpenFPT
ContainerDayVietnam2016: Docker 1.12 at OpenFPTContainerDayVietnam2016: Docker 1.12 at OpenFPT
ContainerDayVietnam2016: Docker 1.12 at OpenFPT
 
ContainerDayVietnam2016: Containers with OpenStack
ContainerDayVietnam2016: Containers with OpenStackContainerDayVietnam2016: Containers with OpenStack
ContainerDayVietnam2016: Containers with OpenStack
 
Azure Container Service
Azure Container ServiceAzure Container Service
Azure Container Service
 
Docker-Ha Noi- Year end 2015 party
Docker-Ha Noi- Year end 2015 partyDocker-Ha Noi- Year end 2015 party
Docker-Ha Noi- Year end 2015 party
 
DockerDay2015: Introduction to OpenStack Magnum
DockerDay2015: Introduction to OpenStack MagnumDockerDay2015: Introduction to OpenStack Magnum
DockerDay2015: Introduction to OpenStack Magnum
 
DockerDay2015: Keynote
DockerDay2015: KeynoteDockerDay2015: Keynote
DockerDay2015: Keynote
 
DockerDay2015: Deploy Apps on IBM Bluemix
DockerDay2015: Deploy Apps on IBM BluemixDockerDay2015: Deploy Apps on IBM Bluemix
DockerDay2015: Deploy Apps on IBM Bluemix
 
DockerDay2015: Docker Security
DockerDay2015: Docker SecurityDockerDay2015: Docker Security
DockerDay2015: Docker Security
 
DockerDay2015: Docker orchestration for developers
DockerDay2015: Docker orchestration for developersDockerDay2015: Docker orchestration for developers
DockerDay2015: Docker orchestration for developers
 
DockerDay2015: Docker Networking
DockerDay2015: Docker NetworkingDockerDay2015: Docker Networking
DockerDay2015: Docker Networking
 
DockerDay2015: Getting started with Google Container Engine
DockerDay2015: Getting started with Google Container EngineDockerDay2015: Getting started with Google Container Engine
DockerDay2015: Getting started with Google Container Engine
 
DockerDay2015: Build and monitor a load balanced web application with Docker ...
DockerDay2015: Build and monitor a load balanced web application with Docker ...DockerDay2015: Build and monitor a load balanced web application with Docker ...
DockerDay2015: Build and monitor a load balanced web application with Docker ...
 
DockerDay2015: Introduction to Dockerfile
DockerDay2015: Introduction to DockerfileDockerDay2015: Introduction to Dockerfile
DockerDay2015: Introduction to Dockerfile
 
DockerDay2015: Getting started with Docker
DockerDay2015: Getting started with DockerDockerDay2015: Getting started with Docker
DockerDay2015: Getting started with Docker
 
DockerDay2015: Microsoft and Docker
DockerDay2015: Microsoft and DockerDockerDay2015: Microsoft and Docker
DockerDay2015: Microsoft and Docker
 
DockerDay 2015: From months to minutes - How GE appliances brought docker int...
DockerDay 2015: From months to minutes - How GE appliances brought docker int...DockerDay 2015: From months to minutes - How GE appliances brought docker int...
DockerDay 2015: From months to minutes - How GE appliances brought docker int...
 

Recently uploaded

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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...Drew Madelung
 
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 Scriptwesley chun
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
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 productivityPrincipled Technologies
 
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 2024The Digital Insurer
 
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
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 

Recently uploaded (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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...
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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?
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

ContainerDayVietnam2016: Docker for JS Developer

  • 1. Docker for JS Developer
  • 2. Nguyen Sy Thanh Son thanhson1085@gmail.com @thanhson1085 https://sonnguyen.ws Developer@Sigma IT Solutions (Git/DevOps) Lecturer@Techmaster A Big Fan of Open Source Member of Docker Hanoi (https://www.facebook.com/dockerhanoi/)
  • 3. Building a Starter Project Requirements: Architecture: Microservices Culture: DevOps Backend: NodeJS Frontend/CMS: AngularJS Database: MongoDB Cache/Queue: Redis Gateway: Nginx
  • 4.
  • 5.
  • 6. APIs NPM ExpressJS Packages node-config winston mongoose momentjs mocha redis +-- api-seed ¦ +-- apis ¦ +-- config ¦ +-- Dockerfile ¦ +-- docs ¦ +-- entrypoint.sh ¦ +-- helpers ¦ +-- index.js ¦ +-- middlewares ¦ +-- models ¦ +-- node_modules ¦ +-- package.json ¦ +-- queues ¦ +-- README.md ¦ +-- test ¦ +-- views
  • 7. APIs - Dockerfile $ cat api-seed/Dockerfile FROM mhart/alpine-node:4.4 MAINTAINER Nguyen Sy Thanh Son RUN npm install -g pm2 WORKDIR /build COPY ./ /build EXPOSE 3000 RUN chmod +x /build/entrypoint.sh RUN cp /build/config/default.json /build/config/local.json ENTRYPOINT ["/build/entrypoint.sh"] $ cat api-seed/entrypoint.sh #!/bin/sh cd /build pm2 start -x --no-daemon index.js $ docker build -t thanhson1085/api-seed $ docker push thanhson1085/api-seed
  • 9. Bower Packages angular angular-ui-router oclazyload angular-resource angular-translate angular-bootstrap "dependencies": { "angular": "^1.4.0", "angular-animate": "^1.5.7", "bootstrap-sass-official": "^3.2.0", "angular-touch": "^1.4.0", "angular-ui-router": "^0.2.18", "oclazyload": "^1.0.9", "font-awesome": "fontawesome#^4.6.3", "angular-resource": "^1.5.7", "angular-cookies": "^1.5.7", "angular-bootstrap": "^1.3.3", "angular-translate": "^2.11.0", "angular-translate-storage-local": "^2.11.0", "angular-translate-loader-static-files": "^2.11.0", "angular-loading-bar": "^0.9.0", "jquery": "2.2.3" },
  • 10. CMS - Dockerfile $ cat site-seed/Dockerfile FROM nginx:1.11-alpine MAINTAINER Nguyen Sy Thanh Son COPY ./dist/ /usr/share/nginx/html/ EXPOSE 80 443 CMD ["nginx", "-g", "daemon off;"] +-- site-seed ¦ +-- app ¦ +-- bower_components ¦ +-- bower.json ¦ +-- config ¦ +-- dist ¦ +-- Dockerfile ¦ +-- Gruntfile.js ¦ +-- node_modules ¦ +-- package.json ¦ +-- README.md ¦ +-- test $ docker build -t thanhson1085/site-seed $ docker push thanhson1085/site-seed
  • 12. Orchestration version: "2" services: apis: image: thanhson1085/api-seed depends_on: - db - redis networks: - front-net - back-net site: image: thanhson1085/site-seed networks: - front-net redis: image: redis:alpine container_name: redis networks: - back-net db: image: mongo:3.2 container_name: db volumes: - "mongodb:/data/db" networks: - back-net gateway: image: nginx container_name: gateway volumes: - ./app.template:/etc/nginx/conf.d/default.conf - ./nginx.template:/etc/nginx/nginx.conf ports: - "80:80" - "443:443" depends_on: - apis networks: - front-net volumes: mongodb: networks: front-net: back-net: docker-compose.yml
  • 13. Gateway - Nginx upstream backend { server apis:3000; } upstream frontend { server site; } server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; location /api/ { rewrite ^/api/(.*)$ /api/$1 break; proxy_pass http://backend/; } location / { proxy_pass http://frontend/; } } gateway: image: nginx container_name: gateway volumes: - ./app.template:/etc/nginx/conf.d/default.conf - ./nginx.template:/etc/nginx/nginx.conf ports: - "80:80" - "443:443" depends_on: - apis networks: - front-net
  • 14. Vagrant.configure(2) do |config| config.vm.box = "ubuntu/trusty64" config.vm.provision "shell", inline: <<-SHELL sudo apt-get update sudo apt-get install -y whois git unzip wget curl sudo useradd -m -p `mkpasswd password` -s /bin/bash dev sudo usermod -a -G sudo dev SHELL config.vm.provision :shell, path: "./ops/init.sh" config.vm.provider "virtualbox" do |vb| vb.gui = false vb.memory = 1024 vb.cpus = 2 end config.vm.define "nodeone" do |n1| n1.vm.hostname = "nodeone" n1.vm.network "private_network", ip: "172.20.20.20" n1.vm.provision :shell, path: "./ops/nodeone.sh" end config.vm.define "nodetwo" do |n2| n2.vm.hostname = "nodetwo" n2.vm.network "private_network", ip: "172.20.20.21" n2.vm.provision :shell, path: "./ops/nodetwo.sh" end FROM mhart/alpine-node:4.4 MAINTAINER Nguyen Sy Thanh Son RUN npm install -g pm2 WORKDIR /build COPY ./ /build EXPOSE 3000 RUN chmod +x /build/entrypoint.sh RUN cp /build/config/default.json /build/config/local.json ENTRYPOINT ["/build/entrypoint.sh"]
  • 17. Q&A