SlideShare a Scribd company logo
Jak se ^bonami.(cz|pl|sk)$ vešlo
do kontejneru
Václav Boch, Bonami.cz
31.3.2016
What you can use for deployment?
• FTP
• SFTP/SSHFS
• GIT
• Bash
• Capistrano
• RPM
• Docker
Docker
• Docker is shipping container for your application.
• Contains everything that your app needs.
Virtualization vs. Docker
App
A
Hypervisor
HostOS
Server
Guest
OS
Bins/
Libs
VM
App
C
Guest
OS
Bins/
Libs
App
B
Guest
OS
Bins/
Libs
AppA’
Docker
HostOS
Server
Bins/Libs
AppA
Bins/Libs
AppB
AppB’
AppB’
AppB’
Container
Image
• Layers
• Read Only
• Running image is container
Base Image (Ubuntu / Alpine)
Apps PHP, extensions, vim,
runtime configuration
Your configuration +
ceritificates
Your codeRead only
Cache warm up
Container
• Running image
• The last layer of image
• Only layer that is writable
Base Image (Ubuntu / Alpine)
Apps PHP, extensions, vim,
runtime configuration
Your configuration +
ceritificates
Your code
Running container (tmp files)
Read only
Writable
Cache warm up
Production & test Image
Base Image (Ubuntu / Alpine)
Apps PHP, extensions, vim,
runtime configuration
Your prod configuration +
ceritificates
Your code
Bonami Base
Cache warm up
Your test configuration +
ceritificates
Test tools (PHPUnit)
Cache warm up
Production image
Test image
Source
Code
repo
Docker
Registry
How does it work?
Dockerfile
For
Core,
Test, Prod
Docker Engine
Push
Docker
Production server + Docker
Push
Search
Pull
Run
HostCI server
ContainerA
ContainerB
ContainerC
BaseImage
Local DEV machine CI server Production
Test Image
Prod Image
Search
Pull & Run
Docker
Test server + Docker
ContainerA
ContainerB
ContainerC
Build
Bonami Base – Dockerfile
FROM registry.bonami.cz/bonami/fedora
ENV TERM xterm
RUN dnf install -y 
php-fpm php-cli php-curl php-intl php-mysql php-mcrypt php-gd php-redis php-igbinary 
php-pecl-http php-pecl-imagick php-bcmath vim sudo php-mbstring php-xml php-soap php-pdo 
php-mysqlnd php-opcache php-twig redis php-pecl-apcu msmtp nginx tar && 
curl -SLO "https://nodejs.org/dist/v0.12.7/node-v0.12.7-linux-x64.tar.gz" && 
tar -xzf "node-v0.12.7-linux-x64.tar.gz" -C /usr/local --strip-components=1 && 
rm -f /node-v0.12.7-linux-x64.tar.gz && 
mkdir -p /var/www/bonami-web && 
echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" >> /etc/environment && 
dnf clean all && 
rm -rf /var/cache/dnf && 
rm -rf /var/log/dnf && 
sed -i -e "s/([;]*)(upload_max_filesize[ t]*=)(.*)$/2 16M /g" /etc/php.ini && 
sed -i -e "s/([;]*)(date.timezone[ t]*=)(.*)$/2 "Europe/Prague" /g" /etc/php.ini
Bonami Dockerfile
FROM registry.bonami.cz/bonami/bonami-runtime
COPY . /var/www/bonami-web
RUN chown -R apache:apache /var/www/bonami-web/app/cache /var/www/bonami-web/app/logs && 
chmod 775 /var/www/bonami-web/app/cache /var/www/bonami-web/app/logs && 
cp /var/www/bonami-web/docker/nginx_staticfiles.conf /etc/nginx/nginx.conf && 
sudo -u apache /var/www/bonami-web/app/console cache:warmup --env=prod
ENTRYPOINT ["/var/www/bonami-web/docker/start.sh"]
#!/bin/bash
case "$1" in
fpm)
echo "PHP-FPM starting on port 9000..."
exec ${fpmBinary} -F
;;
cron)
if [ ! -f $DIR/tools/docker/crontab/$2 ]; then
echo "error: specified crontab does not exist in crontab directory" >&2; exit 1
fi
echo "Crontab $2 starting..."
exec sudo -u $wwwUser ${cronBinary} $DIR/tools/docker/crontab/$2
;;
daemon|job|script|tool)
if [ -z $2 ] || [ ! -x $DIR/bin/$1s/$2 ]; then
echo "error: $1 does not exist" >&2; exit 1
fi
arr=(sudo -u $wwwUser BONAMI_ENVIRONMENT=prod $DIR/bin/$1s/$2)
exec "${arr[@]}"
;;
bash)
exec /bin/bash
;;
static)
echo "Static content is served on port 8080..."
exec /usr/sbin/nginx -g "daemon off;"
;;
echo $"Usage: {fpm|daemon|job|cron|bash|script|static|tool|git_hash}"
exit 2
esac
Entrypoint
Some guidelines
• Only one application in container (no Supervisord)
• There is no need for SSHd (we have Docker exec)
• Keep the container small (remove all that is not necessary)
• Keep layers count small
• If you use some tmp files, delete them in same layer
How to deploy our image?
boch@bart.bonami.cz~$ sudo docker run -d --log-opt "gelf-
address=udp://quimby.bonami.cz:12201" --name "bonamiweb-fpm" --
log-driver "gelf" --volume "/tmp:/tmp" --net "host" --restart
"always" registry.bonami.cz/bonami/bonamiweb:latest daemon
flexibee-queue-daemon
Fabric
• SSH Connection manager + some usefull tools
• Written in Python
• http://www.fabfile.org/
from fabric.api import *
from fabric.colors import *
from fabric.operations import prompt
env.forward_agent = True
env.use_ssh_config = True
env.user = "deploy"
env.deployServer = "quimby.bonami.cz"
@hosts(env.deployServer)
def deploy(service):
_load_service_configuration(service)
execute (_run_hooks, "onLoad", hosts=env.config["hooks"].keys());
_set_current_release()
_wait_for_jenkins()
_check_build_status()
execute(_run_hooks, "onStart", hosts=env.config["hooks"].keys());
execute(_docker_login, hosts = env.config["hosts"].keys());
execute(_docker_pull, hosts = env.config["hosts"].keys());
execute(_run_hooks, "beforeReplace", hosts = env.config["hooks"].keys());
execute(_docker_replace, hosts = env.config["hosts"].keys());
execute(_run_hooks, "afterReplace", hosts = env.config["hooks"].keys());
Fabric
deploy@quimby.bonami.cz~$ cat config/bonamiweb.yml
jenkins:
username: fabric
password: supertajneheslo
host: "https://jenkins.bonami.cz"
job: bonami-production
registry:
host: "registry.bonami.cz"
username: fabric
password: supertajneheslo
keepReleases: 5
hooks:
homer.bonami.cz:
beforeReplace:
- "echo "Switching to deploy virtualhost""
- "sudo rm /etc/nginx/sites/bonami.cz.conf"
- "sudo ln -s /etc/nginx/sites-available/deploy.bonami.cz.conf /etc/nginx/sites/bonami.cz.conf"
- "sudo service nginx reload"
afterReplace:
- "echo "Switching to live virtualhost""
- "sudo rm /etc/nginx/sites/bonami.cz.conf"
- "sudo ln -s /etc/nginx/sites-available/bonami.cz.loadbalace.conf /etc/nginx/sites/bonami.cz.conf"
- "sudo service nginx reload"
- "curl -X POST --data-urlencode 'payload={"channel": "#dev", "username": "deploy", "text":
"It'"'"'s alive!", "icon_emoji": ":computer:"}' https://hooks.slack.com/services/..."
Deploy skript
hosts:
apu.bonami.cz:
- image: bonami/bonamiweb
name: "bonamiweb-draft-storage-daemon"
restart: always
net: host
arg: "daemon draft-storage-daemon"
volume:
- "/tmp:/tmp:ro"
homer1.bonami.cz:
- image: bonami/bonamiweb
name: "bo namiweb-fpm"
restart: always
net: host
arg: "fpm 9000"
- image: bonami/redis
name: "redis"
restart: always
net: host
- image: bonami/bonamiweb
name: "bonamiweb-static"
restart: always
net: host
arg: "static"
Deploy skript
Vašek Boch
That’s it.
@vasekboch
vaclav.boch@bonami.cz
Do you want to work with us?
hledamevyvojare@bonami.cz
https://www.startupjobs.cz/startup/bonami-cz

