<MQA Meetup#11/>
Dockerizing React
App
2019
11 / 20
Mochammad Syaifuddin
Khasani
Devops Engineer at Jagoanhosting
● Product Innovation Team
● Redhat Certified System Admin
● Mikrotik Certified Network Associate
Applications are Transforming at JAGOAN HOSTING
Super Server 100+ Apps Running at many small server
2007 NOW
2 Ops
Mysql
NGINX
PHP
Redis
Super Server
Mysql
NGINX
DNS
Redis
Super Server
Mys
ql
NGI
NX
DNS
Red
is
Super Server
First Create After 1 Year
Difficult to Scale
Monolithic
Architecture
● Difficult to scale in and out
● Dependency hell
● Prune to errors
● Slow
Mysql
APACHE
DNS
MAIL
Super Server
Mysql
APACHE
DNS
MAIL
Super Server
VM VM VM VM
Microservice
Architecture
Each services are decoupled
(separated) and can be managed
independently. It is elastic, meaning
that it can scale in and out easily to
meet fluctuating demand.
Microservices mostly used by small
team.
Developer want to develop faster. But
operational want our app reliable.
Our Challenges
● Conflict between developer and operational needs.
● Applications are limited by hardware resource.
● Different environment between development and production stage.
Want Something Just Like This
What makes that happen?
A Standard to Run Apps
# docker run -p 80:80 -d nginx
Server
Docker
OS
# apt-get update
# apt-get install nginx
# service nginx start
Server
Ubuntu OS
# yum install epel-release
# yum install nginx
# systemctl start nginx
Server
Centos OS
“CONTAINER”
Standard unit of software that packages up code and all its
dependencies so the application runs quickly and reliably from one
computing environment to another.
Container vs VM
https://www.docker.com/resources/what-container
“DOCKERIZE”
Create a Docker image of your application. Images become containers
when they run on Docker Engine.
Development Flow
Version Control
System
CI / CD Docker Image Deploy
Creating Docker Image
Example
Scenario
● System Requirements :
○ MongoDB Server
○ Node.js >= v10.15
Github : https://github.com/qamalang/nodejs-simple-api
Things to Do
Specify your application
needs.
Create a Dockerfile.
Build the Docker Image.
Push it to public registry.
1
2
3
4
# Specify your base image.
# We will use NodeJS version 12.13
FROM node:12.13.0-alpine
# Copy all files inside app directory to /app inside
the container
COPY app/ /app
# Change working directory to /app within the
container
WORKDIR /app
# Install all dependencies
RUN npm install
RUN npm install nodemon -g
# Run your scripts inside package.json
CMD ["npm", "start"]
Dockerfile
Use Public Registry - Create Repository
1. Build the Docker image :
→ docker build . -t <image_name>:<tag>
2. Run it :
→ docker run -d -p 3000:3000 <image_name>
3. Push it to registry :
→ docker login -u <your_username>
→ docker tag <local-image>:<tagname> <new-repo>:<tagname>
→ docker push <new-repo>:<tagname>
Run that commands inside Docker Host.
Result
Where to Learn?
● docs.docker.com
● Katacoda.com
● Qwiklabs.com
● Using Google Cloud
● training.play-with-docker.com
● Pelajar.in
● 12factor.net
● Learn from Community
Mulai langkah Keren-mu dari Sekarang di :
JADI TUA ITU PASTI,
JADI KEREN ITU PILIHAN
w w w . j a g o a n h o s t i n g . c o m
bit.ly/skuymagang
jaghostidJagoan Hosting Indonesia
Mochammad Syaifuddin
Devops Engineer
Contact :
+62838-4655-4487
syaifuddin@jagoanhosting.com

Dockerizing react app

Editor's Notes

  • #7 Penjelasan monolithic itu apa. Use case monolithic apa. Jelaskan satu persatu poin di atas.
  • #9 Service dikelompokkan jadi satu. Bisa dimanage secara independent. Bisa di scale tanpa bergantung dengan service lain.
  • #18 Multiple containers can run on the same machine. Virtual machines (VMs) are an abstraction of physical hardware turning one server into many servers. Each VM includes a full copy of an operating system.
  • #29 Buat kamu yang ingin menjadi bagian untuk menghasilkan solusi-solusi, product-product keren.