我正在使用Deployer将 SSH 连接到服务器并运行一些脚本进行部署。我不知道 Deployer 如何执行 ssh 的内部细节。
问题是它只有一个片段,$PATH
这意味着无法找到部署所需的二进制文件。我尝试将一个新的测试变量添加$FOO
到我能想到的所有文件中,以查看加载了哪个文件:
~/.bash_profile
~/.bashrc
~/.profile
/etc/profile
/etc/bash.bashrc
和:
...
export FOO="etcprofile"
但它们都不起作用,因为$FOO
运行 Deployer 时的值为空。
我还检查了 Deployer 中的标志和命令,似乎没有任何异常:
部署.php
task('debug:print', function () use($stage) {
run('echo $PATH');
run('echo $SHELL');
run('export');
dump($stage->getShellCommand());
dump($stage->getSshArguments());
exit("DONE");
});
输出
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
我还有另一台具有类似配置的服务器,它似乎运行良好。我不确定要寻找什么来识别配置中的差异。