SlideShare a Scribd company logo
1 of 49
Continuous Integration and Automated
Deployments for Symfony-based projects
Symfony 2 under control
PHP Minsk User Group
INTRODUCTION
2
Max Romanovsky
maxromanovsky.com
max.romanovsky@gmail.com
Maxim_Romanovsky@epam.com
Twitter, LinkedIn, SensioLabs Connect,
MoiKrug: maxromanovsky
Who am I
3
Continuous integration (CI) is the practice, in
software engineering, of merging all
developer working copies with a shared
mainline several times a day.
http://en.wikipedia.org/wiki/Continuous_integr
ation
http://www.martinfowler.com/articles/continuo
usIntegration.html
What is Continuous Integration?
4
• Improve quality of application
• Understand current situation on project
• Automate your checklists & verifications
• Notify different people on different events
– Build broken? – Developers
– New build deployed to QA? – QA engineers
– New build deployed to UAT/Production? –
Customers
How could it help you?
5
Dependencies
• Composer
• Platform
packages
• Phar
• Pear
• Pecl
Build
• Phing
• phpqatools.org
Continuous
Integration
• Jenkins CI
• Additional PHP-
related & general
plugins
• Git
Deployment
• Package with
vendors
• Capifony
• Doctrine
Migrations
Our proposal for Symfony-based projects
6
DEPENDENCIES
7
Manages 3rd party
dependencies
required at runtime*
• Bundles
• PHP libraries
• JS/CSS libraries
• *Phpunit for hphpa
8
Composer
getcomposer.org
Checklist
• stability
• lib-*, ext-*
• install vs update
• require
• version masks
• Keep composer.phar
under VCS
• Satis for private
packages
9
Composer
github.com/composer/satis
lib-*, ext-*: goo.gl/Z8dFal
Phar
• Only for CLI libraries used for development and build
• Composer, php-cs-fixer
Pear
• Build tools
• Phing, phpunit*, phpqatools
Pecl
• For PHP extensions missing in platform packages
Platform packages (apt, yum, ports)
• Use it for all purposes if you can (PHP, extensions etc.)
Other tools
10
What to update?
• Composer dependencies
• PHARs
• PEARs
• PECLs
• Platform packages
Keep in mind
• Update at the beginning of the
iteration
• Read changelogs
• Subscribe to news feeds
• Use * as Composer dependency
version to receive all updates
• Not for Symfony itself 
Dev
QA
Staging
• Performance testing
• Check logs
Production
11
Don’t forget about updates!
BUILD
12
Ant
• From Java world
• XML declarative config
• Can run tasks in parallel
• No PHP-specific tasks
• Could be extended (Java)
• IDE support
Phing
• Written in PHP
• Ant config syntax
• All tasks by default are running
in the single PHP process
• Could be extended (PHP)
• IDE support
Pake
• Written in PHP
• Not so popular
• PHP-based config
• github.com/indeyets/pake/wiki
Build tools
13
build-symfony-
ci.xml
• Default workflow
build.xml
• Overwrites for current
project
build.properties.dist
• Default configuration
build.properties
• Project configuration
14
Phing
phing.info
Target
• A set of tasks
• Could depend
on other targets
• phing
<target_name>
Task
• Action
executed as a
part of target
• Custom tasks
can be
implemented
Types
• Reference
• FileSet
• Property
• Other
• FileList
• Filters
Phing Terminology
15
build
• for dev
environment
• outputs to
the console
build-ci
• for CI
environment
• outputs to
XML files
package
• generates
artifacts for
deployment
• tar.gz
archive
• SQL
schema
dump
deploy
• deploys
tar.gz
archive to
the
environment
Main Phing Targets
16
Special clean
prepare
build-tools-self-update
Composer-
specific
composer-validate
dependencies-install
dependencies-list-updates update –dry-run
symfony-security-checker security.sensiolabs.org
Phing Targets (1/6)
17
General phplint
php -l
phploc
pdepend
charts
phpmd
+ custom config
phpcs/phpcs-js
+ custom config (PSR-1&2, no
var_dump(). console.log() etc)
phpcpd
Phing Targets (2/6)
18
General apidoc
PHPDoc
projectdoc
rst2html
phpunit
via exec
phpcb
PHP_CodeBrowser UI
php-cs-fixer
hphpa
HipHop static analysis
No target for KPHP yet 
Phing Targets (3/6)
19
Symfony-
specific
copy-configs-ci parameters.yml for CI
cache:warmup app/cache is removed
during build
twig:lint for Bundles and
app/Resources
assets:install
assetic:dump YUICompressor, Google
Closure Compressor,
lessphp
Phing Targets (4/6)
20
Symfony-
specific
doctrine:database:drop
doctrine:database:create
doctrine:migrations:migrate
doctrine:fixtures:load
doctrine:schema:validate
doctrine:schema:dump –
dump-sql
for DDL schema
artifact
Phing Targets (5/6)
21
Package package-version version.txt
package-db-schema schema.sql
package-archive
Deployment deploy-maintenance- enable/disable
deploy-backup-db
deploy-clear-doctrine-cache Only if not in APC
deploy-cleanup-old-releases
deploy-artifact artifact name provided via CLI
argument
Phing Targets (6/6)
22
CONTINUOUS
INTEGRATION
23
CruiseControl
• +PHP Under
Control
TeamCity
• Commercial
Travis CI
• SaaS
Scrutinizer CI
• SaaS
• PHP-oriented
Jenkins CI
• ex-Hudson CI
CI servers
24
• Open-source
• Enterprise
• Lot of plugins
• PHP Template from Sebastian
Bergmann
• IDE Integration
• RESTful API
25
Jenkins CI overview
jenkins-ci.org
• No comments git
• green & red signs for buildsgreenballs
• parameterized builds
parameterized-
trigger
• git tag selector for builds
• disable internal tagging!
git-parameter
• copy artifact from one job to
anothercopyartifact
• sends emails on successful builds
• useful for deployment jobs
email-ext
26
Jenkins Plugins (common)
goo.gl/IZ2gKE
phing
• phpcs
• hphpacheckstyle
• phpcpddry
• php_dependjdepend
• phploc using CSV filesplot
• phpmdpmd
• aggregates info from phpcs, hphpa,
phpmd, phpcpdviolations
• phpunitxunit
• HTML artifactshtmlpublisher
27
Jenkins Plugins (PHP-specific)
jenkins-php.org
Master
• Bleeding edge
• For completed features
Feature
branch
• Merge to master on completion
• After code review
• Developer executes phing build at least before code review
Tag
• Stable version from master
Bugfix &
develop?
• Sprint branch
• Master branch
• Merge feature branches to sprint branch
• Jenkins job for sprint branch
Git workflow
28
• Builds specific branch (master)
• Features are verified after merge
build-<branchname>
• Parameterized
• Produces .tar.gz artifact from specific
Git tag
build-package-tag
Jenkins Jobs for build
29
• Produces .tar.gz artifact from latest revision of branch
• Deploys to QA
• Not recommended to have more than one such job
(issues with migrations)
• Workaround: multiple QA or complete DB purge on deploy
deploy-qa-<branchname>
• Deploys specific package from build-package-tag to
specified environment
• Ability to enable/disable maintenance mode and error
message
• Email after deployment
deploy-package-tag
Jenkins Jobs for deployment
30
Deployed .tar.gz archive
• <tag>.<build#>
• v0.0.3.26
• <branchname>-<build#>-<revision>-SNAPSHOT
• master-12-7c041a90366ce9d958760094c763d809ffbc629e-
SNAPSHOT
Previous deployed version
DB dump before deployment
Doctrine Migrations info
DB schema
Jenkins Jobs for deployment. Artifacts
31
DEPLOYMENT
32
Capistrano
• from Ruby world
Capifony
• Based on
Capistrano
Shell script
• VCS update
• Rsync
Phar
• Don’t use WebPhar
• Silex does not use
it anymore
Zend Server
package
• No support for
vanilla PHP
PaaS
• AWS Elastic
Beanstalk
• PagodaBox
Deployment tools
33
Based on Capistrano
• Supports Capistrano plugins
Symfony 1&2 deployment
Multistage
• qa, staging, uat, production
Maintenance mode
Clustered environments
34
Capifony
capifony.org
Directories
• releases/
• current/ (symlink)
• shared/
Shared
• app/config/parameters.yml
• app/cache
• app/logs
• web/uploads
Shared files & dirs are
symlink’ed
Shared files & dirs are
not shared across
nodes
Directory structure for Capistrano projects
35
`-- /var/www/my-app.com
|-- current → /var/www/my-app.com/releases/20100512131539
|-- releases
| `-- 20100512131539
| `-- 20100509150741
| `-- 20100509145325
`-- shared
|-- web
| `-- uploads
|-- log
`-- config
`-- databases.yml
Directory structure example
36
All you need is package
• capistrano-deploy-strategy-archive
Github not available?
• Goodbye, vendors!
Decreases deployment time
• Lot of vendors
• Slow internet connection
Reproducible
• You know what you deploy
• You can deploy exactly the same package to multiple
environments
Deployment via SCM vs package
37
.tar.gz
Optimized
autoloader
Contains only
necessary
dirs & files
assets:install assetic:dump
version.txt &
db-
schema.sql
Packaging with Phing
38
DBDeploy Liquibase
Doctrine
Migrations
Doctrine
Fixtures
Database Migrations
39
User
• Triggers job on Jenkins CI
• Choose options (env, maintenance mode)
Jenkins
• Executes single phing target with additional
command-line arguments
Phing
• Executes several Capifony commands
according to command-line arguments
Capifony
• Performs actions on remote machines
Capifony & Jenkins CI
40
Enables Maintenance mode
• maintenance.html in webroot
Backups DB
Clears Doctrine cache
• Not for APC cache
Downloads previous deploy metadata
• package version
• Doctrine Migrations info
Deploys tar.gz archive
Capifony & Phing (1/2)
41
Restarts services
• php-fpm or Apache
• Doctrine APC cache is cleared
Symfony-specific tasks
• copy app/config/parameters.yml
• doctrine:migrations:migrate
• cache:warmup
Disables Maintenance mode
Performs cleanup for old releases
Capifony & Phing (2/2)
42
Semi-
automatical
• from
deployment
server
• usually CI
server
Enable
Maintenance
• manually via
phing
Manually backup
for analysis
• DB
• current version
• Doctrine
Migrations
status
• codebase
Rollback (1/2)
43
Switch to
previous release
• Manually via
capifony CLI
• Recover DB
• Rollback
Doctrine
Migrations
• Restore DB
dump
• Custom
Additional tasks
• Restore web
server config
• Restart service
• cache:warmup
Disable
Maintenance
• Manually via
phing
Rollback (2/2)
44
Write rollback guide
• Step-by-step
• Verify it periodically
Enable monitoring on prod
• Zabbix
• Munin
• New Relic
• Pinba
• Graylog2
Rollback tips
45
SUMMARY
46
• Currently not available online 
• Planning to release in 1-2 months on
GitHub
Where to download?
47
Deployment
•Cronjob / CLI script handling
•Web server (Apache, nginx)
config manipulations
•Ext- and lib- dependency
verification via Composer
What is not implemented yet
48
Questions?

