Closed sasokovacic closed 6 years ago
anyone?
Full log.
me@mylaptop ~/projects/customers/myproject $ dep deploy stage ✈︎ Deploying master on stage ➤ Executing task deploy:prepare serverpilot@myproject.mydomain.com's password: ✔erverpilot@myproject.mydomain.com's password: ✔ Executing task deploy:lock ✔ Executing task deploy:release ➤ Executing task deploy:update_code serverpilot@myproject.mydomain.com's password: Submodule 'laradock' (https://github.com/Laradock/laradock.git) registered for path 'laradock' Cloning into 'laradock'... remote: Counting objects: 6755, done. remote: Total 6755 (delta 0), reused 0 (delta 0), pack-reused 6755 Receiving objects: 100% (6755/6755), 6.17 MiB | 5.34 MiB/s, done. Resolving deltas: 100% (3607/3607), done. Checking connectivity... done. Submodule path 'laradock': checked out '327e79f9028b3f92ff81d73722e164178317b0e5' Connection to myproject.mydomain.com closed. ✔ Ok ✔ Executing task deploy:shared ✔ Executing task deploy:vendors ✔ Executing task deploy:writable ➤ Executing task artisan:storage:link ✔ Executing task deploy:failed ✔ Executing task deploy:unlock [Deployer\Exception\RuntimeException]
The command "/usr/bin/php /srv/users/serverpilot/apps/myproject/stage/releases/1/artisan --version" failed.
Exit Code: 255 (Unknown error)
Host Name: stage
================
PHP Warning: require(/srv/users/serverpilot/apps/myproject/stage/releases/1/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /srv/users/serverpilot/apps/myproject/stage/rel
eases/1/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/srv/users/serverpilot/apps/myproject/stage/releases/1/bootstrap/../vendor/autoload.php' (include_path='.:/opt/sp/php7.1/lib/php') in /srv/users/serverpilot/apps/myproject/stage/releases/1/bootstrap/autoload.php on line 17
deploy [-p|--parallel] [-l|--limit LIMIT] [--no-hooks] [--log LOG] [--roles ROLES] [--hosts HOSTS] [-o|--option OPTION] [--] []
With -vvv
[localhost] > git rev-parse --abbrev-ref HEAD
[localhost] < master
✈︎ Deploying master on stage
• done on [stage]
➤ Executing task deploy:prepare
[stage] > echo $0
[stage] < ssh multiplexing initialization
serverpilot@myproject.mydomain.com's password:
[stage] < bash
[stage] > if [ ! -d /srv/users/serverpilot/apps/myproject/stage ]; then mkdir -p /srv/users/serverpilot/apps/myproject/stage; fi
[stage] < ssh multiplexing initialization
serverpilot@myproject.mydomain.com's password:
[stage] < Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-139-generic x86_64)
Manage this server at https://manage.serverpilot.io
**********************************************************************
* Learn about SSH, SFTP, PHP, MySQL, apps, cron, and more at: *
* https://serverpilot.io/community/articles/system-user-guide *
* *
* To use a specific PHP version for the 'php' command, see: *
* https://serverpilot.io/community/articles/how-to-use-the-php-cli *
**********************************************************************
[stage] > if [ ! -L /srv/users/serverpilot/apps/myproject/stage/current ] && [ -d /srv/users/serverpilot/apps/myproject/stage/current ]; then echo 'true'; fi
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && if [ ! -d .dep ]; then mkdir .dep; fi
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && if [ ! -d releases ]; then mkdir releases; fi
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && if [ ! -d shared ]; then mkdir shared; fi
• done on [stage]
✔ Ok [142s 202ms]
➤ Executing task deploy:lock
[stage] > if [ -f /srv/users/serverpilot/apps/myproject/stage/.dep/deploy.lock ]; then echo 'true'; fi
[stage] > touch /srv/users/serverpilot/apps/myproject/stage/.dep/deploy.lock
• done on [stage]
✔ Ok [863ms]
➤ Executing task deploy:release
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && (if [ -h release ]; then echo 'true'; fi)
[stage] < true
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && (rm -rf "$(readlink release)")
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && (rm release)
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && (if [ -d releases ] && [ "$(ls -A releases)" ]; then echo 'true'; fi)
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && (if [ -d /srv/users/serverpilot/apps/myproject/stage/releases/1 ]; then echo 'true'; fi)
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && (date +"%Y%m%d%H%M%S")
[stage] < 20180315152046
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && (echo '20180315152046,1' >> .dep/releases)
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && (mkdir /srv/users/serverpilot/apps/myproject/stage/releases/1)
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && (if [[ $(man ln 2>&1 || ln -h 2>&1 || ln --help 2>&1) =~ '--relative' ]]; then echo 'true'; fi)
[stage] < true
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && (ln -nfs --relative /srv/users/serverpilot/apps/myproject/stage/releases/1 /srv/users/serverpilot/apps/myproject/stage/release)
• done on [stage]
✔ Ok [4s 627ms]
➤ Executing task deploy:update_code
[stage] > if hash command 2>/dev/null; then echo 'true'; fi
[stage] < true
[stage] > command -v 'git'
[stage] < /usr/bin/git
[stage] > /usr/bin/git version
[stage] < git version 1.9.1
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && (if [ -h /srv/users/serverpilot/apps/myproject/stage/release ]; then echo 'true'; fi)
[stage] < true
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && (readlink /srv/users/serverpilot/apps/myproject/stage/release)
[stage] < releases/1
[stage] > cd /srv/users/serverpilot/apps/myproject/stage && (/usr/bin/git clone -b master --depth 1 --recursive -q ssh://git@bitbucket.org/<username>/myproject.git /srv/users/serverpilot/apps/myproject/stage/releases/1 2>&1)
serverpilot@myproject.mydomain.com's password:
Submodule 'laradock' (https://github.com/Laradock/laradock.git) registered for path 'laradock'
Cloning into 'laradock'...
remote: Counting objects: 6800, done.
remote: Total 6800 (delta 0), reused 0 (delta 0), pack-reused 6800
Receiving objects: 100% (6800/6800), 6.22 MiB | 5.89 MiB/s, done.
Resolving deltas: 100% (3633/3633), done.
Checking connectivity... done.
Submodule path 'laradock': checked out '327e79f9028b3f92ff81d73722e164178317b0e5'
Connection to myproject.mydomain.com closed.
• done on [stage]
✔ Ok [35s 530ms]
➤ Executing task deploy:shared
[stage] > if [ -d /srv/users/serverpilot/apps/myproject/stage/shared/storage ]; then echo 'true'; fi
[stage] < true
[stage] > rm -rf /srv/users/serverpilot/apps/myproject/stage/releases/1/storage
[stage] > mkdir -p `dirname /srv/users/serverpilot/apps/myproject/stage/releases/1/storage`
[stage] > ln -nfs --relative /srv/users/serverpilot/apps/myproject/stage/shared/storage /srv/users/serverpilot/apps/myproject/stage/releases/1/storage
[stage] > mkdir -p /srv/users/serverpilot/apps/myproject/stage/shared/.
[stage] > if [ -f /srv/users/serverpilot/apps/myproject/stage/shared/.env ]; then echo 'true'; fi
[stage] < true
[stage] > if [ -f $(echo /srv/users/serverpilot/apps/myproject/stage/releases/1/.env) ]; then rm -rf /srv/users/serverpilot/apps/myproject/stage/releases/1/.env; fi
[stage] > if [ ! -d $(echo /srv/users/serverpilot/apps/myproject/stage/releases/1/.) ]; then mkdir -p /srv/users/serverpilot/apps/myproject/stage/releases/1/.;fi
[stage] > touch /srv/users/serverpilot/apps/myproject/stage/shared/.env
[stage] > ln -nfs --relative /srv/users/serverpilot/apps/myproject/stage/shared/.env /srv/users/serverpilot/apps/myproject/stage/releases/1/.env
• done on [stage]
✔ Ok [4s 525ms]
➤ Executing task deploy:vendors
[stage] > if hash unzip 2>/dev/null; then echo 'true'; fi
[stage] < true
[stage] > if hash composer 2>/dev/null; then echo 'true'; fi
[stage] < true
[stage] > if hash command 2>/dev/null; then echo 'true'; fi
[stage] < true
[stage] > command -v 'composer'
[stage] < /usr/bin/composer
[stage] > if hash command 2>/dev/null; then echo 'true'; fi
[stage] < true
[stage] > command -v 'php'
[stage] < /usr/bin/php
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && /usr/bin/php /usr/bin/composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader
[stage] < export PATH=/opt/sp/php7.1/bin:$PATH
[stage] < php /opt/sp/bin/composer.phar "$@"
• done on [stage]
✔ Ok [2s 442ms]
➤ Executing task deploy:writable
[stage] > ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1
[stage] < www-data
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && (mkdir -p bootstrap/cache storage storage/app storage/app/public storage/framework storage/framework/cache storage/framework/sessions storage/framework/views storage/logs)
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && (chmod 2>&1; true)
[stage] < chmod: missing operand
[stage] < Try 'chmod --help' for more information.
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && (if hash setfacl 2>/dev/null; then echo 'true'; fi)
[stage] < true
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && (getfacl -p bootstrap/cache | grep "^user:www-data:.*w" | wc -l)
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && (setfacl -RL -m u:"www-data":rwX -m u:`whoami`:rwX bootstrap/cache)
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && (setfacl -dRL -m u:"www-data":rwX -m u:`whoami`:rwX bootstrap/cache)
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && (getfacl -p storage | grep "^user:www-data:.*w" | wc -l)
[stage] < 1
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && (getfacl -p storage/app | grep "^user:www-data:.*w" | wc -l)
[stage] < 1
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && (getfacl -p storage/app/public | grep "^user:www-data:.*w" | wc -l)
[stage] < 1
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && (getfacl -p storage/framework | grep "^user:www-data:.*w" | wc -l)
[stage] < 1
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && (getfacl -p storage/framework/cache | grep "^user:www-data:.*w" | wc -l)
[stage] < 1
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && (getfacl -p storage/framework/sessions | grep "^user:www-data:.*w" | wc -l)
[stage] < 1
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && (getfacl -p storage/framework/views | grep "^user:www-data:.*w" | wc -l)
[stage] < 1
[stage] > cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && (getfacl -p storage/logs | grep "^user:www-data:.*w" | wc -l)
[stage] < 1
• done on [stage]
✔ Ok [4s 259ms]
➤ Executing task artisan:storage:link
[stage] > /usr/bin/php /srv/users/serverpilot/apps/myproject/stage/releases/1/artisan --version
[stage] < Warning: require(/srv/users/serverpilot/apps/myproject/stage/releases/1/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /srv/users/serverpilot/apps/myproject/stage/releases/1/bootstrap/autoload.php on line 17
[stage] < Fatal error: require(): Failed opening required '/srv/users/serverpilot/apps/myproject/stage/releases/1/bootstrap/../vendor/autoload.php' (include_path='.:/opt/sp/php7.1/lib/php') in /srv/users/serverpilot/apps/myproject/stage/releases/1/bootstrap/autoload.php on line 17
[stage] < PHP Warning: require(/srv/users/serverpilot/apps/myproject/stage/releases/1/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /srv/users/serverpilot/apps/myproject/stage/releases/1/bootstrap/autoload.php on line 17
[stage] < PHP Fatal error: require(): Failed opening required '/srv/users/serverpilot/apps/myproject/stage/releases/1/bootstrap/../vendor/autoload.php' (include_path='.:/opt/sp/php7.1/lib/php') in /srv/users/serverpilot/apps/myproject/stage/releases/1/bootstrap/autoload.php on line 17
➤ Executing task deploy:failed
• done on [stage]
✔ Ok [0ms]
➤ Executing task deploy:unlock
[stage] > rm -f /srv/users/serverpilot/apps/myproject/stage/.dep/deploy.lock
• done on [stage]
✔ Ok [251ms]
[Deployer\Exception\RuntimeException (255)]
The command "/usr/bin/php /srv/users/serverpilot/apps/myproject/stage/releases/1/artisan --version" failed
.
Exit Code: 255 (Unknown error)
Host Name: stage
================
PHP Warning: require(/srv/users/serverpilot/apps/myproject/stage/releases/1/bootstrap/../vendor/autoload.
php): failed to open stream: No such file or directory in /srv/users/serverpilot/apps/myproject/stage/rele
ases/1/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/srv/users/serverpilot/apps/myproject/stage/releases
/1/bootstrap/../vendor/autoload.php' (include_path='.:/opt/sp/php7.1/lib/php') in /srv/users/serverpilot/apps/myproject/stage/releases/1/bootstrap/autoload.php on line 17
Exception trace:
() at phar:///usr/local/bin/dep/src/Ssh/Client.php:96
Deployer\Ssh\Client->run() at phar:///usr/local/bin/dep/src/functions.php:296
Deployer\run() at phar:///usr/local/bin/dep/recipe/laravel.php:39
Deployer\Deployer::Deployer\{closure}() at n/a:n/a
call_user_func() at phar:///usr/local/bin/dep/src/Configuration/Configuration.php:87
Deployer\Configuration\Configuration->get() at phar:///usr/local/bin/dep/src/functions.php:526
Deployer\get() at phar:///usr/local/bin/dep/recipe/laravel.php:129
Deployer\Deployer::Deployer\{closure}() at n/a:n/a
call_user_func() at phar:///usr/local/bin/dep/src/Task/Task.php:105
Deployer\Task\Task->run() at phar:///usr/local/bin/dep/src/Executor/SeriesExecutor.php:63
Deployer\Executor\SeriesExecutor->run() at phar:///usr/local/bin/dep/src/Console/TaskCommand.php:142
Deployer\Console\TaskCommand->execute() at phar:///usr/local/bin/dep/vendor/symfony/console/Command/Command.php:264
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:869
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/dep/src/Console/Application.php:132
Deployer\Console\Application->doRunCommand() at phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:223
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:130
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/dep/src/Deployer.php:324
Deployer\Deployer::run() at phar:///usr/local/bin/dep/bin/dep:119
require() at /usr/local/bin/dep:4
deploy [-p|--parallel] [-l|--limit LIMIT] [--no-hooks] [--log LOG] [--roles ROLES] [--hosts HOSTS] [-o|--option OPTION] [--] [<stage>]
This is the file structure of the deploy folder
drwxrwxr-x+ 2 serverpilot serverpilot 4096 Mar 15 15:21 .dep/
lrwxrwxrwx 1 serverpilot serverpilot 10 Mar 15 15:20 release -> releases/1/
drwxrwxr-x+ 3 serverpilot serverpilot 4096 Mar 15 15:20 releases/
drwxrwxr-x+ 3 serverpilot serverpilot 4096 Mar 13 15:24 shared/
and this is the file structure of the release folder
drwxrwxr-x+ 13 serverpilot serverpilot 4096 Mar 15 15:21 app/
-rw-rw-r--+ 1 serverpilot serverpilot 1646 Mar 15 15:21 artisan
-rw-rw-r--+ 1 serverpilot serverpilot 536 Mar 15 15:21 .bash_history
drwxrwxr-x+ 3 serverpilot serverpilot 4096 Mar 15 15:21 bootstrap/
-rw-rw-r--+ 1 serverpilot serverpilot 1825 Mar 15 15:21 composer.json
-rw-rw-r--+ 1 serverpilot serverpilot 196651 Mar 15 15:21 composer.lock
drwxrwxr-x+ 2 serverpilot serverpilot 4096 Mar 15 15:21 config/
drwxrwxr-x+ 5 serverpilot serverpilot 4096 Mar 15 15:21 database/
-rw-rw-r--+ 1 serverpilot serverpilot 3763 Mar 15 15:21 deploy.php
lrwxrwxrwx 1 serverpilot serverpilot 17 Mar 15 15:21 .env -> ../../shared/.env
-rw-rw-r--+ 1 serverpilot serverpilot 542 Mar 15 15:21 .env.example
drwxrwxr-x+ 9 serverpilot serverpilot 4096 Mar 15 15:21 .git/
-rw-rw-r--+ 1 serverpilot serverpilot 61 Mar 15 15:21 .gitattributes
-rw-rw-r--+ 1 serverpilot serverpilot 148 Mar 15 15:21 .gitignore
-rw-rw-r--+ 1 serverpilot serverpilot 88 Mar 15 15:21 .gitmodules
drwxrwxr-x+ 43 serverpilot serverpilot 4096 Mar 15 15:21 laradock/
-rw-rw-r--+ 1 serverpilot serverpilot 1283 Mar 15 15:21 package.json
-rw-rw-r--+ 1 serverpilot serverpilot 1279 Mar 15 15:21 package.json.orig
-rw-rw-r--+ 1 serverpilot serverpilot 1055 Mar 15 15:21 phpunit.xml
drwxrwxr-x+ 7 serverpilot serverpilot 4096 Mar 15 15:21 public/
-rw-rw-r--+ 1 serverpilot serverpilot 2906 Mar 15 15:21 readme.md
drwxrwxr-x+ 4 serverpilot serverpilot 4096 Mar 15 15:21 resources/
drwxrwxr-x+ 2 serverpilot serverpilot 4096 Mar 15 15:21 routes/
-rw-rw-r--+ 1 serverpilot serverpilot 563 Mar 15 15:21 server.php
lrwxrwxrwx 1 serverpilot serverpilot 20 Mar 15 15:21 storage -> ../../shared/storage/
drwxrwxr-x+ 4 serverpilot serverpilot 4096 Mar 15 15:21 tests/
-rw-rw-r--+ 1 serverpilot serverpilot 1092 Mar 15 15:21 TODO
-rw-rw-r--+ 1 serverpilot serverpilot 627 Mar 15 15:21 webpack.mix.js
As you can see it created all the necessary files and folders except for vendor folder. And that is exactly what the error says... Failed to open stream ../vendor/autoload.php
if I run composer install inside of release folder as serverpilot user it correctly installs all of the packages defined in the composer.json file so it looks like the serverpilot user has the correct permissions
Check permissions
As I already said in previous comments I don't think it is a permission problem... Deployer actually creates all the necessary folders and files except for vendor folder... And if I run composer install directly on the server as a deployer user it installs correctly...
I created new task to test permissions and it works
task('custom:composer:install', function() {
$result = run('cd {{deploy_path}}/release && composer install', ['tty' => true]);
writeLn($result);
})->onHosts('stage');
with tty enabled I can actually see composer installation output... It correctly installs plugins... And if I login to server I can see vendor folder and autoload.php file inside
it is definitely not a permission problem... the problem is with calling php and composer....
cd /srv/users/serverpilot/apps/myproject/stage/releases/1 && /usr/bin/php /usr/bin/composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader
It gives me the following output
[stage] < export PATH=/opt/sp/php7.1/bin:$PATH
[stage] < php /opt/sp/bin/composer.phar "$@"
Your recipe has predefined php and composer location... I use serverpilot for managing DO cloud server and it actually installs php to it's own location...
Is there any way to set custom php and composer location?
Yes:
set('bin/php', '...');
Same for composer.
great, thanks...
php and composer are globally accessible on my server so the code bellow is working fine
->set('bin/php', 'php')
->set('bin/composer', 'composer')
Description
When I try to deploy laravel 5.5 project I get the "artisan --version failed" error. When I go to the deployment directory there is no vendor folder... So it looks like the composer install fails but I don't get any error... I deploy with serverpilot user that is the owner of the deployment path...
drwxrwxr-x+ 3 serverpilot serverpilot 4096 Mar 1 18:24 myproject
Deployer creates all the directories except for vendor directory... So I don't think it's the permissions problem...
Steps to reproduce
All I do is install laravel project, initialize deployer with laravel recipe, set host, deployment path and user and run
$ dep deploy development
Content of
deploy.php
Output log