2016-09-29 100 views
0

我试图部署一个项目到我们的生产服务器,因为我以前做过几次,但它似乎失败了作曲家:运行安装步骤。作曲家生产部署失败:运行安装

我运行cap production deploy:check,一切都很好。 我然后运行cap production deploy --trace,返回以下错误,当它到达作曲:运行步:

>** Invoke deploy:updated (first_time) 
>** Invoke composer:install (first_time) 
>** Execute composer:install 
>** Invoke composer:run (first_time) 
>** Execute composer:run 
>00:13 composer:run 
>  01 composer install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader 
>  01 stdin: is not a tty 
>cap aborted! 
>SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: >composer exit status: 1 
>composer stdout: Nothing written 
>composer stderr: stdin: is not a tty 
>/Library/Ruby/Gems/2.0.0/gems/sshkit->1.11.1/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in >execute' 
>/Library/Ruby/Gems/2.0.0/gems/sshkit->1.11.1/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute' 
>SSHKit::Command::Failed: composer exit status: 1 
>composer stdout: Nothing written 
>composer stderr: stdin: is not a tty 
>/Library/Ruby/Gems/2.0.0/gems/sshkit-1.11.1/lib/sshkit/command.rb:100:in >`exit_status=' 
>/Library/Ruby/Gems/2.0.0/gems/sshkit->1.11.1/lib/sshkit/backends/netssh.rb:148:in `execute_command' 
>/Library/Ruby/Gems/2.0.0/gems/sshkit->1.11.1/lib/sshkit/backends/abstract.rb:141:in `block in >create_command_and_execute' 
>/Library/Ruby/Gems/2.0.0/gems/sshkit->1.11.1/lib/sshkit/backends/abstract.rb:141:in `tap' 
>/Library/Ruby/Gems/2.0.0/gems/sshkit->1.11.1/lib/sshkit/backends/abstract.rb:141:in `create_command_and_execute' 
>/Library/Ruby/Gems/2.0.0/gems/sshkit->1.11.1/lib/sshkit/backends/abstract.rb:74:in `execute' 
>/Library/Ruby/Gems/2.0.0/gems/capistrano-composer->0.0.6/lib/capistrano/tasks/composer.rake:27:in `block (4 levels) in <top >(required)>' 
>/Library/Ruby/Gems/2.0.0/gems/sshkit->1.11.1/lib/sshkit/backends/abstract.rb:85:in `within' 
>/Library/Ruby/Gems/2.0.0/gems/capistrano-composer->0.0.6/lib/capistrano/tasks/composer.rake:26:in `block (3 levels) in <top >(required)>' 
>/Library/Ruby/Gems/2.0.0/gems/sshkit->1.11.1/lib/sshkit/backends/abstract.rb:29:in `instance_exec' 
>/Library/Ruby/Gems/2.0.0/gems/sshkit->1.11.1/lib/sshkit/backends/abstract.rb:29:in `run' 
>/Library/Ruby/Gems/2.0.0/gems/sshkit->1.11.1/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute' 
>Tasks: TOP => composer:run 
>The deploy has failed with an error: Exception while executing as >[email protected]: composer exit status: 1 
>composer stdout: Nothing written 
>composer stderr: stdin: is not a tty 
>** Invoke deploy:failed (first_time) 
>** Execute deploy:failed 

我试着找了这个作曲家退出状态:1,它似乎只是一个一般性错误。

我已经ssh到生产服务器,它似乎帽正在成功创建一个版本文件夹,并从回购拉下来的文件。该错误似乎在安装依赖关系时发生。

我在如何解决这个问题上有点失落。我发现的大多数其他线程似乎都有一些更丰富的错误消息。

Capistrano的以下日志:

INFO --------------------------------------------------------------------------- 
INFO START 2016-09-30 09:25:00 -0230 cap production deploy 
INFO --------------------------------------------------------------------------- 
INFO [f3a390e9] Running /usr/bin/env mkdir -p /home/USER/capistrano_tmp as [email protected] 
DEBUG [f3a390e9] Command: (export WP_ENV="staging" ; /usr/bin/env mkdir -p /home/USER/capistrano_tmp) 
INFO [f3a390e9] Finished in 2.175 seconds with exit status 0 (successful). 
DEBUG Uploading /home/USER/capistrano_tmp/git-ssh-banl-production-MK.sh 0.0% 
INFO Uploading /home/USER/capistrano_tmp/git-ssh-banl-production-MK.sh 100.0% 
INFO [523fe25b] Running /usr/bin/env chmod 700 /home/USER/capistrano_tmp/git-ssh-banl-production-MK.sh as [email protected] 
DEBUG [523fe25b] Command: (export WP_ENV="staging" ; /usr/bin/env chmod 700 /home/USER/capistrano_tmp/git-ssh-banl-production-MK.sh) 
INFO [523fe25b] Finished in 0.125 seconds with exit status 0 (successful). 
INFO [257d5c05] Running /usr/bin/env git ls-remote --heads $GIT_REPO as [email protected] 
DEBUG [257d5c05] Command: (export WP_ENV="staging" GIT_ASKPASS="/bin/echo" GIT_SSH="/home/USER/capistrano_tmp/git-ssh-banl-production-MK.sh" ; /usr/bin/env git ls-remote --heads $GIT_REPO) 
DEBUG [257d5c05] a9bd8b177eb5287fa6b968c2a92207c1c25e8bf4 refs/heads/master 
INFO [257d5c05] Finished in 6.650 seconds with exit status 0 (successful). 
INFO [63f0ffa5] Running /usr/bin/env mkdir -p /home/USER/public_html/shared /home/USER/public_html/releases as [email protected] 
DEBUG [63f0ffa5] Command: (export WP_ENV="staging" ; /usr/bin/env mkdir -p /home/USER/public_html/shared /home/USER/public_html/releases) 
INFO [63f0ffa5] Finished in 0.124 seconds with exit status 0 (successful). 
INFO [f7a9eb45] Running /usr/bin/env mkdir -p /home/USER/public_html/shared/web/app/uploads as [email protected] 
DEBUG [f7a9eb45] Command: (export WP_ENV="staging" ; /usr/bin/env mkdir -p /home/USER/public_html/shared/web/app/uploads) 
INFO [f7a9eb45] Finished in 0.123 seconds with exit status 0 (successful). 
INFO [ce8a26f9] Running /usr/bin/env mkdir -p /home/USER/public_html/shared as [email protected] 
DEBUG [ce8a26f9] Command: (export WP_ENV="staging" ; /usr/bin/env mkdir -p /home/USER/public_html/shared) 
INFO [ce8a26f9] Finished in 0.123 seconds with exit status 0 (successful). 
DEBUG [0f2919f9] Running [ -f /home/USER/public_html/shared/.env ] as [email protected] 
DEBUG [0f2919f9] Command: [ -f /home/USER/public_html/shared/.env ] 
DEBUG [0f2919f9] Finished in 0.123 seconds with exit status 0 (successful). 
DEBUG [0a95dd46] Running [ -f /home/USER/public_html/current/REVISION ] as [email protected] 
DEBUG [0a95dd46] Command: [ -f /home/USER/public_html/current/REVISION ] 
DEBUG [0a95dd46] Finished in 0.123 seconds with exit status 1 (failed). 
DEBUG [ca7de6e3] Running [ -f /home/USER/public_html/repo/HEAD ] as [email protected] 
DEBUG [ca7de6e3] Command: [ -f /home/USER/public_html/repo/HEAD ] 
DEBUG [ca7de6e3] Finished in 0.122 seconds with exit status 0 (successful). 
INFO The repository mirror is at /home/USER/public_html/repo 
DEBUG [5efe620a] Running if test ! -d /home/USER/public_html/repo; then echo "Directory does not exist '/home/USER/public_html/repo'" 1>&2; false; fi as [email protected] 
DEBUG [5efe620a] Command: if test ! -d /home/USER/public_html/repo; then echo "Directory does not exist '/home/USER/public_html/repo'" 1>&2; false; fi 
DEBUG [5efe620a] Finished in 0.123 seconds with exit status 0 (successful). 
INFO [b0a1ad08] Running /usr/bin/env git remote update --prune as [email protected] 
DEBUG [b0a1ad08] Command: cd /home/USER/public_html/repo && (export WP_ENV="staging" GIT_ASKPASS="/bin/echo" GIT_SSH="/home/USER/capistrano_tmp/git-ssh-banl-production-MK.sh" ; /usr/bin/env git remote update --prune) 
DEBUG [b0a1ad08] Fetching origin 
INFO [b0a1ad08] Finished in 5.040 seconds with exit status 0 (successful). 
DEBUG [6d7e14fa] Running if test ! -d /home/USER/public_html/repo; then echo "Directory does not exist '/home/USER/public_html/repo'" 1>&2; false; fi as [email protected] 
DEBUG [6d7e14fa] Command: if test ! -d /home/USER/public_html/repo; then echo "Directory does not exist '/home/USER/public_html/repo'" 1>&2; false; fi 
DEBUG [6d7e14fa] Finished in 0.123 seconds with exit status 0 (successful). 
INFO [0c8f006e] Running /usr/bin/env mkdir -p /home/USER/public_html/releases/20160930115512 as [email protected] 
DEBUG [0c8f006e] Command: cd /home/USER/public_html/repo && (export WP_ENV="staging" GIT_ASKPASS="/bin/echo" GIT_SSH="/home/USER/capistrano_tmp/git-ssh-banl-production-MK.sh" ; /usr/bin/env mkdir -p /home/USER/public_html/releases/20160930115512) 
INFO [0c8f006e] Finished in 0.125 seconds with exit status 0 (successful). 
INFO [a31715de] Running /usr/bin/env git archive master | tar -x -f - -C /home/USER/public_html/releases/20160930115512 as [email protected] 
DEBUG [a31715de] Command: cd /home/USER/public_html/repo && (export WP_ENV="staging" GIT_ASKPASS="/bin/echo" GIT_SSH="/home/USER/capistrano_tmp/git-ssh-banl-production-MK.sh" ; /usr/bin/env git archive master | tar -x -f - -C /home/USER/public_html/releases/20160930115512) 
INFO [a31715de] Finished in 0.158 seconds with exit status 0 (successful). 
DEBUG [e57ef477] Running if test ! -d /home/USER/public_html/repo; then echo "Directory does not exist '/home/USER/public_html/repo'" 1>&2; false; fi as [email protected] 
DEBUG [e57ef477] Command: if test ! -d /home/USER/public_html/repo; then echo "Directory does not exist '/home/USER/public_html/repo'" 1>&2; false; fi 
DEBUG [e57ef477] Finished in 0.124 seconds with exit status 0 (successful). 
DEBUG [cea943e0] Running /usr/bin/env git rev-list --max-count=1 master as [email protected] 
DEBUG [cea943e0] Command: cd /home/USER/public_html/repo && (export WP_ENV="staging" GIT_ASKPASS="/bin/echo" GIT_SSH="/home/USER/capistrano_tmp/git-ssh-banl-production-MK.sh" ; /usr/bin/env git rev-list --max-count=1 master) 
DEBUG [cea943e0] a9bd8b177eb5287fa6b968c2a92207c1c25e8bf4 
DEBUG [cea943e0] Finished in 0.126 seconds with exit status 0 (successful). 
DEBUG [1759b360] Running if test ! -d /home/USER/public_html/releases/20160930115512; then echo "Directory does not exist '/home/USER/public_html/releases/20160930115512'" 1>&2; false; fi as [email protected] 
DEBUG [1759b360] Command: if test ! -d /home/USER/public_html/releases/20160930115512; then echo "Directory does not exist '/home/USER/public_html/releases/20160930115512'" 1>&2; false; fi 
DEBUG [1759b360] Finished in 0.122 seconds with exit status 0 (successful). 
INFO [ae64693c] Running /usr/bin/env echo "a9bd8b177eb5287fa6b968c2a92207c1c25e8bf4" >> REVISION as [email protected] 
DEBUG [ae64693c] Command: cd /home/USER/public_html/releases/20160930115512 && (export WP_ENV="staging" ; /usr/bin/env echo "a9bd8b177eb5287fa6b968c2a92207c1c25e8bf4" >> REVISION) 
INFO [ae64693c] Finished in 0.132 seconds with exit status 0 (successful). 
INFO [e9cce54e] Running /usr/bin/env mkdir -p /home/USER/public_html/releases/20160930115512 as [email protected] 
DEBUG [e9cce54e] Command: (export WP_ENV="staging" ; /usr/bin/env mkdir -p /home/USER/public_html/releases/20160930115512) 
INFO [e9cce54e] Finished in 0.123 seconds with exit status 0 (successful). 
DEBUG [db1a3471] Running [ -L /home/USER/public_html/releases/20160930115512/.env ] as [email protected] 
DEBUG [db1a3471] Command: [ -L /home/USER/public_html/releases/20160930115512/.env ] 
DEBUG [db1a3471] Finished in 0.123 seconds with exit status 1 (failed). 
DEBUG [848e8fe8] Running [ -f /home/USER/public_html/releases/20160930115512/.env ] as [email protected] 
DEBUG [848e8fe8] Command: [ -f /home/USER/public_html/releases/20160930115512/.env ] 
DEBUG [848e8fe8] Finished in 0.121 seconds with exit status 1 (failed). 
INFO [7d1f7edd] Running /usr/bin/env ln -s /home/USER/public_html/shared/.env /home/USER/public_html/releases/20160930115512/.env as [email protected] 
DEBUG [7d1f7edd] Command: (export WP_ENV="staging" ; /usr/bin/env ln -s /home/USER/public_html/shared/.env /home/USER/public_html/releases/20160930115512/.env) 
INFO [7d1f7edd] Finished in 0.122 seconds with exit status 0 (successful). 
INFO [10b70c5d] Running /usr/bin/env mkdir -p /home/USER/public_html/releases/20160930115512/web/app as [email protected] 
DEBUG [10b70c5d] Command: (export WP_ENV="staging" ; /usr/bin/env mkdir -p /home/USER/public_html/releases/20160930115512/web/app) 
INFO [10b70c5d] Finished in 0.123 seconds with exit status 0 (successful). 
DEBUG [880e8bc2] Running [ -L /home/USER/public_html/releases/20160930115512/web/app/uploads ] as [email protected] 
DEBUG [880e8bc2] Command: [ -L /home/USER/public_html/releases/20160930115512/web/app/uploads ] 
DEBUG [880e8bc2] Finished in 0.123 seconds with exit status 1 (failed). 
DEBUG [349e1b98] Running [ -d /home/USER/public_html/releases/20160930115512/web/app/uploads ] as [email protected] 
DEBUG [349e1b98] Command: [ -d /home/USER/public_html/releases/20160930115512/web/app/uploads ] 
DEBUG [349e1b98] Finished in 0.121 seconds with exit status 0 (successful). 
INFO [8045d8e0] Running /usr/bin/env rm -rf /home/USER/public_html/releases/20160930115512/web/app/uploads as [email protected] 
DEBUG [8045d8e0] Command: (export WP_ENV="staging" ; /usr/bin/env rm -rf /home/USER/public_html/releases/20160930115512/web/app/uploads) 
INFO [8045d8e0] Finished in 0.125 seconds with exit status 0 (successful). 
INFO [07a69ec8] Running /usr/bin/env ln -s /home/USER/public_html/shared/web/app/uploads /home/USER/public_html/releases/20160930115512/web/app/uploads as [email protected] 
DEBUG [07a69ec8] Command: (export WP_ENV="staging" ; /usr/bin/env ln -s /home/USER/public_html/shared/web/app/uploads /home/USER/public_html/releases/20160930115512/web/app/uploads) 
INFO [07a69ec8] Finished in 0.124 seconds with exit status 0 (successful). 
DEBUG [ca95f29d] Running if test ! -d /home/USER/public_html/releases/20160930115512; then echo "Directory does not exist '/home/USER/public_html/releases/20160930115512'" 1>&2; false; fi as [email protected] 
DEBUG [ca95f29d] Command: if test ! -d /home/USER/public_html/releases/20160930115512; then echo "Directory does not exist '/home/USER/public_html/releases/20160930115512'" 1>&2; false; fi 
DEBUG [ca95f29d] Finished in 0.122 seconds with exit status 0 (successful). 
INFO [ee024dad] Running /usr/bin/env composer install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader as [email protected] 
DEBUG [ee024dad] Command: cd /home/USER/public_html/releases/20160930115512 && (export WP_ENV="staging" ; /usr/bin/env composer install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader) 
+0

找出问题: composer.json文件中的一个插件依赖项导致安装失败,因为作曲者找不到回购。 在'composer clearcache'后面运行'composer install'显示这个问题。 'composer clearcache'在这里很重要,因为它强制'comopser install'从它们各自的仓库中获取插件。由于插件是从本地开发的缓存中加载的,所以我从未在本地看到错误。 – user6899758

回答

0

相关的错误信息是:

标准输入:是不是tty

这可能意味着作曲家期待交互式用户输入。我对作曲家不熟悉,但这似乎解释了为什么非交互式Capistrano部署失败,但是您可以通过交互式SSH会话运行命令。

你可以尝试添加以下内容到Capistrano的deploy.rb

set :pty, true 

这告诉Capistrano的使用伪终端,这可能是足以让作曲家快乐。

+0

我尝试在'deploy.rb文件中添加'set:pty,true',但错误仍然存​​在。 虽然我认为交互不是问题,但运行的作曲家命令是'composer install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader',它有一个 - 无交互标志。 – user6899758