More Related Content

What's hot

ZF2: Writing Service Components
ZF2: Writing Service ComponentsZF2: Writing Service Components
ZF2: Writing Service ComponentsMike Willbanks
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins PipelinesSteffen Gebert
 
Codecoon - A technical Case Study
Codecoon - A technical Case StudyCodecoon - A technical Case Study
Codecoon - A technical Case StudyMichael Lihs
 
Domino OSGi Development
Domino OSGi DevelopmentDomino OSGi Development
Domino OSGi DevelopmentPaul Fiore
 
Tribal Nova Docker feedback
Tribal Nova Docker feedbackTribal Nova Docker feedback
Tribal Nova Docker feedbackNicolas Degardin
 
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...Edureka!
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins UsersJules Pierre-Louis
 
Building Jenkins Pipelines at Scale
Building Jenkins Pipelines at ScaleBuilding Jenkins Pipelines at Scale
Building Jenkins Pipelines at ScaleJulien Pivotto
 
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...Paul Withers
 
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/HudsonEclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/HudsonVladLica
 
Introduce fuego
Introduce fuegoIntroduce fuego
Introduce fuegos60030
 
Embrace Maven
Embrace MavenEmbrace Maven
Embrace MavenGuy Marom
 
2013 10-28 php ug presentation - ci using phing and hudson
2013 10-28 php ug presentation - ci using phing and hudson2013 10-28 php ug presentation - ci using phing and hudson
2013 10-28 php ug presentation - ci using phing and hudsonShreeniwas Iyer
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins UsersJules Pierre-Louis
 
