SlideShare una empresa de Scribd logo
1 de 17
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

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.
 

La actualidad más candente (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 a 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 a 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!
 

Más de 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
 

Más de 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...
 

Último

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 

Último (20)

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 

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