More Related Content

What's hot

Deploy, Scale and Sleep at Night with JRuby
Deploy, Scale and Sleep at Night with JRubyDeploy, Scale and Sleep at Night with JRuby
Deploy, Scale and Sleep at Night with JRuby
Joe Kutner
 
Using filesystem capabilities with rsync
Using filesystem capabilities with rsyncUsing filesystem capabilities with rsync
Using filesystem capabilities with rsync
Hazel Smith
 
Docker Workshop
Docker WorkshopDocker Workshop
Docker Workshop
Ahmad Rafiee
 
Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013
Tomas Doran
 
Docker in practice
Docker in practiceDocker in practice
Docker in practice
Jonathan Giannuzzi
 
Red hat lvm cheatsheet
Red hat   lvm cheatsheetRed hat   lvm cheatsheet
Red hat lvm cheatsheet
Prakash Ghosh
 
Test driven infrastructure
Test driven infrastructureTest driven infrastructure
Test driven infrastructure
Skills Matter Talks
 
!!! Huong dan !!!
!!! Huong dan !!!!!! Huong dan !!!
!!! Huong dan !!!
Ngoc Huynh (Nina)
 
Ubic YAPC 2012
Ubic YAPC 2012Ubic YAPC 2012
Ubic YAPC 2012
Vyacheslav Matyukhin
 
