Over a million developers have joined DZone.

Using a Proxy for Capifony/Capistrano Deployments

· DevOps Zone

The DevOps zone is brought to you in partnership with Sonatype Nexus. The Nexus suite helps scale your DevOps delivery with continuous component intelligence integrated into development tools, including Eclipse, IntelliJ, Jenkins, Bamboo, SonarQube and more. Schedule a demo today

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' => '',
   'https_proxy' => '',

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!

The DevOps zone is brought to you in partnership with Sonatype Nexus. Use the Nexus Suite to automate your software supply chain and ensure you're using the highest quality open source components at every step of the development lifecycle. Get Nexus today


Published at DZone with permission of Bas De Nooijer, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}