Search code examples
symfonyweb-deploymentcapifony

Capifony Symfony2 deployment


I'm getting this error while trying to deploy my Symfony2 application to production server.

--> Downloading Composer
  * executing "sh -c 'cd /home/myproject/releases/20150427081943 && curl -s http://getcomposer.org/installer | php'"

Preparing to execute command: "sh -c 'cd /home/myproject/releases/20150427081943 && curl -s http://getcomposer.org/installer | php'"
Execute ([Yes], No, Abort) ?  |y|  y

  servers: ["myproject.net"]
    [myproject.net] executing command
 ** [out :: myproject.net] <html>
 ** [out :: myproject.net] <head><title>302 Found</title></head>
 ** [out :: myproject.net] <body bgcolor="white">
 ** [out :: myproject.net] <center><h1>302 Found</h1></center>
 ** [out :: myproject.net] <hr><center>nginx</center>
 ** [out :: myproject.net] </body>
 ** [out :: myproject.net] </html>
    command finished in 156ms

So curl -s http://getcomposer.org/installer|php command returns 302 and i'm not shure how to fix this in my script.

I've seen on getcomposer.org that curl uses additional -S flag with the -s flag, like this curl -sS http://getcomposer.org/installer|php


Solution

  • A couple of hours ago, the Composer website (https://getcomposer.org/) started redirecting all HTTP traffic to HTTPS using 302 responses.

    The issue is, however, that Capifony still points to the HTTP location of the installer, and curl doesn't follow the redirect because the -L / --location flag isn't set.

    You aren't the only one with this problem, and the guys of Capifony are already working on this.

    In the meanwhile, see this answer on another question for a workaround:

    To circumvent capifony downloading from the wrong url I added:

    task :download_composer do
      run "cd " + release_path + " && curl -s https://getcomposer.org/installer | php"
    end
    
    before "symfony:composer:update", "download_composer"
    before "symfony:composer:install", "download_composer"
    

    This works because capifony checks if composer.phar is already present, if it is it'll warn you but just continue anyway

    Update: the issue has now been fixed, update Capifony to version 2.8.5.