Phd3
Phd3Phd3
Docker Ecosystem: Part V - Docker Registry
Docker Ecosystem: Part V - Docker RegistryDocker Ecosystem: Part V - Docker Registry
Docker Ecosystem: Part V - Docker Registry
Mario IC
 
A Better WordPress Workflow with WP-CLI
A Better WordPress Workflow with WP-CLIA Better WordPress Workflow with WP-CLI
A Better WordPress Workflow with WP-CLI
Rikesh Ramlochund
 
Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)
Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)
Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)
Japheth Thomson
 
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Develcz
 
Docker Compose to Production with Docker Swarm
Docker Compose to Production with Docker SwarmDocker Compose to Production with Docker Swarm
Docker Compose to Production with Docker Swarm
Mario IC
 
Travel with your mock server
Travel with your mock serverTravel with your mock server
Travel with your mock server
Jorge Ortiz
 
Node.js streaming csv downloads proxy
Node.js streaming csv downloads proxyNode.js streaming csv downloads proxy
Node.js streaming csv downloads proxy
Ismael Celis
 
OpenShift4 Installation by UPI on kvm
OpenShift4 Installation by UPI on kvmOpenShift4 Installation by UPI on kvm
OpenShift4 Installation by UPI on kvm
Jooho Lee
 
Quay 3.3 installation
Quay 3.3 installationQuay 3.3 installation
Quay 3.3 installation
Jooho Lee
 
Pursue container architecture with mincs
Pursue container architecture with mincsPursue container architecture with mincs
Pursue container architecture with mincs
Yuki Nishiwaki
 

What's hot (20)

Deploy, Scale and Sleep at Night with JRuby
Deploy, Scale and Sleep at Night with JRubyDeploy, Scale and Sleep at Night with JRuby
Deploy, Scale and Sleep at Night with JRuby
 
Using filesystem capabilities with rsync
Using filesystem capabilities with rsyncUsing filesystem capabilities with rsync
Using filesystem capabilities with rsync
 
Docker Workshop
Docker WorkshopDocker Workshop
Docker Workshop
 
Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013
 