Jenkins days workshop pipelines - Eric Long
Jenkins days workshop  pipelines - Eric LongJenkins days workshop  pipelines - Eric Long
Jenkins days workshop pipelines - Eric Longericlongtx
 
Writing Services with ZF2
Writing Services with ZF2Writing Services with ZF2
Writing Services with ZF2Mike Willbanks
 
Concourse - CI for the cloud
Concourse - CI for the cloudConcourse - CI for the cloud
Concourse - CI for the cloudJohannes Rudolph
 
Getting Started with Node.js
Getting Started with Node.jsGetting Started with Node.js
Getting Started with Node.jsJustin Reock
 
Ci For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or GalCi For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or GalChad Woolley
 

What's hot (20)

ZF2: Writing Service Components
ZF2: Writing Service ComponentsZF2: Writing Service Components
ZF2: Writing Service Components
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
 
Codecoon - A technical Case Study
Codecoon - A technical Case StudyCodecoon - A technical Case Study
Codecoon - A technical Case Study
 
Domino OSGi Development
Domino OSGi DevelopmentDomino OSGi Development
Domino OSGi Development
 
Tribal Nova Docker feedback
Tribal Nova Docker feedbackTribal Nova Docker feedback
Tribal Nova Docker feedback
 
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
 
Let me introduce you: DOTS
Let me introduce you: DOTSLet me introduce you: DOTS
Let me introduce you: DOTS
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users
 
