我试图通过Capistrano将Sinatra应用程序部署到使用Passenger的共享托管环境中。
当我在dry-run
模式下运行Capistrano脚本时,会收到有关passenger:restart
任务的消息:
$ bundle exec cap staging deploy --dry-run
00:00 git:wrapper
01 mkdir -p /home/[user]/tmp
02 #<StringIO:0x007fd5c99a4010> /home/[user]/tmp/git-ssh-foo-staging-craibuc.sh
03 chmod 700 /home/[user]/tmp/git-ssh-foo-staging-craibuc.sh
00:00 git:check
01 git ls-remote git@bitbucket.org:craibuc/foo.git HEAD
00:00 deploy:check:directories
01 mkdir -p /home/[user]/apps/foo/shared /home/[user]/apps/foo/releases
00:00 deploy:check:make_linked_dirs
01 mkdir -p /home/[user]/apps/foo/shared/config
00:00 git:clone
The repository mirror is at /home/[user]/apps/foo/repo
00:00 git:update
01 git remote set-url origin git@bitbucket.org:craibuc/foo.git
02 git remote update --prune
00:00 git:create_release
01 mkdir -p /home/[user]/apps/foo/releases/20181009151349
02 git archive master | /usr/bin/env tar -x -f - -C /home/[user]/apps/foo/releases/20181009151349
00:00 deploy:set_current_revision
01 echo "" > REVISION
00:00 deploy:symlink:linked_files
01 mkdir -p /home/[user]/apps/foo/releases/20181009151349/config
00:00 deploy:symlink:release
01 ln -s /home/[user]/apps/foo/releases/20181009151349 /home/[user]/apps/foo/releases/current
02 mv /home/[user]/apps/foo/releases/current /home/[user]/apps/foo
00:00 passenger:restart
FATAL In a dry run, we cannot check the passenger version, and therefore can't guess which passenger restart method to use. …
但是,当我尝试不使用dry-run
的脚本时,却没有提及passenger:restart
:
$ bundle exec cap staging deploy
... beginning omitted ...
00:12 deploy:symlink:release
01 ln -s /home/[user]/apps/foo/releases/20181009151413 /home/[user]/apps/foo/releases/current
01 stdin: is not a tty
✔ 01 [user]@supersonic.webhostserver.biz 0.226s
02 mv /home/[user]/apps/foo/releases/current /home/[user]/apps/foo
02 stdin: is not a tty
✔ 02 [user]@supersonic.webhostserver.biz 0.230s
00:12 deploy:cleanup
Keeping 3 of 4 deployed releases on supersonic.webhostserver.biz
01 rm -rf /home/[user]/apps/foo/releases/20181009012641
01 stdin: is not a tty
✔ 01 [user]@supersonic.webhostserver.biz 0.226s
00:13 deploy:log_revision
01 echo "Branch master (at b9e87a458308199b7655ee262f22ffdca81c1ee7) deployed as release 20181009151413 by [user]" >> /home…
01 stdin: is not a tty
✔ 01 [user]@supersonic.webhostserver.biz 0.227s
由于某些原因,未执行重新启动任务。
但是,我可以手动重新启动服务($ touch tmp/restart.txt
。
我想念什么?
Capfile
:
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
require 'dotenv/load'
# Git
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
# bundler-specific settings (for server)
# https://github.com/capistrano/bundler
require "capistrano/bundler"
# Phusion Passenger tasks; automatically adds passenger:restart task
# https://github.com/capistrano/passenger
require "capistrano/passenger"
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
passenger
:
$ passenger -v
Phusion Passenger 5.0.28
capistrano
:
$ cap --version
Capistrano Version: 3.11.0 (Rake Version: 12.3.1)