Docker in practice
Docker in practiceDocker in practice
Docker in practice
 
Red hat lvm cheatsheet
Red hat   lvm cheatsheetRed hat   lvm cheatsheet
Red hat lvm cheatsheet
 
Test driven infrastructure
Test driven infrastructureTest driven infrastructure
Test driven infrastructure
 
!!! Huong dan !!!
!!! Huong dan !!!!!! Huong dan !!!
!!! Huong dan !!!
 
Ubic YAPC 2012
Ubic YAPC 2012Ubic YAPC 2012
Ubic YAPC 2012
 
Phd3
Phd3Phd3
Phd3
 
Docker Ecosystem: Part V - Docker Registry
Docker Ecosystem: Part V - Docker RegistryDocker Ecosystem: Part V - Docker Registry
Docker Ecosystem: Part V - Docker Registry
 
A Better WordPress Workflow with WP-CLI
A Better WordPress Workflow with WP-CLIA Better WordPress Workflow with WP-CLI
A Better WordPress Workflow with WP-CLI
 
Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)
Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)
Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)
 
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
 
Docker Compose to Production with Docker Swarm
Docker Compose to Production with Docker SwarmDocker Compose to Production with Docker Swarm
Docker Compose to Production with Docker Swarm
 
Travel with your mock server
Travel with your mock serverTravel with your mock server
Travel with your mock server
 
Node.js streaming csv downloads proxy
Node.js streaming csv downloads proxyNode.js streaming csv downloads proxy
Node.js streaming csv downloads proxy
 
OpenShift4 Installation by UPI on kvm
OpenShift4 Installation by UPI on kvmOpenShift4 Installation by UPI on kvm
OpenShift4 Installation by UPI on kvm
 
Quay 3.3 installation
Quay 3.3 installationQuay 3.3 installation
Quay 3.3 installation
 
Pursue container architecture with mincs
Pursue container architecture with mincsPursue container architecture with mincs
Pursue container architecture with mincs
 

Similar to Jak se ^bonami\.(cz|pl|sk)$ vešlo do kontejneru

Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署
Bo-Yi Wu
 
Dockerizing Symfony Applications - Symfony Live Berlin 2014
Dockerizing Symfony Applications - Symfony Live Berlin 2014Dockerizing Symfony Applications - Symfony Live Berlin 2014
Dockerizing Symfony Applications - Symfony Live Berlin 2014
D
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
biicode
 
Getting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and SymfonyGetting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and Symfony
André Rømcke
 
Belvedere
BelvedereBelvedere
Belvedere
Colin Panisset
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
Christophe Muller
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
Pablo Godel
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
Soshi Nemoto
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
Puppet
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
lutter
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
andymccurdy
 
Virtual Infrastructure
Virtual InfrastructureVirtual Infrastructure
Virtual Infrastructure
Bryan McLellan
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
Roman Rodomansky
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
Ian Barber
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
andymccurdy
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
Docker, Inc.
 
Amazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to productionAmazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to production
Paolo latella
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
Arto Artnik
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
Hannes Hapke
 
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
Docker, Inc.
 

Similar to Jak se ^bonami\.(cz|pl|sk)$ vešlo do kontejneru (20)

Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署
 
Dockerizing Symfony Applications - Symfony Live Berlin 2014
Dockerizing Symfony Applications - Symfony Live Berlin 2014Dockerizing Symfony Applications - Symfony Live Berlin 2014
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Getting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and SymfonyGetting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and Symfony
 
Belvedere
BelvedereBelvedere
Belvedere
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 
Virtual Infrastructure
Virtual InfrastructureVirtual Infrastructure
Virtual Infrastructure
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
Amazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to productionAmazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to production
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
 
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
 

Recently uploaded

原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
Karya Keeper
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
What next after learning python programming basics
What next after learning python programming basicsWhat next after learning python programming basics
What next after learning python programming basics
Rakesh Kumar R
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
Peter Muessig
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
mz5nrf0n
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 

Recently uploaded (20)