Building Jenkins Pipelines at Scale
Building Jenkins Pipelines at ScaleBuilding Jenkins Pipelines at Scale
Building Jenkins Pipelines at Scale
 
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
 
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/HudsonEclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
 
Introduce fuego
Introduce fuegoIntroduce fuego
Introduce fuego
 
Embrace Maven
Embrace MavenEmbrace Maven
Embrace Maven
 
2013 10-28 php ug presentation - ci using phing and hudson
2013 10-28 php ug presentation - ci using phing and hudson2013 10-28 php ug presentation - ci using phing and hudson
2013 10-28 php ug presentation - ci using phing and hudson
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users
 
Jenkins days workshop pipelines - Eric Long
Jenkins days workshop  pipelines - Eric LongJenkins days workshop  pipelines - Eric Long
Jenkins days workshop pipelines - Eric Long
 
Writing Services with ZF2
Writing Services with ZF2Writing Services with ZF2
Writing Services with ZF2
 
Concourse - CI for the cloud
Concourse - CI for the cloudConcourse - CI for the cloud
Concourse - CI for the cloud
 
Getting Started with Node.js
Getting Started with Node.jsGetting Started with Node.js
Getting Started with Node.js
 
Ci For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or GalCi For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or Gal
 

Similar to Symfony Under Control by Maxim Romanovsky

Continuous Integration at Mollie
Continuous Integration at MollieContinuous Integration at Mollie
Continuous Integration at Molliewillemstuursma
 
Fluo CICD OpenStack Summit
Fluo CICD OpenStack SummitFluo CICD OpenStack Summit
Fluo CICD OpenStack SummitMiguel Zuniga
 
Symfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case studySymfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case studyGaetano Giunta
 
Modern Web-site Development Pipeline
Modern Web-site Development PipelineModern Web-site Development Pipeline
Modern Web-site Development PipelineGlobalLogic Ukraine
 
