need a build tool? • To prepare a project to act in a specific environment Should be no room for misconfiguration • Staging should have environment similar to production
as you wish • Jenkins CI + Apache Ant + jenkins-php.org = great starting point • Phing = “Apache Ant written in PHP” • Capistrano = for builds and deployments • Fabric
for running scripts on multiple servers. It’s primary use is for easily deploying applications. capifony is a deployment recipes collection that works with both symfony and Symfony2 applications. Source: capifony.org
exists?(:config_hipchat_token) require 'hipchat/capistrano' set :hipchat_token, "#{config_hipchat_token}" set :hipchat_room_name, "Developers chat" end # Recipe: # github.com/ekino/EkinoNewRelicBundle/blob/master/Resources/recipes/newrelic.rb if exists?(:config_newrelic_license) require 'new_relic/recipes' set :newrelic_license_key, "#{config_newrelic_license}" set :newrelic_appname, "You name it" after "deploy", "newrelic:notice_deployment" end Capifony sugar (1/4):
task :verify_console do capifony_pretty_print "--> Run app/console to verify if parameters.yml has all required keys and application is runnable" if capture("#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} > /tmp/app_console_output 2>&1 ; echo $?'").to_s.strip != "0" run "cat /tmp/app_console_output && rm -rf /tmp/app_console_output" raise CommandError.new("There was an unrecoverable error.") end capifony_puts_ok end end Capifony sugar (2/4):
namespace :assets_version do task :increment do capifony_pretty_print "--> Increment assets_version" run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} assets_version:increment --env=#{symfony_env_prod}'" capifony_puts_ok end end Capifony sugar (3/4):
server instead of all: role :web, "www1.mysite.com", "www2.mysite.com" role :app, "www1.mysite.com", "www2.mysite.com" role :db, "db1.mysite.com", :primary => true role :db, "db2.mysite.com" role :db, "db3.mysite.com" Capifony sugar (4/4):