Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Capistrano的“cap登台部署”任务已成功完成,但登台服务器上未显示更改_Ruby On Rails_Git_Deployment_Repository_Capistrano - Fatal编程技术网

Ruby on rails Capistrano的“cap登台部署”任务已成功完成,但登台服务器上未显示更改

Ruby on rails Capistrano的“cap登台部署”任务已成功完成,但登台服务器上未显示更改,ruby-on-rails,git,deployment,repository,capistrano,Ruby On Rails,Git,Deployment,Repository,Capistrano,这让人费解,因为在运行“cap staging deploy”之前,我已经正确地更新并推送到GIT的主分支,但是这些更改不会在登台服务器上呈现 请让我知道,如果我可以提供更多的信息,可能会有所帮助 提前感谢您的帮助 应用程序也正在成功重新启动部署: INFO [907b2583] Running /usr/bin/env touch /var/www/my_app/my_app-stgng/current/tmp/restart.txt as deploy@x.x.x.x DEBUG [907b

这让人费解,因为在运行“cap staging deploy”之前,我已经正确地更新并推送到GIT的主分支,但是这些更改不会在登台服务器上呈现

请让我知道,如果我可以提供更多的信息,可能会有所帮助

提前感谢您的帮助

应用程序也正在成功重新启动部署:

INFO [907b2583] Running /usr/bin/env touch /var/www/my_app/my_app-stgng/current/tmp/restart.txt as deploy@x.x.x.x
DEBUG [907b2583] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.1 /usr/bin/env touch /var/www/my_app/my_app-stgng/current/tmp/restart.txt )
INFO [907b2583] Finished in 0.666 seconds with exit status 0 (successful).
编辑:部署脚本设置为正确的分支,但是/views中的源代码与本地源代码不匹配

编辑:正确的源位于git repo主分支中。这似乎表明我的部署是从与预期不同的分支进行的

编辑:Capistrano部署日志摘录,与GIT相关:

DEBUG Uploading /home/deploy/deploy_tmp/myappme_app/git-ssh.sh 0.0%
INFO Uploading /home/deploy/deploy_tmp/myappme_app/git-ssh.sh 100.0%
INFO [ffabbafb] Running /usr/bin/env chmod +x /home/deploy/deploy_tmp/myappme_app/git-ssh.sh as deploy@x.x.x.x
DEBUG [ffabbafb] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.1 /usr/bin/env chmod +x /home/deploy/deploy_tmp/myappme_app/git-ssh.sh )
INFO [ffabbafb] Finished in 0.640 seconds with exit status 0 (successful).
INFO [16e6d3cd] Running /usr/bin/env git ls-remote --heads git@bitbucket.org:CryptoWhippet/myappme_app.git as deploy@x.x.x.x
DEBUG [16e6d3cd] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.1 GIT_ASKPASS=/bin/echo GIT_SSH=/home/deploy/deploy_tmp/myappme_app/git-ssh.sh /usr/bin/env git ls-remote --heads git@bitbucket.org:CryptoWhippet/myappme_app.git )
DEBUG [16e6d3cd]        2cd85c80e2d9b4c33b791c341dd19894        refs/heads/master
INFO [16e6d3cd] Finished in 5.960 seconds with exit status 0 (successful).

[..]

