Switching from Laravel Deployer to the main Deployer project #2502
-
Hi, I'm trying to convert my Laravel projects from Laravel Deployer to this main Deployer project. I am using deploy.php config file<?php
namespace Deployer;
require 'recipe/common.php';
require 'recipe/laravel.php';
require 'contrib/npm.php';
set('application', 'Laravel');
set('repository', '<snip>');
set('shared_dirs', ['public/.well-known', 'storage']);
set('upload_options', [
'options' => [
'--exclude=.git',
'--exclude=.idea',
'--exclude=node_modules',
'--exclude=/.env',
'--exclude=/.github',
'--exclude=/config/deploy.php',
'--exclude=/tests',
'--exclude=/vendor',
'--exclude=/.editorconfig',
'--exclude=/.gitattributes',
'--exclude=/.gitignore',
'--exclude=/.php_cs',
'--exclude=/audit-resolve.json',
'--exclude=/deploy.php',
'--exclude=/grumphp.yml.dist',
'--exclude=/phpstan-baseline.neon',
'--exclude=/phpstan.neon.dist',
'--exclude=/phpunit.xml',
'--exclude=/server.php',
'--exclude=/webpack.mix.js',
],
]);
host('staging')
->setLabels(['stage' => 'staging'])
->setHostname('<snip>')
->setDeployPath('<snip>')
->setRemoteUser('<snip>')
->setPort(<snip>)
->set('keep_releases', 2);
task('deploy', [
'deploy:prepare',
'deploy:lock',
'deploy:release',
'upload',
'deploy:shared',
'artisan:storage:link',
'artisan:view:cache',
'artisan:config:cache',
'artisan:migrate',
'deploy:symlink',
'artisan:queue:restart',
'deploy:unlock',
'deploy:cleanup',
'deploy:publish',
]);
task('npm:run:production', function () {
cd('{{release_or_current_path}}');
run('npm run production');
});
task('upload', function () {
upload(__DIR__ . "/", '{{release_path}}');
});
after('deploy:failed', 'deploy:unlock'); Deployer doesn't seem to run any of the commands in the Command Output
As you can see, this task list in the output doesn't match the tasks I've put in the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi there 👋 Yes I can see a few errors in your deploy.php file. First of all, the error that you get is due to the fact that Deployer cannot automatically identify the user that is running your HTTP server (either via Apache or Nginx). It does this by looking into relevant processes and finding a user which is not root. To solve this you must explicitly set the Now to answer your question about tasks not matching. That’s because the Concretely, these are the tasks they invoke. task('deploy:prepare', [
'deploy:info',
'deploy:setup',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:writable',
]);
task('deploy:publish', [
'deploy:symlink',
'deploy:unlock',
'deploy:cleanup',
'deploy:success',
]); As a result, that means your deployment flow currently repeats a lot of tasks. If you want to see the full detail of tasks and nested tasks invoked in your One last little detail I’ve noticed: you don’t need to import I hope this helps. 🍀 |
Beta Was this translation helpful? Give feedback.
Hi there 👋
Yes I can see a few errors in your deploy.php file.
First of all, the error that you get is due to the fact that Deployer cannot automatically identify the user that is running your HTTP server (either via Apache or Nginx). It does this by looking into relevant processes and finding a user which is not root.
To solve this you must explicitly set the
http_user
options — which could beroot
in your case. On the upgrade guide to 7, it provides an example wherehttp_user
is set tofalse
. By looking at the code I’m struggling to find out if this would fix your issue but maybe try that as well haha.Now to answer your question about tasks not matching. That’s because the
deploy:prepare
…