Question

This is my 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"

This my 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 }

while running the following command "cap development unicorn:start" from my local environment

i am getting the following error

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

Let me know how to start the unicorn server in master branch

Was it helpful?

Solution

From the following line:

No such file or directory - /home/ec2-user/apps/app_dev/current/config/unicorn/.rb

I gather that unicorn is looking for /home/ec2-user/apps/app_dev/current/config/unicorn/<something should be here>.rb. This "something should be here", I expect is 'development' which I guess it is trying to take from fetch(:stage).

Try adding to development.rb

set :stage, :development

Edit

I did not notice the circularity of the logic of what I suggested (add something to the file that was not found to show where it is...) - you should add this line to config/deploy/development.rb, not to config/unicorn/development.rb... :-P

Update

Since that did not work, I've dug a bit in capistrano3/unicorn code, and found that the environment variable it is looking for is :rails_env, so also add

set :rails_env, :development
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top