Symfony2 site deployment using Capifony

Capifony is a smart and convenient tool to deploy Symfony sites. It’s based on Capistrano and is written by Konstantin Kudryashov. Basic information on working with Capifony can be gleaned from the official site capifony.org and the short article "Deploy Your Symfony Application Painlessly with Capifony".

I advise you to start deploying symfony2 with capifony it on the server manually and make sure everything is configured and operating correctly (especially the script app / console). For example, I found some incorrect ways for the git sub modules and failed to deploy the site from the first turn.

Below the cut is a Capifony config to deploy this site and my comments to it.

# Basic configuration is created after the launch of "capifony ." in the project folder.
# Name of the application
set :application, "stfalcon"
# To this domain the script will be connected via ssh
set :domain,      "#{application}.com"
# Deploy a website in the directory /var/www/stfalcon.com
set :deploy_to,   "/var/www/#{domain}"
# This path will be used below
set :app_path,    "app"
 
# Path to git repository
set :repository,  "git://github.com/stfalcon/portfolio.git"
# Type of storage
set :scm,         :git
# Several bundles are connected as sub modules. While deploying symfony2 websites with capifony they also need to be initialized and updated
set :git_enable_submodules, 1
 
role :web,        domain                         # Your HTTP server, Apache/etc
role :app,        domain                         # This may be the same as your `Web` server
role :db,         domain, :primary => true       # This is where Rails migrations will run
 
# Value for the Capistrano pseudo-terminal. 
# The default value was wrong
default_run_options[:pty] = true
 
# How many releases are to be stored when you start removing old releases "deploy: cleanup"
set  :keep_releases,  3
# The user under which we unfold the site on the server
# When the site owner was given access to ssh, we finally got fine deploy
set  :user,       "stfalcon-com"
# sudo was disabled. Now let deploy from the owner
set  :use_sudo,   false
 
# Run script ./bin/vendors --update to update vendors libraries
set :update_vendors, true
# We’ll have something like "In this case, rsync will create a cache on your production server 
# and will push only files that have changed between deploys."
set :deploy_via, :rsync_with_remote_cache
 
# Files that are stored in the folder shared and are copied with each release
# For example, in ./shared/app/config/parameters.ini are stored settings for the database access
# and the password for the admin
set :shared_files,      ["app/config/parameters.ini"]
# Folders that are stored in the folder shared and are copied with each release
# For example, logs folder for downloading files, folders with vendors libraries
set :shared_children,     [app_path + "/logs", web_path + "/uploads", web_path + "/bundles", "vendor"]
# Run command ./app/cache assetic: dump
set :dump_assetic_assets, true

So, that's all about using capifony for Symfony apps deployment. After that, the process of updating production becomes very simple. Good luck and be patient ;).

About author

CEO & Founder
Stepan is the founder of studio stfalcon.com and UARoads, Ukrainian startup for monitoring road quality.

Related posts

Return to list Return to list