Apache Continuum Build, Test, and Release
Apache Continuum Build, Test, and ReleaseApache Continuum Build, Test, and Release
Apache Continuum Build, Test, and Releaseelliando dias
 
Cloud Foundry Roadmap Update - OSCON - May 2017
Cloud Foundry Roadmap Update - OSCON - May 2017Cloud Foundry Roadmap Update - OSCON - May 2017
Cloud Foundry Roadmap Update - OSCON - May 2017Chip Childers
 
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...Paul Withers
 
Preparing your dockerised application for production deployment
Preparing your dockerised application for production deploymentPreparing your dockerised application for production deployment
Preparing your dockerised application for production deploymentDave Ward
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkinsAbe Diaz
 
Nginx conference 2015
Nginx conference 2015Nginx conference 2015
Nginx conference 2015ING-IT
 
Magento Continuous Integration & Continuous Delivery @MM17HR
Magento Continuous Integration & Continuous Delivery @MM17HRMagento Continuous Integration & Continuous Delivery @MM17HR
Magento Continuous Integration & Continuous Delivery @MM17HRDenis Ristic
 
Automatize everything
Automatize everythingAutomatize everything
Automatize everythingBoris Bucha
 
(WPF + WinForms) * .NET Core = Modern Desktop
(WPF + WinForms) * .NET Core = Modern Desktop(WPF + WinForms) * .NET Core = Modern Desktop
(WPF + WinForms) * .NET Core = Modern DesktopOren Novotny
 
Automating Web Application Deployment
Automating Web Application DeploymentAutomating Web Application Deployment
Automating Web Application DeploymentMathew Byrne
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworksKirk Madera
 
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWERContinuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWERIndrajit Poddar
 
Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)Paul Jones
 

Similar to Symfony Under Control by Maxim Romanovsky (20)

Continuous Integration at Mollie
Continuous Integration at MollieContinuous Integration at Mollie
Continuous Integration at Mollie
 
Fluo CICD OpenStack Summit
Fluo CICD OpenStack SummitFluo CICD OpenStack Summit
Fluo CICD OpenStack Summit
 
Symfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case studySymfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case study
 
Modern Web-site Development Pipeline
Modern Web-site Development PipelineModern Web-site Development Pipeline
Modern Web-site Development Pipeline
 
Enterprise Griffon
Enterprise GriffonEnterprise Griffon
Enterprise Griffon
 
Apache Continuum Build, Test, and Release
Apache Continuum Build, Test, and ReleaseApache Continuum Build, Test, and Release
Apache Continuum Build, Test, and Release
 
Drupal 8 - Quick bites
Drupal 8 - Quick  bitesDrupal 8 - Quick  bites
Drupal 8 - Quick bites
 
Cloud Foundry Roadmap Update - OSCON - May 2017
Cloud Foundry Roadmap Update - OSCON - May 2017Cloud Foundry Roadmap Update - OSCON - May 2017
Cloud Foundry Roadmap Update - OSCON - May 2017
 
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
 
Preparing your dockerised application for production deployment
Preparing your dockerised application for production deploymentPreparing your dockerised application for production deployment
Preparing your dockerised application for production deployment
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkins
 
Nginx conference 2015
Nginx conference 2015Nginx conference 2015
Nginx conference 2015
 
Magento Continuous Integration & Continuous Delivery @MM17HR
Magento Continuous Integration & Continuous Delivery @MM17HRMagento Continuous Integration & Continuous Delivery @MM17HR
Magento Continuous Integration & Continuous Delivery @MM17HR
 
Automatize everything
Automatize everythingAutomatize everything
Automatize everything
 
(WPF + WinForms) * .NET Core = Modern Desktop
(WPF + WinForms) * .NET Core = Modern Desktop(WPF + WinForms) * .NET Core = Modern Desktop
(WPF + WinForms) * .NET Core = Modern Desktop
 
Automating Web Application Deployment
Automating Web Application DeploymentAutomating Web Application Deployment
Automating Web Application Deployment
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworks
 
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWERContinuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
 
Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)
 
Versioning for Developers
Versioning for DevelopersVersioning for Developers
Versioning for Developers
 

More from php-user-group-minsk

