Алексей Петров "dockerize me: distributed php applications with symfony, docker,...
TRANSCRIPT
![Page 1: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/1.jpg)
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible
Oleksii Petrov Skelia Ukraine / ETwater Systems skype: alexhelkar twitter: @alexhelkar email: [email protected]
![Page 2: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/2.jpg)
1. What for the goat needs an accordion?
Agenda
![Page 3: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/3.jpg)
Agenda (real)1. SOA and Microservices 2. Dockerized infrastructure 3. Cluster Management 4. Service discovery and failure detection 5. Dockerizing Symfony Applications
![Page 4: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/4.jpg)
SOA and Microservices:7 days of app creation
![Page 5: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/5.jpg)
Day 0 - In beginning was Word…
![Page 7: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/7.jpg)
Day 1. Evening
![Page 9: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/9.jpg)
Day 3
www.example.com
Database
Application
Cache
Application
Cache
Web server
![Page 10: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/10.jpg)
Day 4. Morning
DB Server Crash
![Page 11: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/11.jpg)
Day 4. Night
www.example.com
DatabaseApplication
Cache
Application
Cache
Web server Database
Database
Database Cluster
![Page 12: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/12.jpg)
Day 5
www.example.com
DatabaseApplication
Cache
Application
Cache
Database
Database
Database ClusterWeb server
Cache
Web server
Cache
Web server
Cache
![Page 13: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/13.jpg)
Day 6
Cache
Application
CRUDUsers Authentication Notifications
API calls to 3-rd parties
Background processing
![Page 14: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/14.jpg)
A HA MOMENT
![Page 15: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/15.jpg)
Day 7
www.example.com
Database
Database Cluster
Database Database
Users Service
Authenticationand
AuthorizationService
Notification Service
Crawler Service
Parser Service
Image Resizer Service
Report Generation
Service
Application Cluster
Web server
Web server
Web server
Web Servers Cluster
Cache
Cache
Cache Cluster
![Page 16: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/16.jpg)
Core Idea
Process Component Microservice
![Page 17: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/17.jpg)
Benefits1. Individual scalability 2. Language/Framework independent 3. Small in general
(easier for a developer to understand) 4. Independent development and
deploy process per service
![Page 18: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/18.jpg)
Dockerized Infrastructure
![Page 19: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/19.jpg)
Database
Database Cluster
Database Database
Users Service
Authenticationand
AuthorizationService
Notification Service
Crawler Service
Parser Service
Image Resizer Service
Report Generation
Service
Application Cluster
Cache
Cache
Cache Cluster
MQ
MQ Cluster
MQ
ES
ElasticSearch Cluster
ES ESNginx
Web Servers Cluster
Nginx Nginx
Services - are all about Containers
![Page 20: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/20.jpg)
Software Delivery (before)
![Page 21: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/21.jpg)
Software Delivery (before)
![Page 22: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/22.jpg)
The Game Changer
![Page 23: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/23.jpg)
Software Delivery (now)
![Page 24: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/24.jpg)
Software Delivery (now)
![Page 25: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/25.jpg)
Software Delivery (now)
![Page 26: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/26.jpg)
Dockerfile(DSL)
Docker Image
DockerContainer
App
App 2
App 3
1
2
3
Uniform Processing
![Page 27: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/27.jpg)
Problems?
![Page 28: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/28.jpg)
![Page 29: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/29.jpg)
Where is my services?
Service Discovery
![Page 30: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/30.jpg)
Tomcat10.0.1.17:8080
RabbitMQ10.0.1.171:5672
MongoDB10.0.1.253:27017
API10.0.1.11:80
Service Locator
10.0.1.17:8080 tomcat10.0.1.171:5672 rabbitmq10.0.1.253:27017 mongodb10.0.1.11:3306 api
![Page 31: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/31.jpg)
Looks familiar?
Own DNS?
![Page 32: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/32.jpg)
Solution
Consul by HashiCorp(consul.io)
![Page 33: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/33.jpg)
Service Discovery
Service 4
Service 2
Service 3
Service 1
Service 1
Service 2
Service 3
Service 2
![Page 34: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/34.jpg)
Service Discovery
Service 2
Service 2
Service 2
service2.service.consul
![Page 35: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/35.jpg)
Service Discovery
DNS Masq Consul
External DNS
*.service.consul
![Page 36: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/36.jpg)
Service Discovery
![Page 37: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/37.jpg)
Cluster Management
![Page 38: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/38.jpg)
Server 14 CPU & 16GB RAM
Server 28 CPU & 32GB RAM
Server 31 CPU & 8GB RAM
Server 4 2 CPU & 2GB RAM
Notification Service
API Service
Image Resizer4xCPU
Reporting Service2xRAM
Logger Service
User Service
Resources(servers)
Services(images)
Containers(running)
2x3x
10x
4x
1x1x
![Page 39: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/39.jpg)
Cluster Management
• ECS & ECR (Amazon)• Kubernetes (Google)• Nomad (HashiCorp)• Mesos & Marathon (Apache)
![Page 40: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/40.jpg)
Ansible
![Page 41: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/41.jpg)
hosts: webservers sudo: True tasks: - name: install nginx apt: name=nginx update_cache=yes
- name: copy nginx config file copy: src=files/nginx.conf dest=/etc/nginx/sites-available/default
- name: enable configuration file: > dest=/etc/nginx/sites-enabled/default src=/etc/nginx/sites-available/default state=link
- name: copy index.html template: > src=templates/index.html.j2 dest=/usr/share/nginx/html/index.html mode=0644
- name: restart nginx service: name=nginx state=restarted
Ansible Playbooks
![Page 42: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/42.jpg)
Symfony Appswith Docker
![Page 43: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/43.jpg)
Symfony Apps with Docker
Application Code
Webserver
Database
Cache
PHP-FPM Supervisord
• PHP-FPM • Webserver • Database • Cache
![Page 44: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/44.jpg)
Pitfalls with Docker
![Page 45: Алексей Петров "Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible"](https://reader034.vdocuments.us/reader034/viewer/2022051403/58a6b2841a28ab661f8b472b/html5/thumbnails/45.jpg)
Questions?Oleksii PetrovSkelia Ukraine / ETwater Systems
skype: alexhelkar twitter: @alexhelkar email: [email protected]
Welcome to Kiev PHP User Group