Unable to deploy using Capistrano - 'Cap: command not found' - ruby-on-rails

I'm trying to deploy my app to the server using capistrano but getting this error message:
deployer#test:~$ cap production deploy
-bash: cap: command not found
How do I fix it?
When I run whereis cap, I get this:
Faisals-Air:transfercorp fkhalid2008$ whereis cap
/usr/bin/cap

Related

Cap production deploy failed error: could not locate gemfile on AWS server

I am deploying a rails app on a AWS ec2 instance through Capistrano.
Cap production deploy:check is successful, but when I am running cap production deploy I get an error.
Can anyone help?
I found the problem. Your Gemfile in the project was named "gemfile" SMALL g
It must be Gemfile.
So the thing run on Mac and Windows. But when you deploy to Linux, it does not see the Gemfile.Please rename the "gemfile" in your project to "Gemfile"
It will work.

Heroku Run Rails Console Not Working

$ heroku run rails c
-bash: heroku: command not found
I don't get it. Isn't that how you are suppose to startup the heroku console?
Install the heroku toolbelt first, and then try again your heroku run rails c command.
To verify your toolbelt installation use:
$ heroku --version
See Heroku CLI for more information.

sudo stdout: unicorn_appname_production: unrecognized service

I have a ubuntu server with nginx, rails, ruby, unicorn and capistrano, I have got it all setup, and there is no problems when I run
cap production deploy:check
but when I run
cap production deploy
I get this error:
sudo stdout: unicorn_frank_production: unrecognized service
It fails running
/usr/bin/env sudo service unicorn_appname_production restart
And I think the problem is the last "_production", because when I just run the command
/usr/bin/env sudo service unicorn_appname restart
It works great, but I don't know how to change capistranos command, so any help on this matter would be very appreciated!
deploy.rb
Capfile
It looks like capistrano/unicorn_nginx defaults its unicorn_service variable to the form "unicorn_#{fetch(:application)}_#{fetch(:stage)}" as seen in https://github.com/capistrano-plugins/capistrano-unicorn-nginx/blob/master/lib/capistrano/tasks/unicorn.rake#L9
If in your deploy.rb, you added:
set :unicorn_service, -> { "unicorn_#{fetch(:application)}" }
That should make it do what you expect.
Hope this helps!

Rails console into Docker on Heroku

I've got a Rails app on a Docker image deployed to Heroku using heroku docker:release. I normally use heroku run rails console to access the console, but I am getting bash: /app/user/bin/rails: Permission denied. How do I access the Rails console via the Heroku-CLI command line?
Try this
docker-compose run web rails c
heroku run bundle exec rails console

Heroku rails error trying to bring up console - sh: rails: not found

Trying to run the Heroku console but I am getting this following:
heroku run console
Running console attached to terminal... up, run.1
sh: console: not found
$ heroku run bash works but I seem to get a (green) bash prompt - "~ $" not a rails console! Can I get into the console from here?
fyi
git push heroku v311
Everything up-to-date
The first error is thrown simply because the console command doesn't exist. I personally have never meet a command called console in my life.
The syntax is heroku run the_command_i_want_to_run. For example: heroku run irb or heroku run bash.
The second error: There's no Rakefile in your project root. Since heroku run rails console say that Rails wasn't found, my guess is that your project wasn't (well) deployed.
Make sure you've done git push heroku.
You may also need to check the logs: heroku logs.
a guess:
heroku run rails console
If you're on the Bamboo stack (older stack than Cedar), try:
heroku run script/rails console
This works for me and is the command recommended in Heroku docs.
I got confused by this too.
It's just
$ heroku run console
Do this
heroku run -a my-app script/rails console
Reference: https://devcenter.heroku.com/articles/console-bamboo

Resources