Having a weird issue and need help.
I am trying to start a rails console on a production server and it is acting like the rails c command does not exist.
FWIW, I have been a rails developer for 4 years and do this all the time on a plethora of other servers without issue. On this server, I can drop, create, migrate, seed the database with no problems (using RAILS_ENV=production), and the app works fine live without any issues.
Ubuntu 14.04 (racksapce 2nd gen performance 1 server)
Nginx with Passenger (I typically use Unicorn, but have never had a problem on any of the apps I have deployed with Passenger)
Ruby 2.1.5 (using rvm)
Capistrano 3 (using the rvm, migrations, asset-precompilation, etc. extensions)
What I've tried:
cd into app directory:
rails c production # (which usually works no problem)
bundle exec rails c production # (sometimes have to do this on older apps that do not have the newer capistrano 3 and rvm setup)
rails c production RAILS_ENV=production # (getting desperate here)
RAILS_ENV=production rails c production # (haha, surely this won't work, but out of options)
RAILS_ENV=production bundle exec rails console
rails new APP_PATH [options]
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
..... yada yada, shows the rest of the rails options (oddly enough does not show 'c' or 'console' as options?)
Ok, found the issue... @stoodfarback was pretty close, but I thought the cause of the issue needed to be mentioned for others who might encounter the same thing.
Basically I am using a newer version of Capistrano (3.3.5) than I have used in the past and it (by default) adds 'bin' to the list of shared directories that it symlinks on each deploy.
set :linked_dirs, fetch(:linked_dirs, ).push('bin', 'log', 'tmp', 'public/system', "public/downloads", "public/assets")
So the deploy script created a new directory in shared called bin (which was empty) and the files used to launch rails server and console were missing. They were obviously still there in development, so it only affected production.
Removed 'bin' from the linked_dirs list and everything now works as expected.
now looks like:
set :linked_dirs, fetch(:linked_dirs, ).push('log', 'tmp', 'public/system', "public/downloads","publ ic/assets")
I have noticed on the last few versions of Capistrano that I have used, the format and defaults for linked_dirs keeps changing quite a bit, but I had never seen bin in that list. Not really sure why bin would need to be symlinked... it only has the default rails files and I can't think of why they would need to be removed from source control, but maybe the Capistrano team has a reason.
Hope this helps someone.