0

这是我的 config/unicorn/development.rb

app_path = "/home/ec2-user/apps/app_dev/current"

worker_processes 1
preload_app false
timeout 300
listen 3333

working_directory app_path
pid "#{app_path}/tmp/pids/unicorn.pid"

rails_env = 'development'

stderr_path "log/unicorn.log"
stdout_path "log/unicorn.log"

这是我的 Capfile

# Load DSL and Setup Up Stages
require 'capistrano/setup'

# Includes default deployment tasks
require 'capistrano/deploy'


require 'capistrano/rvm'
# require 'capistrano/rbenv'
# require 'capistrano/chruby'
require 'capistrano/bundler'
# require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano3/unicorn'
# require 'sidekiq/capistrano'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }

在运行以下命令时"cap development unicorn:start"从我的本地环境

我收到以下错误

RVM is not a function, selecting rubies with 'rvm use ...' will not work.
DEBUG [eba94152]    
DEBUG [eba94152]    You need to change your terminal emulator preferences to allow login shell.
DEBUG [eba94152]    Sometimes it is required to use `/bin/bash --login` as the command.
DEBUG [eba94152]    Please visit https://rvm.io/integration/gnome-terminal/ for a example.
DEBUG [eba94152]    
DEBUG [eba94152]    /home/ec2-user/apps/app_dev/shared/bundle/ruby/2.0.0/gems/unicorn-4.8.2/lib/unicorn/configurator.rb:75:in `read'
DEBUG [eba94152]    : 
DEBUG [eba94152]    No such file or directory - /home/ec2-user/apps/app_dev/current/config/unicorn/.rb
DEBUG [eba94152]     (
DEBUG [eba94152]    Errno::ENOENT
DEBUG [eba94152]    )
cap aborted!
bundle stdout: Nothing written
bundle stderr: Nothing written

让我知道如何在 master 分支中启动独角兽服务器

4

1 回答 1

6

从以下行:

没有这样的文件或目录 - /home/ec2-user/apps/app_dev/current/config/unicorn/.rb

我推测那只独角兽正在寻找/home/ec2-user/apps/app_dev/current/config/unicorn/<something should be here>.rb。这个“应该在这里”,我希望是“发展”,我想它正试图从中获取fetch(:stage)

尝试添加到development.rb

set :stage, :development

编辑

我没有注意到我建议的逻辑的循环性(在文件中添加一些未找到的内容以显示它的位置...)-您应该将此行添加到config/deploy/development.rb,而不是config/unicorn/development.rb... :-P

更新

由于这不起作用,我在capistrano3/unicorn 代码中挖了一下,发现它正在寻找的环境变量是:rails_env,所以还要添加

set :rails_env, :development
于 2014-03-04T13:15:49.183 回答