Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch composer binary from HTTPS-only #568

Merged
merged 2 commits into from
Apr 27, 2015
Merged

Conversation

shakaran
Copy link
Contributor

cap symfony:composer:get fails to get composer file

  * 2015-04-26 23:29:58 executing `symfony:composer:get'
  * executing "if [ -e /home/user/public/releases/20150426232955/composer.phar ]; then echo 'true'; fi"
    servers: ["mydomain.com"]
    [mydomain.com] executing command
    command finished in 121ms
--> Downloading Composer
  * executing "sh -c 'cd /home/user/public/releases/20150426232955 && curl -s http://getcomposer.org/installer | php'"
    servers: ["mydomain.com"]
    [mydomain.com] executing command
 ** [out :: mydomain.com] <html>
 ** [out :: mydomain.com] <head><title>302 Found</title></head>
 ** [out :: mydomain.com] <body bgcolor="white">
 ** [out :: mydomain.com] <center><h1>302 Found</h1></center>
 ** [out :: mydomain.com] <hr><center>nginx</center>
 ** [out :: mydomain.com] </body>
 ** [out :: mydomain.com] </html>
    command finished in 170ms

Check composer/composer#3047

We need https only, so:

curl -sS https://getcomposer.org/installer | php

This pull request just simply add the -S param running this sed command:

sed -i "s@curl -s http://getcomposer.org@curl -sS https://getcomposer.org@g" lib/symfony2/symfony.rb spec/capifony_symfony2_symfony_spec.rb

@eps90
Copy link

eps90 commented Apr 27, 2015

I think this issue is urgent and it should be merged asap. I've checked your solution and it works. What do you think about adding -L option to curl to prevent such problems in future?

@hco
Copy link
Contributor

hco commented Apr 27, 2015

Having the same issue.

@npanasenko
Copy link

Confirmed, Please merge asap

@ppawlakov
Copy link

👍

3 similar comments
@SylvG
Copy link

SylvG commented Apr 27, 2015

👍

@HitoTech
Copy link

👍

@tyx
Copy link

tyx commented Apr 27, 2015

👍

@hco
Copy link
Contributor

hco commented Apr 27, 2015

Just in case one of you needs a hotfix, for us adding the following to our capfile worked:

# symfony:composer:get
namespace :symfony do
  namespace :composer do
    desc "Gets composer and installs it"
    task :get, :roles => :app, :except => { :no_release => true } do
      install_options = ''
      unless composer_version.empty?
        install_options += " -- --version=#{composer_version}"
      end

      if use_composer_tmp
        # Because we always install to temp location we assume that we download composer every time.
        logger.debug "Downloading composer to #{$temp_destination}"
        capifony_pretty_print "--> Downloading Composer to temp location"
        run_locally "cd #{$temp_destination} && curl -sSL https://getcomposer.org/installer | #{php_bin}#{install_options}"
      else
        if !remote_file_exists?("#{latest_release}/composer.phar")
          capifony_pretty_print "--> Downloading Composer"

          run "#{try_sudo} sh -c 'cd #{latest_release} && curl -sSL https://getcomposer.org/installer | #{php_bin}#{install_options}'"
        else
          capifony_pretty_print "--> Updating Composer"

          run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} composer.phar self-update #{composer_version}'" \
        end
      end
      capifony_puts_ok
    end
  end
end

I don't really know ruby, so i might have made the world explode with that patch :-)

@lenybernard
Copy link

👍

@matejvelikonja
Copy link

+1 for the -L option

@ke20
Copy link

ke20 commented Apr 27, 2015

Same issue +1

@adam187
Copy link
Contributor

adam187 commented Apr 27, 2015

+1

My quick fix was installing composer globally on server and set up set :composer_bin path.

@tuscanicz
Copy link

👍

@eps90
Copy link

eps90 commented Apr 27, 2015

@hco I did the same but without -L option - works :)

@ke20 ke20 mentioned this pull request Apr 27, 2015
@garak
Copy link
Contributor

garak commented Apr 27, 2015

👍

@dupuchba
Copy link

@everzet can you merge it plz ?

@chapa
Copy link

chapa commented Apr 27, 2015

@dupuchba +1

@edhgoose
Copy link

If you're able to modify the gems directly, I found the easiest hotfix was to run the command in @shakaran's PR in the location of capifony. If you want to find that location, I found running gem environment on my machine, that it was in one of the Gem Paths listed.

Command repeated here:

sed -i "s@curl -s http://getcomposer.org@curl -sS https://getcomposer.org@g" lib/symfony2/symfony.rb spec/capifony_symfony2_symfony_spec.rb

@solilokiam
Copy link

👍

@Seldaek
Copy link

Seldaek commented Apr 27, 2015

I fixed the server config to allow static files access over http again so y'all can get back to work, but this definitely should be merged.

@alcaeus
Copy link
Contributor

alcaeus commented Apr 27, 2015

Thank you @Seldaek. 👍

@dupuchba
Copy link

@Seldaek 👍 (between who has the credentials to merge? )

@hco
Copy link
Contributor

hco commented Apr 27, 2015

As we got several workarounds,and @Seldaek made those workarounds not necessary at the moment, let's all just sit back and give @everzet some time to merge this.

I assume that he doesn't need any more "+1"s to understand that this has to be fixed :-)

@alsar
Copy link

alsar commented Apr 27, 2015

As already mentioned you can use composer globaly on the server:
set :composer_bin, "/usr/local/bin/composer"

@willdurand
Copy link
Collaborator

Ok ok, thanks for the fix. New release is on its way.

willdurand added a commit that referenced this pull request Apr 27, 2015
Fetch composer binary from HTTPS-only
@willdurand willdurand merged commit 20c5a9c into everzet:master Apr 27, 2015
@willdurand
Copy link
Collaborator

v2.8.5 is out!

@shakaran
Copy link
Contributor Author

@eps90 see #573 for add -L as you suggested

@dupuchba
Copy link

👍 nice :-)

@szabogyula
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.