2. Introduction
• What is the problem?
• What is deployment?
• Web application life-cycle.
• My background — JB Interactive.
• How we automated deployment.
• Benefits and business case.
3. Why Automate
Deployment?
• Automated, repeatable, consistent process.
• Light-weight code changes.
• Manage configurations and environments.
• Minimise human error.
• Saves time == higher efficiency
• Standardise across projects.
4. Deployment Tools
• Lots of tools already in existence:
• Fabric (python)
• Capistrano (ruby)
• Rake (ruby)
• make (C)
• Not many established PHP solutions…
5. Phing
• PHing Is Not Gnu make
• A build tool; not just a deploy tool.
• Uses XML configuration to automate tasks.
• Based on Apache Ant.
• Used by Propel, Symfony, Zend Framework,
Xinc…
6. Why Use Phing?
• Written in pure PHP - easy to hack!
• Minimal dependancies.
• Supported, moderate ongoing development.
• Functionality through extending.
7. What Can Phing do?
• Almost anything!
• Version Control - Subversion, git, etc.
• PHPUnit/Testing
• Code analysis
• Compilation and Minification
• File Manipulation
• And much, much more…
8. Phing Basics
• Project - build.xml
• Targets
• Dependency tracking.
• Tasks
• Phing building blocks.
• Usually this is where you extend.
9. Phing Basics
• Properties
• User variables!
• Can be stored in external files and included at
run-time.
• Can differ between builds, environments and
configurations.
• Can be overwritten at run-time
12. Config Management
• Using properties separates tasks from
environments.
• Allows for more generic deploy setups.
prop
<?xml
prop
development.ini
prop
test.ini
build.xml
production.ini
13. Extending Phing
• As simple as extending a base class and
pointing to it in your build script.
• Lots of extensions already in existence.
• Read through phing documentation.
• Search GitHub for “phing”
• Easy to integrate with existing tools.
https://github.com/mathewbyrne/closure-task
14. Environments
• Defined by configuration.
• Should have sensible defaults.
• Activated by deployment process.
• Important - can be a security issue!
development staging production
15. Deploying with
Version Control
• Websites are more than just <code>
• Configuration • User Content
• Assets • Setup
• Databases Schemas
• Version Control is easy, but not flexible.
• Deployment procedure not in VC.
17. Conclusion
• Automated deployment is highly desirable.
• Lots of tools in existence.
• Environment and configuration are
important.
• Automate everything!