rocketeers / rocketeer

Send your projects up in the clouds
http://rocketeer.autopergamene.eu/
MIT License
2.66k stars 217 forks source link

Rocketeer can't find composer #455

Open tkuijer opened 9 years ago

tkuijer commented 9 years ago

Rocketeer fails with

|===> Checking presence of required drivers
The Composer package manager could not be found
The tasks queue was canceled by task "Setup"

The composer command exists on the server, and can be found from a regular SSH connection.

Version:

$ rocketeer --version
Rocketeer version 2.0.6

Error occurs with a globally installed Rocketeer, when I install rocketeer in my project using composer, it works.

Anahkiasen commented 9 years ago

Error occurs with a globally installed Rocketeer, when I install rocketeer in my project using composer, it works.

Well that's... more peculiar. Both are the same version?

tkuijer commented 9 years ago

Yes, both are Rocketeer version 2.0.6

PunchRockgroin commented 9 years ago

Related to #410

It seems that the check is looking for a composer.json in the /current folder on the remote server. This check also occurs before "setup" so to speak, so setup fails as well.

When I create that directory and an empty composer.json the rocketeer check (and rocketeer setup) do not fail out.

$ rocketeer check -vvv
| Check (Check if the server is ready to receive the application) [~5.63s]
|-- Check/Php (Checks if the server is ready to receive a PHP application)
|=> Checking presence of git
$ git --version
[punchrockgroin@example.com] (production) git version 1.8.4
|=> Checking presence of Composer
$ [ -e "/var/www/test/repo/current/composer.json" ] && echo "true"
|=> Checking PHP version
|=> Checking presence of required extensions
$ /usr/bin/php -r="print defined('HHVM_VERSION') ? HHVM_VERSION : PHP_VERSION;"
$ /usr/bin/php -m
[punchrockgroin@example.com] (production) [PHP Modules]
apc
apcu
[punchrockgroin@example.com] (production) bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
igbinary
json
libxml
mbstring
mcrypt
memcache
memcached
mhash
mongo
msgpack
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
SQLite
sqlite3
standard
[punchrockgroin@example.com] (production) sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
|=> Checking presence of required drivers
|=> Your server is ready to deploy
Execution time: 5.8723s
Saved logs to /var/www/repo/.rocketeer/logs/production--20150301.log
Anahkiasen commented 9 years ago

It seems that the check is looking for a composer.json in the /current folder on the remote server. This check also occurs before "setup" so to speak, so setup fails as well.

To be more precise it'll look in current/ but it'll also look into the folder you're deploying from. Are you using Composer as a PHAR or global binary?

PunchRockgroin commented 9 years ago

Global.

Anahkiasen commented 9 years ago

If you log into the machine and do which composer what do you get?

PunchRockgroin commented 9 years ago
[punchrockgroin@example.com ~]$ which composer
/usr/local/bin/composer
jaitaiwan commented 9 years ago

I can verify this behaviour is also occurring for me. I'll try tracking down the code that this might be getting effected by.

jaitaiwan commented 9 years ago

Ok, @Anahkiasen and @PunchRockgroin it appears that Rocketeer returns this ambigous error when not only the binary is missing but also if its manifest (aka composer.json) file is missing either locally or in the destination server.

Probably need a #PR around this to make the error messages much more pointed although I'm not exactly sure how this would be best implemented.

So I think we should close this issue with documentation added around the fact that PackageManagers will fail when they don't have their appropriate manifests, while linking to a new issue which tracks the best way to get a PR happening.

xtrasmal commented 9 years ago

@Anahkiasen What can I check to get this resolved?

pelletiermaxime commented 9 years ago

I also ran into this problem. I'm deploying from outside my project folder, so it could not find a composer.json file. To fix it I simply created an empty composer.json file in my local directory. It saves that the setup was successful, so I just deleted the empty composer.json after that initial setup.

HellPat commented 8 years ago

Yep... annoying :-) I thought it checks the server, so y is ist checking for a composer.json file in my local directory?

kororo commented 8 years ago

Yeah, I also found the issue of this ticket. It is missing "composer.json" in both local and remote directory.

If anyone interested in coding explanation, look at into file "Composer.php" which extended from "AbstractPackageManager.php", function "hasManifest", it will throw "false".

/**
 * Check if the manifest file exists, locally or on server.
 *
 * @return bool
 */
public function hasManifest()
{
    $server = $this->paths->getFolder('current/'.$this->manifest);
    $server = $this->bash->fileExists($server);

    $local = $this->app['path.base'].DS.$this->manifest;
    $local = $this->files->exists($local);

    return $local || $server;
}

Kinda make sense to check whether composer runnable by checking binary (composer.phar) and manifest (composer.json) exist. My point is, I hope there is better error messaging to flag there is issue with manifest of the Composer.php.

Thanks Rob