DevOps Zone is brought to you in partnership with:

Bas is a DZone MVB and is not an employee of DZone and has posted 11 posts at DZone. View Full User Profile

Using a Proxy for Capifony/Capistrano Deployments

07.19.2013
| 3052 views |
  • submit to reddit

I’m currently working on a Symfony2 based project. For deployments to various environments we use Capifony, a collection of Capistrano recipes for Symfony applications. This works like a charm, however there was one issue with the production environment. Due to the setup of this server web access is only possible using a proxy. This caused issues for the deployment, as for instance it was not possible to run Composer during deployment as it needs to download libraries. 

After some research I found several options to work around this. I ended up with this:

default_run_options[:env] = {
   'http_proxy' => '10.11.3.100:8080',
   'https_proxy' => '10.11.3.100:8080',
   'HTTPS_PROXY_REQUEST_FULLURI' => 'false',
}

By using the Capistrano multistage extension this setting is only applied for the production environment, as testing and acceptance don’t require the use of a proxy. The first two options set ‘standard’ proxy environment settings. The last setting is specifically for Composer. Somehow certain libraries couldn’t be downloaded using the Github API over https.
This fixed it, and now the deployment works perfectly using the proxy!

Published at DZone with permission of Bas De Nooijer, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)