Capifony + Symfony2 Revisited Experience

Deploying with capifony is really an experience. Even though I had set it up after several months successfully and with the help of @weaverryan I struggled another few hours to get it work for my project.

I needed java installed for assetic and yui-compressor too so I downloaded from, you can select first option jdk and download the compressed binary for your system either 64 or 32:
JDK binary.
This is really just downloading the file and setting up PATH for the system to find the java/bin/java executable. Same applies to yuicompressor which can be downloaded from here.

Another thing I had to deal with was the permissions, basically I ended up setting umask(0000) before all my app*.php and app/console. Besides this I created a script ./script.sh that will remove rm -rf cache/* and logs/* since they are impediment to more capifony deploys after the first if they are to be shared folders. I had shared vendors, logs, cache and the parameters.ini.

In addition to this even though I had installed capifony the easy way, I ended up doing it again over git and that too gave me the opportunity to remove the –reinstall out of the bin/vendors install task which repeated every `cap deploy`. I compiled it with this new change and use it to my like, with faster deployments than ever!

Other things I have learned with capifony is that one can issue all symfony2 commands and custom commands by just typing cap symfony and then wait for the prompt so that one can enter any fos:user:create or any such sort of sf2 command that we can think of. This was very useful to warmup on demand, or to create users and promote them so that one could access client admin dashboard on prod server.

Yet another by-product of this resulted in trial and error kind of easy of the configuration to send emails with swiftmailer. It was a long jorney but I got it to send email via smtp.

Should you want to get straight A’s from the very beginning here is my code you can use to avoid hours of long setup:

set :application, "cordoval"
set :maindomain,  "sites.pe"
set :domain,      "#{application}.#{maindomain}"
set :deploy_to,   "/home/cordoval/www/#{domain}"
 
set :scm,        :git
set :scm_command, "/usr/bin/git"
set :scm_verbose, true
set :repository,  "#{maindomain}:/home/cordoval/repos/#{application}.git"
 
set :branch, "new-feature"
set :user, "cordoval"
set :password, 'jaris'
 
set :shared_files, ["app/config/parameters.ini"]
set :shared_children, [app_path + "/logs", web_path + "/uploads", app_path + "/cache", "vendor"]
set :update_vendors, true
set :dump_assetic_assets, true
 
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

set :use_sudo,   false
set  :keep_releases,  3
ssh_options[:forward_agent] = true

Let the reader understand the code above.

Leave a Reply

Your email address will not be published. Required fields are marked *