Development Environment With Docker

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 14

Development Environment

with Docker
Development Environment
 In normal case

Development Environment

Dev’s PC Tester’s PC Test Env Release


Env

 Developer must set-up his own pc for coding


 Windows
 Apache
 PHP
 MySQL
 Tester must set-up her own pc for testing
 Windows
 Apache
 PHP
 MySQL
 After developing a feature, Dev sends ( by some ways ) what he has done to Tester
Development Environment
 Dev and Tester don’t have the same Environment
 Development Environment is difference with Release
Environment
 It’s hard to change Environment when necessary
 It’s spent much time for new member to join the team
ThoLT’s solution with Docker
 Push all Devs and Testers to Docker Environment
Development Environment with Docker

port 8081 port 80


port 80 port 8084

Container

Container
http

Test1’s
Dev1’s
http

port 2201 port 22


port 22 port 2204

Container
Dev3’s
ssh
ssh
Dev1 DB
Tester1 DB
Dev2 DB
port 8082 port 80 Tester2 DB port 80 port 8084
Dev3 DB

Container
http http

Test2’s
Container
Dev2’s

MySQL Server
port 2202 port 22 port 22 port 2204
ssh ssh

port 8083 port 80


http
port 2203 port 22
ssh
ThoLT’s solution with Docker
 A Docker Image has been prepared in advance for
everyone
 Dev and Tester work with their Docker containers with
same environment: OS, Apache version, PHP version
 Development Environment is similar as Production
Environment
 Easy to have additional environment from another Docker
Image
 Actually, Dev still works in his PC before uploading code
to his container for unit testing ( thru SSH)
ThoLT’s solution with Docker
 Disadvantages:
 Each Dev or Test has a set of ports for his environment
 Technical Leader must create and init the environment for
Dev/Test manually
VietVH’s Solution with Docker
Development Environment with Docker
http://test1.vsii.com

Container
Dev2’s
http://dev2.vsii.com

Container
Test1’s
Dev1 DB
NGINX

Container
Dev1’s Tester1 DB
http dev1 Dev2 DB

Container
Test2’s
Tester2 DB
Dev3 DB

Container
Dev3’s
MySQL Server
ssh http://dev3.vsii.com

http://test2.vsii.com

Dev1’s Dev2’s Dev3’s Test1’s Test2’s


Sandbox Sandbox Sandbox Sandbox Sandbox

File system
VietVH’s Solution with Docker
 Add new member to the team
 sudo configurenewuser.sh newdev newpass
 This command does:
 Create new user for newdev with his sandbox
 Create new Docker container for the new user
 Create new MySQL User and Database for him
 Config Nginx to point http://newdev.vsii.com to the Docker
container
 Clone the git repo to his sanbox
 Now, the new workspace for the new user is ready
VietVH’s Solution with Docker

http Newdev’s
Docker container

ssh Newdev’s
Upload source code sandbox
VietVH’s Solution with Docker
 User starts working with new Feature Branch form his
Sandbox
 SSH to the Docker Machine:
 ssh newdev@newdev.vsii.com
 Choose the Feature Branch
 startwithbranch.sh Feature1
 Install Master Data
 dbsetup.sh
 Access the project thru http
 http://newdev.vsii.com/projectname
VietVH’s Solution with Docker
 Demo:
 Docker 1.5
 Gitlab for Git Repo
 Ubuntu Linux 15
 Apache 2.4.10
 PHP 5.6
 Nginx 1.6.2
 Drupal as the Project
 User: dev1, dev2, tester1
VietVH’s Solution with Docker
 Advantages:
 Inherits all advantage of ThoLT’s solution
 Easy for Technical Leader setups the environment for new
member
 Easy for Dev / Tester choose the Feature to work
 Easy to do the Testing
 Disadvantages:
 Developer still must upload his code to his sandbox for Unit
Testing
 Actually, he still has his environment in his PC first
 Warning: Please no use synchronize code mechanism
It spends so much resource of server for synchronizing
Second Solution: Using Docker in Window
 Install Docker Machine in Window ( or Mac, Ubuntu
Desktop )
 Pull the built Docker Image from server
 This Image is built from Docker file and enable to download
 Run Docker Container on Windows
 Developer will work on his PC directly, he could do whatever
he wants
Resource
 Scripts:
 http://gitlab.vsii.com/SEPG/ci-project/tree/vietvh

You might also like