原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
What next after learning python programming basics
What next after learning python programming basicsWhat next after learning python programming basics
What next after learning python programming basics
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 

Jak se ^bonami\.(cz|pl|sk)$ vešlo do kontejneru

  • 1. Jak se ^bonami.(cz|pl|sk)$ vešlo do kontejneru Václav Boch, Bonami.cz 31.3.2016
  • 2. What you can use for deployment? • FTP • SFTP/SSHFS • GIT • Bash • Capistrano • RPM • Docker
  • 3. Docker • Docker is shipping container for your application. • Contains everything that your app needs.
  • 5. Image • Layers • Read Only • Running image is container Base Image (Ubuntu / Alpine) Apps PHP, extensions, vim, runtime configuration Your configuration + ceritificates Your codeRead only Cache warm up
  • 6. Container • Running image • The last layer of image • Only layer that is writable Base Image (Ubuntu / Alpine) Apps PHP, extensions, vim, runtime configuration Your configuration + ceritificates Your code Running container (tmp files) Read only Writable Cache warm up
  • 7. Production & test Image Base Image (Ubuntu / Alpine) Apps PHP, extensions, vim, runtime configuration Your prod configuration + ceritificates Your code Bonami Base Cache warm up Your test configuration + ceritificates Test tools (PHPUnit) Cache warm up Production image Test image
  • 8. Source Code repo Docker Registry How does it work? Dockerfile For Core, Test, Prod Docker Engine Push Docker Production server + Docker Push Search Pull Run HostCI server ContainerA ContainerB ContainerC BaseImage Local DEV machine CI server Production Test Image Prod Image Search Pull & Run Docker Test server + Docker ContainerA ContainerB ContainerC Build
  • 9. Bonami Base – Dockerfile FROM registry.bonami.cz/bonami/fedora ENV TERM xterm RUN dnf install -y php-fpm php-cli php-curl php-intl php-mysql php-mcrypt php-gd php-redis php-igbinary php-pecl-http php-pecl-imagick php-bcmath vim sudo php-mbstring php-xml php-soap php-pdo php-mysqlnd php-opcache php-twig redis php-pecl-apcu msmtp nginx tar && curl -SLO "https://nodejs.org/dist/v0.12.7/node-v0.12.7-linux-x64.tar.gz" && tar -xzf "node-v0.12.7-linux-x64.tar.gz" -C /usr/local --strip-components=1 && rm -f /node-v0.12.7-linux-x64.tar.gz && mkdir -p /var/www/bonami-web && echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" >> /etc/environment && dnf clean all && rm -rf /var/cache/dnf && rm -rf /var/log/dnf && sed -i -e "s/([;]*)(upload_max_filesize[ t]*=)(.*)$/2 16M /g" /etc/php.ini && sed -i -e "s/([;]*)(date.timezone[ t]*=)(.*)$/2 "Europe/Prague" /g" /etc/php.ini
  • 10. Bonami Dockerfile FROM registry.bonami.cz/bonami/bonami-runtime COPY . /var/www/bonami-web RUN chown -R apache:apache /var/www/bonami-web/app/cache /var/www/bonami-web/app/logs && chmod 775 /var/www/bonami-web/app/cache /var/www/bonami-web/app/logs && cp /var/www/bonami-web/docker/nginx_staticfiles.conf /etc/nginx/nginx.conf && sudo -u apache /var/www/bonami-web/app/console cache:warmup --env=prod ENTRYPOINT ["/var/www/bonami-web/docker/start.sh"]
  • 11. #!/bin/bash case "$1" in fpm) echo "PHP-FPM starting on port 9000..." exec ${fpmBinary} -F ;; cron) if [ ! -f $DIR/tools/docker/crontab/$2 ]; then echo "error: specified crontab does not exist in crontab directory" >&2; exit 1 fi echo "Crontab $2 starting..." exec sudo -u $wwwUser ${cronBinary} $DIR/tools/docker/crontab/$2 ;; daemon|job|script|tool) if [ -z $2 ] || [ ! -x $DIR/bin/$1s/$2 ]; then echo "error: $1 does not exist" >&2; exit 1 fi arr=(sudo -u $wwwUser BONAMI_ENVIRONMENT=prod $DIR/bin/$1s/$2) exec "${arr[@]}" ;; bash) exec /bin/bash ;; static) echo "Static content is served on port 8080..." exec /usr/sbin/nginx -g "daemon off;" ;; echo $"Usage: {fpm|daemon|job|cron|bash|script|static|tool|git_hash}" exit 2 esac Entrypoint
  • 12. Some guidelines • Only one application in container (no Supervisord) • There is no need for SSHd (we have Docker exec) • Keep the container small (remove all that is not necessary) • Keep layers count small • If you use some tmp files, delete them in same layer
  • 13. How to deploy our image? boch@bart.bonami.cz~$ sudo docker run -d --log-opt "gelf- address=udp://quimby.bonami.cz:12201" --name "bonamiweb-fpm" -- log-driver "gelf" --volume "/tmp:/tmp" --net "host" --restart "always" registry.bonami.cz/bonami/bonamiweb:latest daemon flexibee-queue-daemon
  • 14. Fabric • SSH Connection manager + some usefull tools • Written in Python • http://www.fabfile.org/
  • 15. from fabric.api import * from fabric.colors import * from fabric.operations import prompt env.forward_agent = True env.use_ssh_config = True env.user = "deploy" env.deployServer = "quimby.bonami.cz" @hosts(env.deployServer) def deploy(service): _load_service_configuration(service) execute (_run_hooks, "onLoad", hosts=env.config["hooks"].keys()); _set_current_release() _wait_for_jenkins() _check_build_status() execute(_run_hooks, "onStart", hosts=env.config["hooks"].keys()); execute(_docker_login, hosts = env.config["hosts"].keys()); execute(_docker_pull, hosts = env.config["hosts"].keys()); execute(_run_hooks, "beforeReplace", hosts = env.config["hooks"].keys()); execute(_docker_replace, hosts = env.config["hosts"].keys()); execute(_run_hooks, "afterReplace", hosts = env.config["hooks"].keys()); Fabric
  • 16. deploy@quimby.bonami.cz~$ cat config/bonamiweb.yml jenkins: username: fabric password: supertajneheslo host: "https://jenkins.bonami.cz" job: bonami-production registry: host: "registry.bonami.cz" username: fabric password: supertajneheslo keepReleases: 5 hooks: homer.bonami.cz: beforeReplace: - "echo "Switching to deploy virtualhost"" - "sudo rm /etc/nginx/sites/bonami.cz.conf" - "sudo ln -s /etc/nginx/sites-available/deploy.bonami.cz.conf /etc/nginx/sites/bonami.cz.conf" - "sudo service nginx reload" afterReplace: - "echo "Switching to live virtualhost"" - "sudo rm /etc/nginx/sites/bonami.cz.conf" - "sudo ln -s /etc/nginx/sites-available/bonami.cz.loadbalace.conf /etc/nginx/sites/bonami.cz.conf" - "sudo service nginx reload" - "curl -X POST --data-urlencode 'payload={"channel": "#dev", "username": "deploy", "text": "It'"'"'s alive!", "icon_emoji": ":computer:"}' https://hooks.slack.com/services/..." Deploy skript
  • 17. hosts: apu.bonami.cz: - image: bonami/bonamiweb name: "bonamiweb-draft-storage-daemon" restart: always net: host arg: "daemon draft-storage-daemon" volume: - "/tmp:/tmp:ro" homer1.bonami.cz: - image: bonami/bonamiweb name: "bo namiweb-fpm" restart: always net: host arg: "fpm 9000" - image: bonami/redis name: "redis" restart: always net: host - image: bonami/bonamiweb name: "bonamiweb-static" restart: always net: host arg: "static" Deploy skript
  • 18. Vašek Boch That’s it. @vasekboch vaclav.boch@bonami.cz Do you want to work with us? hledamevyvojare@bonami.cz https://www.startupjobs.cz/startup/bonami-cz