MTI
DevOps
Course planning
Main content
Docker
DevOps
Create a project for production environment
Secondary content
It's your course, so what you want
DevOps
Why When How
The Why
Why
"Ops" issues:
"Dev" issues:
Why
Why
4 distincts phases:
DevOps
Why When How
The When
When
Use case:
But:
DevOps
Why When How
The How
How
Remember:
2/3 Communication & 1/3 Technical
Communication part
Ops to Dev
Ops has a better vision than a Dev
Dev to Ops
Dev can optimize work of both part
How
Technical part
Two way of testing
Continuous Integration : CI
And these for each targeted environment
The role of the integration server is to control and to manage the results: test, reliability, code analysis
How
Technical part
Continuous Delivery : CD
This phase means the possibility to deploy a features whenever we want.
This step depends on the previous checks
We can also stack features in this step, and finally deploy all of them in one go
Continuous Deployment contains these process and methodology which let us do continuous deployment in production
Unfortunately, the continuous deployment process is far from simple to implement because it is dependent on all the players in the company's information system.
Tools
SCM:
CI:
Deployment:
Cloud / LaaS / PaaS:
Config:
Testing:
Collaboration:
Containerization:
Docker
docker
Dockerfile
docker-machine
docker-compose
Docker
Build a container
docker build -t username/projectname /path/to/dockerfile
Run an image (Basic)
docker run username/projectname
Run an image (Interactive, publish port, named image)
docker run -i --name=imagename -p 80:8080 username/projectname
Stop an image
docker stop imagename
Remove an image
docker rm imagename
List all image
docker ps -a
Dockerfile
Dockerfile
Whenever possible, use current Official Repositories as the basis
FROM <image>:<tag>
Use RUN to execute specific command
RUN <cmd>
Expose is used to expose container's port to the host
EXPOSE <port>
Use ENTRYPOINT and CMD to start the container with explicit cmd / parameters
ENTRYPOINT ["entry_1", "entry_2", ...]
CMD["cmd_1", "cmd_2", ...]
docker-machine
docker-machine is a Service like process
On windows
docker-machine stop
docker-machine start
docker-machine restart
You can (auto) configure docker-machine environment
docker-machine env
You may have to configure your shell as well (Windows example)
eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env)
On linux / Ubuntu / redhat / fedora
(sudo) (systemctl) stop docker
(sudo) (systemctl) start docker
(sudo) (systemctl) restart docker
docker-compose
docker-compose lets you build and run multiple containers as you can do with a script
run docker-compose.yml with docker-compose up
web:
build /path/to/dockerfile
ports:
- "80:8080"
links:
redis
redis:
image: redis:latest
ports:
- "6379:6379"
https://github.com/adrienfenech/nodejs_server
Play with it: