I’m using Deployer to SSH onto a server and run some scripts for deployment. I don’t know the very internal details about how Deployer is executing ssh.
The problem is it only has a fragment of $PATH
which means the binary required for deployment cannot be found. I tried adding a new test variable $FOO
into all the files I can think of to see which one gets loaded:
~/.bash_profile
~/.bashrc
~/.profile
/etc/profile
/etc/bash.bashrc
with:
...
export FOO="etcprofile"
but none of them works since the value of $FOO
is empty when running Deployer.
I also checked the flags and the command in Deployer and there doesn't seem to be anything out of the ordinary:
deploy.php
task('debug:print', function () use($stage) {
run('echo $PATH');
run('echo $SHELL');
run('export');
dump($stage->getShellCommand());
dump($stage->getSshArguments());
exit("DONE");
});
output
falnyr@local:/Projects/deployer-app $ dep deploy stage-server -vvv
➤ Executing task debug:print
[stage-server] > echo $PATH
[stage-server] < ssh multiplexing initialization
[stage-server] < Linux stage-server xxx x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
[stage-server] < /usr/local/bin:/usr/bin:/bin:/usr/games
[stage-server] > echo $SHELL
[stage-server] < /bin/bash
[stage-server] > export
[stage-server] < declare -x HOME="/home/admin"
[stage-server] < declare -x LANG="en_US.UTF-8"
[stage-server] < declare -x LC_CTYPE="en_NZ.UTF-8"
[stage-server] < declare -x LOGNAME="admin"
[stage-server] < declare -x MAIL="/var/mail/admin"
[stage-server] < declare -x OLDPWD
[stage-server] < declare -x PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
[stage-server] < declare -x PWD="/home/admin"
[stage-server] < declare -x SHELL="/bin/bash"
[stage-server] < declare -x SHLVL="2"
[stage-server] < declare -x SSH_CLIENT="xxx.xxx.xxx.xxx 62738 22"
[stage-server] < declare -x SSH_CONNECTION="xxx.xxx.xxx.xxx 62738 xxx.xxx.xxx.xxx 22"
[stage-server] < declare -x USER="admin"
[stage-server] < declare -x XDG_RUNTIME_DIR="/run/user/1000"
[stage-server] < declare -x XDG_SESSION_ID="xxxxxx"
[stage-server] < declare -x _="/bin/bash"
"bash -s"
Deployer\Ssh\Arguments {#166
-flags: []
-options: []
}
DONE
I also have another server with a similar configuration which seems to be working well. I'm not sure what to look for to identify the difference in the configuration.