Continuous Integration for PHP projects - Theory by Alex Simanovich
Continuous Integration for PHP projects - Theory by Alex SimanovichContinuous Integration for PHP projects - Theory by Alex Simanovich
Continuous Integration for PHP projects - Theory by Alex Simanovichphp-user-group-minsk
 
Development on the Knee by Vladimir Khramtsov
Development on the Knee by Vladimir KhramtsovDevelopment on the Knee by Vladimir Khramtsov
Development on the Knee by Vladimir Khramtsovphp-user-group-minsk
 
То, что вы хотели знать о HandlerSocket, но не смогли нагуглить
То, что вы хотели знать о HandlerSocket, но не смогли нагуглитьТо, что вы хотели знать о HandlerSocket, но не смогли нагуглить
То, что вы хотели знать о HandlerSocket, но не смогли нагуглитьphp-user-group-minsk
 
Composer in the wilderness by Josef Bielawski
Composer in the wilderness by Josef BielawskiComposer in the wilderness by Josef Bielawski
Composer in the wilderness by Josef Bielawskiphp-user-group-minsk
 

More from php-user-group-minsk (6)

Continuous Integration for PHP projects - Theory by Alex Simanovich
Continuous Integration for PHP projects - Theory by Alex SimanovichContinuous Integration for PHP projects - Theory by Alex Simanovich
Continuous Integration for PHP projects - Theory by Alex Simanovich
 
Development on the Knee by Vladimir Khramtsov
Development on the Knee by Vladimir KhramtsovDevelopment on the Knee by Vladimir Khramtsov
Development on the Knee by Vladimir Khramtsov
 
MongoDB & PHP by Alex Litvinok
MongoDB & PHP by Alex LitvinokMongoDB & PHP by Alex Litvinok
MongoDB & PHP by Alex Litvinok
 
То, что вы хотели знать о HandlerSocket, но не смогли нагуглить
То, что вы хотели знать о HandlerSocket, но не смогли нагуглитьТо, что вы хотели знать о HandlerSocket, но не смогли нагуглить
То, что вы хотели знать о HandlerSocket, но не смогли нагуглить
 
Composer talk by Maxim Romanovsky
Composer talk by Maxim RomanovskyComposer talk by Maxim Romanovsky
Composer talk by Maxim Romanovsky
 
Composer in the wilderness by Josef Bielawski
Composer in the wilderness by Josef BielawskiComposer in the wilderness by Josef Bielawski
Composer in the wilderness by Josef Bielawski
 

Recently uploaded

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Recently uploaded (20)

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 