DEBUG [4341e870] Running /usr/bin/env [ -f /var/www/my_app/my_app-stgng/repo/HEAD ] as deploy@x.x.x.x
DEBUG [4341e870] Command: [ -f /var/www/my_app/my_app-stgng/repo/HEAD ]
DEBUG [4341e870] Finished in 0.691 seconds with exit status 0 (successful).
INFO The repository mirror is at /var/www/my_app/my_app-stgng/repo
DEBUG [20a36e89] Running /usr/bin/env if test ! -d /var/www/my_app/my_app-stgng/repo; then echo "Directory does not exist '/var/www/my_app/my_app-stgng/repo'" 1>&2; false; fi as deploy@x.x.x.x
DEBUG [20a36e89] Command: if test ! -d /var/www/my_app/my_app-stgng/repo; then echo "Directory does not exist '/var/www/my_app/my_app-stgng/repo'" 1>&2; false; fi
DEBUG [20a36e89] Finished in 0.648 seconds with exit status 0 (successful).
INFO [6bb0fabc] Running /usr/bin/env git remote update as deploy@x.x.x.x
DEBUG [6bb0fabc] Command: cd /var/www/my_app/my_app-stgng/repo && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.1 GIT_ASKPASS=/bin/echo GIT_SSH=/home/deploy/deploy_tmp/myappme_app/git-ssh.sh /usr/bin/env git remote update )
DEBUG [6bb0fabc]        Fetching origin
INFO [6bb0fabc] Finished in 4.061 seconds with exit status 0 (successful).
DEBUG [bcc4ff25] Running /usr/bin/env if test ! -d /var/www/my_app/my_app-stgng/repo; then echo "Directory does not exist '/var/www/my_app/my_app-stgng/repo'" 1>&2; false; fi as deploy@x.x.x.x
DEBUG [bcc4ff25] Command: if test ! -d /var/www/my_app/my_app-stgng/repo; then echo "Directory does not exist '/var/www/my_app/my_app-stgng/repo'" 1>&2; false; fi
DEBUG [bcc4ff25] Finished in 0.648 seconds with exit status 0 (successful).
INFO [a3663844] Running /usr/bin/env mkdir -p /var/www/my_app/my_app-stgng/releases/20151209132220 as deploy@x.x.x.x
DEBUG [a3663844] Command: cd /var/www/my_app/my_app-stgng/repo && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.1 GIT_ASKPASS=/bin/echo GIT_SSH=/home/deploy/deploy_tmp/myappme_app/git-ssh.sh /usr/bin/env mkdir -p /var/www/my_app/my_app-stgng/releases/20151209132220 )                                                                                                                                                                                                                                                                     
INFO [a3663844] Finished in 0.650 seconds with exit status 0 (successful).
INFO [b2cf939e] Running /usr/bin/env git archive master | tar -x -f - -C /var/www/my_app/my_app-stgng/releases/20151209132220 as deploy@x.x.x.x
DEBUG [b2cf939e] Command: cd /var/www/my_app/my_app-stgng/repo && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.1 GIT_ASKPASS=/bin/echo GIT_SSH=/home/deploy/deploy_tmp/myappme_app/git-ssh.sh /usr/bin/env git archive master | tar -x -f - -C /var/www/my_app/my_app-stgng/releases/20151209132220 )                                                                                                                                                                                                                                          
INFO [b2cf939e] Finished in 3.266 seconds with exit status 0 (successful).
DEBUG [b21a4932] Running /usr/bin/env if test ! -d /var/www/my_app/my_app-stgng/repo; then echo "Directory does not exist '/var/www/my_app/my_app-stgng/repo'" 1>&2; false; fi as deploy@x.x.x.x
DEBUG [b21a4932] Command: if test ! -d /var/www/my_app/my_app-stgng/repo; then echo "Directory does not exist '/var/www/my_app/my_app-stgng/repo'" 1>&2; false; fi
DEBUG [b21a4932] Finished in 0.646 seconds with exit status 0 (successful).
DEBUG [efdb30ab] Running /usr/bin/env git rev-list --max-count=1 --abbrev-commit master as deploy@x.x.x.x
DEBUG [efdb30ab] Command: cd /var/www/my_app/my_app-stgng/repo && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.1 GIT_ASKPASS=/bin/echo GIT_SSH=/home/deploy/deploy_tmp/myappme_app/git-ssh.sh /usr/bin/env git rev-list --max-count=1 --abbrev-commit master )
DEBUG [efdb30ab]        8b9d346
DEBUG [efdb30ab] Finished in 0.630 seconds with exit status 0 (successful).

您是否重新启动了服务器

在部署之后,我们需要做一些事情,一旦您部署了代码,我们就需要签出服务器,并且我们需要重新启动服务器实例,以便将更改提交到您的暂存服务器上,希望这会对您有所帮助

可能您需要在登台配置文件中添加一些任务,以便如果您希望自动重新启动服务器,则应自动重述服务器

after 'deploy:publishing', 'deploy:restart'

某些版本的sass-rails在部署时没有重新编译样式表,存在一个bug。您应该首先检查暂存服务器上的git目录是否与master中的相同,然后检查您添加的功能是否正常工作。如果是这样的话,那么您只有样式表或javascript的问题,您可能需要使用gem版本

要查找工作的gem版本,您可以在临时服务器上手动更改gemfile,然后使用与capistrano用于捆绑和预编译资产相同的命令


如果没有帮助,请检查capistrano存储库的克隆镜像,以确认它与origin/maser处于相同的状态。如果不匹配,并且您确定部署配置中的git存储库设置正确,则应清除存储库目录并重新运行部署例程。

是否可以显示cap跟踪。重新启动服务器时一定找不到它。@尼钦,我也这么想,但它正在重新启动。我甚至手动重新启动。将添加上述信息。是否在部署脚本中设置了预期的分支?手动检查服务器上的soruce代码一次。@Nithin,有意思!正确的分支在部署脚本中设置为默认分支,但在服务器上手动检查源代码时,会发现/views中的代码与我的本地代码不匹配。@Nithin,现在也注意到:正确的源代码在git repo主分支中。这似乎表明我的部署是从一个与预期不同的分支进行的。是的,它会重新启动。我已经更新了这篇文章来反映这一点。试着一个接一个地重复capistrano命令,它可能会提示你哪里出了问题。您是否检查过它是否真的在releases文件夹中发布?它可能不会更新当前符号链接。如果使用ssh进行检查,则可能会看到旧文件夹。光盘&&cd current,以确保您正在查看当前符号链接所查看的同一文件夹。在没有看到日志的情况下,我猜逐个执行命令应该会告诉您出了什么问题。你们有并没有检查过它是否真的从git中提取了正确的源代码?我不记得capistrano存储git copy的确切位置,但您可能清楚地看到它为此执行的命令,尝试执行该命令并检查git源是否与master上的相同。如果没有,则capistrano会提取错误的git源。如果是,则capistrano在复制时失败。我个人从未遇到过这样的问题,但应该很容易找到它失败的地方。存储库镜像位于/var/www/my_app/my_app-stgng/repo。您可能应该检查它是否与origin/master处于相同的状态。您应该删除该目录,并确保capistrano获取master分支。如果没有,我会检查部署配置并检查为什么没有。我编辑了您的答案以反映您帮助我推断的解决方案。一旦同行评审,我将接受。谢谢@Fedcomp。