Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Dockerize Me: Distributed PHP
applications with Symfony, Docker,
Consul and Ansible
Oleksii Petrov
Skelia Ukraine / ETwate...
1. What for the goat needs
an accordion?
Agenda
Agenda (real)
1. SOA and Microservices
2. Dockerized infrastructure
3. Cluster Management
4. Service discovery and failure...
SOA and Microservices:
7 days of app creation
Day 0 - In beginning was Word…
Day 1
www.example.com
Web server
Application
Database
Day 1. Evening
Day 2
www.example.com
Web server
Application Database
Cache
Day 3
www.example.com
Database
Application
Cache
Application
Cache
Web server
Day 4. Morning
DB Server Crash
Day 4. Night
www.example.com
DatabaseApplication
Cache
Application
Cache
Web server Database
Database
Database Cluster
Day 5
www.example.com
Database
Application
Cache
Application
Cache
Database
Database
Database Cluster
Web server
Cache
Web...
Day 6
Cache
Application
CRUD
Users
Authentication Notifications
API calls
to 3-rd
parties
Background
processing
A HA MOMENT
Day 7
www.example.com
Database
Database Cluster
Database Database
Users
Service
Authentication
and
Authorization
Service
N...
Core Idea
Process Component Microservice
Benefits
1. Individual scalability
2. Language/Framework independent
3. Small in general
(easier for a developer to unders...
Dockerized
Infrastructure
Database
Database Cluster
Database Database
Users
Service
Authentication
and
Authorization
Service
Notification
Service
Cr...
Software Delivery (before)
Software Delivery (before)
The Game Changer
Software Delivery (now)
Software Delivery (now)
Software Delivery (now)
Dockerfile
(DSL)
Docker
Image
Docker
Container
App
App 2
App 3
1
2
3
Uniform Processing
Problems?
Where is my services?
Service Discovery
Tomcat
10.0.1.17:8080
RabbitMQ
10.0.1.171:5672
MongoDB
10.0.1.253:27017
API
10.0.1.11:80
Service Locator
10.0.1.17:8080 to...
Looks familiar?
Own DNS?
Solution
Consul by HashiCorp
(consul.io)
Service Discovery
Service 4
Service 2
Service 3
Service 1
Service 1
Service 2
Service 3
Service 2
Service Discovery
Service 2
Service 2
Service 2
service2.service.consul
Service Discovery
DNS Masq Consul
External DNS
*.service.consul
Service Discovery
Cluster Management
Server 1
4 CPU & 16GB RAM
Server 2
8 CPU & 32GB RAM
Server 3
1 CPU & 8GB RAM
Server 4
2 CPU & 2GB RAM
Notification Service...
Cluster Management
• ECS & ECR (Amazon)
• Kubernetes (Google)
• Nomad (HashiCorp)
• Mesos & Marathon (Apache)
Ansible
hosts: webservers
sudo: True
tasks:
- name: install nginx
apt: name=nginx update_cache=yes
- name: copy nginx config file
...
Symfony Apps
with Docker
Symfony Apps with
Docker
Application Code
Webserver
Database
Cache
PHP-FPM Supervisord
• PHP-FPM
• Webserver
• Database
• ...
Pitfalls with Docker
Questions?
Oleksii Petrov
Skelia Ukraine / ETwater Systems
skype: alexhelkar
twitter: @alexhelkar
email: alexhelkar@gmail....
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible
Upcoming SlideShare
Loading in …5
×

Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible

6,895 views

Published on

7 days of the App Creation, SOA and Microservices, Service Discovery, Docker, Ansible

Published in: Software
  • Writing a good research paper isn't easy and it's the fruit of hard work. For help you can check writing expert. Check out, please ⇒ www.HelpWriting.net ⇐ I think they are the best
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating for everyone is here: ❶❶❶ http://bit.ly/2u6xbL5 ❶❶❶
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Follow the link, new dating source: ❶❶❶ http://bit.ly/2u6xbL5 ❶❶❶
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Symfony Docker Service Oriented Architecture : https://github.com/mediafigaro/docker-symfony
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible

  1. 1. Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and Ansible Oleksii Petrov Skelia Ukraine / ETwater Systems skype: alexhelkar twitter: @alexhelkar email: alexhelkar@gmail.com
  2. 2. 1. What for the goat needs an accordion? Agenda
  3. 3. Agenda (real) 1. SOA and Microservices 2. Dockerized infrastructure 3. Cluster Management 4. Service discovery and failure detection 5. Dockerizing Symfony Applications
  4. 4. SOA and Microservices: 7 days of app creation
  5. 5. Day 0 - In beginning was Word…
  6. 6. Day 1 www.example.com Web server Application Database
  7. 7. Day 1. Evening
  8. 8. Day 2 www.example.com Web server Application Database Cache
  9. 9. Day 3 www.example.com Database Application Cache Application Cache Web server
  10. 10. Day 4. Morning DB Server Crash
  11. 11. Day 4. Night www.example.com DatabaseApplication Cache Application Cache Web server Database Database Database Cluster
  12. 12. Day 5 www.example.com Database Application Cache Application Cache Database Database Database Cluster Web server Cache Web server Cache Web server Cache
  13. 13. Day 6 Cache Application CRUD Users Authentication Notifications API calls to 3-rd parties Background processing
  14. 14. A HA MOMENT
  15. 15. Day 7 www.example.com Database Database Cluster Database Database Users Service Authentication and Authorization Service 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
  16. 16. Core Idea Process Component Microservice
  17. 17. Benefits 1. Individual scalability 2. Language/Framework independent 3. Small in general (easier for a developer to understand) 4. Independent development and deploy process per service
  18. 18. Dockerized Infrastructure
  19. 19. Database Database Cluster Database Database Users Service Authentication and Authorization Service 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
  20. 20. Software Delivery (before)
  21. 21. Software Delivery (before)
  22. 22. The Game Changer
  23. 23. Software Delivery (now)
  24. 24. Software Delivery (now)
  25. 25. Software Delivery (now)
  26. 26. Dockerfile (DSL) Docker Image Docker Container App App 2 App 3 1 2 3 Uniform Processing
  27. 27. Problems?
  28. 28. Where is my services? Service Discovery
  29. 29. Tomcat 10.0.1.17:8080 RabbitMQ 10.0.1.171:5672 MongoDB 10.0.1.253:27017 API 10.0.1.11:80 Service Locator 10.0.1.17:8080 tomcat 10.0.1.171:5672 rabbitmq 10.0.1.253:27017 mongodb 10.0.1.11:3306 api
  30. 30. Looks familiar? Own DNS?
  31. 31. Solution Consul by HashiCorp (consul.io)
  32. 32. Service Discovery Service 4 Service 2 Service 3 Service 1 Service 1 Service 2 Service 3 Service 2
  33. 33. Service Discovery Service 2 Service 2 Service 2 service2.service.consul
  34. 34. Service Discovery DNS Masq Consul External DNS *.service.consul
  35. 35. Service Discovery
  36. 36. Cluster Management
  37. 37. Server 1 4 CPU & 16GB RAM Server 2 8 CPU & 32GB RAM Server 3 1 CPU & 8GB RAM Server 4 2 CPU & 2GB RAM Notification Service API Service Image Resizer 4xCPU Reporting Service 2xRAM Logger Service User Service Resources (servers) Services (images) Containers (running) 2x 3x 10x 4x 1x 1x
  38. 38. Cluster Management • ECS & ECR (Amazon) • Kubernetes (Google) • Nomad (HashiCorp) • Mesos & Marathon (Apache)
  39. 39. Ansible
  40. 40. 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
  41. 41. Symfony Apps with Docker
  42. 42. Symfony Apps with Docker Application Code Webserver Database Cache PHP-FPM Supervisord • PHP-FPM • Webserver • Database • Cache
  43. 43. Pitfalls with Docker
  44. 44. Questions? Oleksii Petrov Skelia Ukraine / ETwater Systems skype: alexhelkar twitter: @alexhelkar email: alexhelkar@gmail.com Welcome to Kiev PHP User Group

×