Skip to content
New issue

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

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

Already on GitHub? # to your account

Can't detect http user name. Please setup http_user config parameter. #1649

Closed
jasperf opened this issue Jul 11, 2018 · 6 comments
Closed

Can't detect http user name. Please setup http_user config parameter. #1649

jasperf opened this issue Jul 11, 2018 · 6 comments

Comments

@jasperf
Copy link

jasperf commented Jul 11, 2018

Q A
Issue Type Question
Deployer Version N/A
Local Machine OS OSX High Sierra
Remote Machine OS Ubuntu 18.0.4

Description

When I use ip address instead of hostname I get

[RuntimeException]                          
  Can't detect http user name.                
  Please setup `http_user` config parameter.  

Never had this before.

Steps to reproduce

dep deploy production

Content of deploy.php

namespace Deployer;

require 'recipe/laravel.php';
require 'vendor/deployer/recipes/cachetool.php';

// Configuration
set('repository', 'git@github.xxx-xxx/xxx-v2.git');
set('default_stage', 'production');
set('git_tty', true); // [Optional] Allocate tty for git on first deployment
set('ssh_type', 'native');
set('cachetool', '/var/run/php/php7.2-fpm.sock');
set('keep_releases', 10);

// Make sure uploads & published aren't overwritten by deploying
set('shared_dirs', [
    'public/uploads',
    'public/published'
]);
set('shared_files', [
    '.env',
    '.transip_private_key',
]);
set('writable_dirs', [
    'public/uploads',
    'public/published',
    'storage/framework/cache/data'
]);

// SMART CUSTOM DEPLOY COMMANDS
task('db:migrate', function () {
    run("cd {{release_path}} && php artisan migrate");
});
task('horizon:terminate', function () {
    run("cd {{release_path}} && php artisan horizon:terminate");
});

// Hosts
// dep deploy production
// dep deploy beta

   host('staging')
   ->hostname('staging.app.com')
   ->user('forge')
   ->forwardAgent()
   ->stage('staging')
   ->set('deploy_path', '/home/forge/staging.app.com');

   host('production')
   ->hostname('xxx.xxx.xxx.x')
   ->user('forge')
   ->forwardAgent()
   ->stage('production')
   ->set('deploy_path', '/home/forge/app.com');


// Run database migrations
after('deploy:symlink', 'db:migrate');

// Clear OPCache
after('db:migrate', 'cachetool:clear:opcache');
after('cachetool:clear:opcache', 'horizon:terminate');

Output log

[RuntimeException]                          
  Can't detect http user name.                
  Please setup `http_user` config parameter.  
@jasperf
Copy link
Author

jasperf commented Jul 11, 2018

Never mind. Nginx was not running properly due to errors. Once solved it worked out.

@jasperf jasperf closed this as completed Jul 11, 2018
Fendo181 added a commit to Fendo181/lolipop-mc-starter-laravel that referenced this issue Dec 19, 2018
http_userのIssue

気にしなくても良いと言われたが気持ちわるいので、エラーがでないようにした
[Can't detect http user name. Please setup `http_user` config parameter. · Issue #1649 · deployphp/deployer](deployphp/deployer#1649)

writable_modeのIssue

deployphp/deployer#1118 (comment)
@ghost
Copy link

ghost commented Mar 22, 2019

I got the same error, @jasperf can you explain how did you solve it please ?

@jasperf
Copy link
Author

jasperf commented Mar 22, 2019

Well, Nginx had errors and or warnings in logs. Once solved I could unlock and redeploy. Exact errors I do not recall.

@ghost
Copy link

ghost commented Mar 22, 2019

It seems a different case for me, I'm curious about what's the result of
ps axo comm,user | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | sort | awk '{print $2}' | uniq
on the server you deployed successfully, I'm referencing to https://github.com/deployphp/deployer/blob/master/recipe/deploy/writable.php#L33

it return for me :

www-data
nginx
www-data

and that what causes the exception I think

@jasperf
Copy link
Author

jasperf commented Mar 22, 2019

Yeah, you should only have one hit here really. On a Laravel Forge set up Ubuntu server it is forge and on a standard LEMP Debian based it should be www-data I would say. Are you running multiple web server instances? Or did you add multiple users that can manage the web server?

@nikspyratos
Copy link

FWIW, for anyone else coming from Google: Check if your php-fpm is being killed inadvertantly. That can cause the ps axo comm,user command to return nothing. Restart php-fpm and retry your deploy.

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

No branches or pull requests

2 participants