Symfony Under Control by Maxim Romanovsky

  • 1. Continuous Integration and Automated Deployments for Symfony-based projects Symfony 2 under control PHP Minsk User Group
  • 4. Continuous integration (CI) is the practice, in software engineering, of merging all developer working copies with a shared mainline several times a day. http://en.wikipedia.org/wiki/Continuous_integr ation http://www.martinfowler.com/articles/continuo usIntegration.html What is Continuous Integration? 4
  • 5. • Improve quality of application • Understand current situation on project • Automate your checklists & verifications • Notify different people on different events – Build broken? – Developers – New build deployed to QA? – QA engineers – New build deployed to UAT/Production? – Customers How could it help you? 5
  • 6. Dependencies • Composer • Platform packages • Phar • Pear • Pecl Build • Phing • phpqatools.org Continuous Integration • Jenkins CI • Additional PHP- related & general plugins • Git Deployment • Package with vendors • Capifony • Doctrine Migrations Our proposal for Symfony-based projects 6
  • 8. Manages 3rd party dependencies required at runtime* • Bundles • PHP libraries • JS/CSS libraries • *Phpunit for hphpa 8 Composer getcomposer.org
  • 9. Checklist • stability • lib-*, ext-* • install vs update • require • version masks • Keep composer.phar under VCS • Satis for private packages 9 Composer github.com/composer/satis lib-*, ext-*: goo.gl/Z8dFal
  • 10. Phar • Only for CLI libraries used for development and build • Composer, php-cs-fixer Pear • Build tools • Phing, phpunit*, phpqatools Pecl • For PHP extensions missing in platform packages Platform packages (apt, yum, ports) • Use it for all purposes if you can (PHP, extensions etc.) Other tools 10
  • 11. What to update? • Composer dependencies • PHARs • PEARs • PECLs • Platform packages Keep in mind • Update at the beginning of the iteration • Read changelogs • Subscribe to news feeds • Use * as Composer dependency version to receive all updates • Not for Symfony itself  Dev QA Staging • Performance testing • Check logs Production 11 Don’t forget about updates!
  • 13. Ant • From Java world • XML declarative config • Can run tasks in parallel • No PHP-specific tasks • Could be extended (Java) • IDE support Phing • Written in PHP • Ant config syntax • All tasks by default are running in the single PHP process • Could be extended (PHP) • IDE support Pake • Written in PHP • Not so popular • PHP-based config • github.com/indeyets/pake/wiki Build tools 13
  • 14. build-symfony- ci.xml • Default workflow build.xml • Overwrites for current project build.properties.dist • Default configuration build.properties • Project configuration 14 Phing phing.info
  • 15. Target • A set of tasks • Could depend on other targets • phing <target_name> Task • Action executed as a part of target • Custom tasks can be implemented Types • Reference • FileSet • Property • Other • FileList • Filters Phing Terminology 15
  • 16. build • for dev environment • outputs to the console build-ci • for CI environment • outputs to XML files package • generates artifacts for deployment • tar.gz archive • SQL schema dump deploy • deploys tar.gz archive to the environment Main Phing Targets 16
  • 18. General phplint php -l phploc pdepend charts phpmd + custom config phpcs/phpcs-js + custom config (PSR-1&2, no var_dump(). console.log() etc) phpcpd Phing Targets (2/6) 18
  • 19. General apidoc PHPDoc projectdoc rst2html phpunit via exec phpcb PHP_CodeBrowser UI php-cs-fixer hphpa HipHop static analysis No target for KPHP yet  Phing Targets (3/6) 19
  • 20. Symfony- specific copy-configs-ci parameters.yml for CI cache:warmup app/cache is removed during build twig:lint for Bundles and app/Resources assets:install assetic:dump YUICompressor, Google Closure Compressor, lessphp Phing Targets (4/6) 20
  • 22. Package package-version version.txt package-db-schema schema.sql package-archive Deployment deploy-maintenance- enable/disable deploy-backup-db deploy-clear-doctrine-cache Only if not in APC deploy-cleanup-old-releases deploy-artifact artifact name provided via CLI argument Phing Targets (6/6) 22
  • 24. CruiseControl • +PHP Under Control TeamCity • Commercial Travis CI • SaaS Scrutinizer CI • SaaS • PHP-oriented Jenkins CI • ex-Hudson CI CI servers 24
  • 25. • Open-source • Enterprise • Lot of plugins • PHP Template from Sebastian Bergmann • IDE Integration • RESTful API 25 Jenkins CI overview jenkins-ci.org
  • 26. • No comments git • green & red signs for buildsgreenballs • parameterized builds parameterized- trigger • git tag selector for builds • disable internal tagging! git-parameter • copy artifact from one job to anothercopyartifact • sends emails on successful builds • useful for deployment jobs email-ext 26 Jenkins Plugins (common) goo.gl/IZ2gKE
  • 27. phing • phpcs • hphpacheckstyle • phpcpddry • php_dependjdepend • phploc using CSV filesplot • phpmdpmd • aggregates info from phpcs, hphpa, phpmd, phpcpdviolations • phpunitxunit • HTML artifactshtmlpublisher 27 Jenkins Plugins (PHP-specific) jenkins-php.org
  • 28. Master • Bleeding edge • For completed features Feature branch • Merge to master on completion • After code review • Developer executes phing build at least before code review Tag • Stable version from master Bugfix & develop? • Sprint branch • Master branch • Merge feature branches to sprint branch • Jenkins job for sprint branch Git workflow 28
  • 29. • Builds specific branch (master) • Features are verified after merge build-<branchname> • Parameterized • Produces .tar.gz artifact from specific Git tag build-package-tag Jenkins Jobs for build 29
  • 30. • Produces .tar.gz artifact from latest revision of branch • Deploys to QA • Not recommended to have more than one such job (issues with migrations) • Workaround: multiple QA or complete DB purge on deploy deploy-qa-<branchname> • Deploys specific package from build-package-tag to specified environment • Ability to enable/disable maintenance mode and error message • Email after deployment deploy-package-tag Jenkins Jobs for deployment 30
  • 31. Deployed .tar.gz archive • <tag>.<build#> • v0.0.3.26 • <branchname>-<build#>-<revision>-SNAPSHOT • master-12-7c041a90366ce9d958760094c763d809ffbc629e- SNAPSHOT Previous deployed version DB dump before deployment Doctrine Migrations info DB schema Jenkins Jobs for deployment. Artifacts 31
  • 33. Capistrano • from Ruby world Capifony • Based on Capistrano Shell script • VCS update • Rsync Phar • Don’t use WebPhar • Silex does not use it anymore Zend Server package • No support for vanilla PHP PaaS • AWS Elastic Beanstalk • PagodaBox Deployment tools 33
  • 34. Based on Capistrano • Supports Capistrano plugins Symfony 1&2 deployment Multistage • qa, staging, uat, production Maintenance mode Clustered environments 34 Capifony capifony.org
  • 35. Directories • releases/ • current/ (symlink) • shared/ Shared • app/config/parameters.yml • app/cache • app/logs • web/uploads Shared files & dirs are symlink’ed Shared files & dirs are not shared across nodes Directory structure for Capistrano projects 35
  • 36. `-- /var/www/my-app.com |-- current → /var/www/my-app.com/releases/20100512131539 |-- releases | `-- 20100512131539 | `-- 20100509150741 | `-- 20100509145325 `-- shared |-- web | `-- uploads |-- log `-- config `-- databases.yml Directory structure example 36
  • 37. All you need is package • capistrano-deploy-strategy-archive Github not available? • Goodbye, vendors! Decreases deployment time • Lot of vendors • Slow internet connection Reproducible • You know what you deploy • You can deploy exactly the same package to multiple environments Deployment via SCM vs package 37
  • 38. .tar.gz Optimized autoloader Contains only necessary dirs & files assets:install assetic:dump version.txt & db- schema.sql Packaging with Phing 38
  • 40. User • Triggers job on Jenkins CI • Choose options (env, maintenance mode) Jenkins • Executes single phing target with additional command-line arguments Phing • Executes several Capifony commands according to command-line arguments Capifony • Performs actions on remote machines Capifony & Jenkins CI 40
  • 41. Enables Maintenance mode • maintenance.html in webroot Backups DB Clears Doctrine cache • Not for APC cache Downloads previous deploy metadata • package version • Doctrine Migrations info Deploys tar.gz archive Capifony & Phing (1/2) 41
  • 42. Restarts services • php-fpm or Apache • Doctrine APC cache is cleared Symfony-specific tasks • copy app/config/parameters.yml • doctrine:migrations:migrate • cache:warmup Disables Maintenance mode Performs cleanup for old releases Capifony & Phing (2/2) 42
  • 43. Semi- automatical • from deployment server • usually CI server Enable Maintenance • manually via phing Manually backup for analysis • DB • current version • Doctrine Migrations status • codebase Rollback (1/2) 43
  • 44. Switch to previous release • Manually via capifony CLI • Recover DB • Rollback Doctrine Migrations • Restore DB dump • Custom Additional tasks • Restore web server config • Restart service • cache:warmup Disable Maintenance • Manually via phing Rollback (2/2) 44
  • 45. Write rollback guide • Step-by-step • Verify it periodically Enable monitoring on prod • Zabbix • Munin • New Relic • Pinba • Graylog2 Rollback tips 45
  • 47. • Currently not available online  • Planning to release in 1-2 months on GitHub Where to download? 47
  • 48. Deployment •Cronjob / CLI script handling •Web server (Apache, nginx) config manipulations •Ext- and lib- dependency verification via Composer What is not implemented yet 48