Link To Slides bit.ly/introdocker
Notes:
docker pull docker.io/bityob/docker-python-app
docker pull nginx
- Micro Services
- Containers
- Docker
Notes:
In software engineering, a monolithic application describes a single-tiered software application... code are combined into a single program from a single platform.
Notes:
Source: https://bits.citrusbyte.com/microservices/
- Less cross-cutting concerns
- Easier debugging and testing
- Simple to deploy
Notes:
https://www.n-ix.com/microservices-vs-monolith-which-architecture-best-choice-your-business/
- Cross-cutting concerns are the concerns that affect the whole application such as logging, handling, caching, and performance monitoring. Only one application so it is easier to handle it.
- Since a monolithic app is a single indivisible unit, you can run end-to-end testing much faster.
- Easier deployment. When it comes to monolithic applications, you do not have to handle many deployments - just one file or directory.
- Understanding
- Making changes
- Scalability
- New technology barriers
Notes:
https://www.n-ix.com/microservices-vs-monolith-which-architecture-best-choice-your-business/
- When a monolithic application scales up, it becomes too complicated to understand
- It is harder to implement changes in such a large and complex application with highly tight coupling. Any code change affects the whole system so it has to be thoroughly coordinated. This makes the overall development process much longer.
- Scalability. You cannot scale components independently, only the whole application.
- New technology barriers. It is extremely problematic to apply a new technology in a monolithic application because then the entire application has to be rewritten.
Source: Medium/startlovingyourself
Note:
- Describe what is a micro service
- After we explained what is a monolithic service, we can see how differ are micro services
- Not only one service which does everything, but multiple services, each with it's own responsibility
- Easy to scale, easy to develop each part
- Single Responsibility Principle
- Application is easier to understand, develop and test
- Allows high scalability and reusability
- Parallelizes development
- Enable continuous delivery and deployment
- Better fault isolation
- Code can be written in different languages
Note:
Source:
Idan's vNext Architecture presentation - https://microsoft.sharepoint.com/teams/osg_core_ens/wcd/Shared%20Documents/Architecture/WD%20ATP%20vNext%20Architecture.pptx
Source: RedbadgerTeam
Notes:
- Containers are a technology which best fit to this need of micro services
- What are containers?
Links -
https://blog.red-badger.com/blog/deploy-a-microservices-application-as-though-it-was-a-monolith http://blog.enabled.com.au/microservices-innovation/
Notes:
- Different size, weights etc.
- Need addoption in all roads
Notes:
- Container with same size
- All cargo inside, all fits
- Osim Historia - https://www.ranlevi.com/2017/03/09/osim_historia_ep212_containers_part1/
Docker is an open platform for developing, shipping, and running applications.
Docker allows you to package an application with all of its dependencies into a standardized unit for software development.
Notes:
- Docker is a container implementaion
Notes:
- Same kernel for all apps
- Fast (deployment, migration, restarts)
- Secure
- Lightweight (save disk & CPU)
- Open Source
- Portable software
- Microservices and integrations (APIs)
- Simplify DevOps
- Version control capabilities
- Easy configuration (Dockerfile)
Notes:
- Avoid "Works on my machine."
- Ship container images with all their dependencies
- Break image into layers
- Only ship layers that have changed
- Save disk, network, memory usage
- Sandbox environment (develop, test, debug, educate)
- Continuous Integration & Deployment
- Scaling apps
- Development collaboration
- Local development
- Linux x86-64
- Go language
- Namespaces (pid, net, ipc, mnt, uts)
- Control Groups (cgroups)
- Union file systems (UnionFS)
- Client - Server (deamon) architecture
- Container format (libcontainer)
Notes:
Namespaces - provide a layer of isolation Control Groups - limits an application to a specific set of resources. UnionFS - It allows files and directories of separate file systems, known as branches, to be transparently overlaid, forming a single coherent file system Continer Format - All together
https://docs.docker.com/engine/docker-overview/
See more at Understanding docker
Notes:
- images
- container
- (Docker) client
- daemon/engine
- registry
- image
- container
- Dockerfile
It is the primary user interface to Docker. It accepts commands from the user and communicates back and forth with a Docker daemon.
It runs on a host machine. The user does not directly interact with the daemon, but instead through the Docker client with the RESTful api or sockets.
A (hosted) service containing repositories of images which responds to the Registry API.
Notes:
- Go to registry docker hub
Notes:
- Docker push/pull only new layers
A Dockerfile is a text document that contains all the commands a user could call on the command line to create an image.
Notes:
- Later we will dive in, after demo of running docker
Notes:
- Demo
docker run -d -p 8080:80 nginx
Notes:
- Demo docker run -p 8888:80 -v c:/Users/yobitton/Documents/Code/presentations/intro-docker/examples/nginx:/usr/share/nginx/html nginx
Change file, see changes...
Browser - http://localhost:8888/
Notes:
-
Demo
-
Images list
-
Nginx logs (detached, after access the page once)
Notes:
- Demo (from wsl)
bit@YOBITTON-surface:/mnt/c/Users/yobitton/Documents/Code/presentations/intro-docker/examples/webapp$ python3 app.py INFO: Started server process [1018] INFO: Waiting for application startup. INFO: Uvicorn running on http://127.0.0.1:5000 (Press CTRL+C to quit)
http://localhost:5000/ -> Hello Micro Services... http://localhost:5000/name/yonatan -> Hello Yonatan http://localhost:5000/index -> read index file
Notes:
- Explain each line
Repo Link bit.ly/pythonweb
Notes:
docker build . -t docker.io/bityob/docker-python-app
docker pull docker.io/bityob/docker-python-app
Notes:
Demo (from windows) -
docker run --name webapp -p 5555:5000 docker.io/bityob/docker-python-app
C:\WINDOWS\system32>docker run -p 5555:5000 docker.io/bityob/docker-python-app INFO: Started server process [6] INFO: Waiting for application startup. INFO: Uvicorn running on http://0.0.0.0:5000 (Press CTRL+C to quit) INFO: ('172.17.0.1', 48992) - "GET / HTTP/1.1" 200 INFO: ('172.17.0.1', 48992) - "GET /favicon.ico HTTP/1.1" 404
Notes:
docker exec -it webapp bash
- Awesome Docker (list of Docker resources)
- Docker cheat sheet (GitHub, Docker Pdf)
- Docker aliases/shortcuts
- Docker Tips examples/tips
- Introduction to Docker (US PyCon 2016, Slides)