Why can't I start a Heroku console on the Cedar stack? - heroku

Trying to debug a new Heroku deployment - seems to be missing a db table. To do this, I'm running heroku run console but I get back :-
Running console attached to terminal... up, run.7
sh: console: not found
under both my Linux and Windows environments
What have I missed to get this working?
[Very late update : this is for a Java Heroku app, not a RoR one, so anything related to rails is a little lost on me]

on Celadon Cedar Stack it is changed to:
$ heroku run bash

$ heroku run bash
then
…#…:/app$ script/rails console
It worked for me. Though the second step is specific to Ruby on Rails – I don’t know the equivalent commands for other platforms and frameworks.

To run rails console, it's just:
heroku run rails console

Related

My Heroku-cli not recognizing commands. (Mac OS X)

When I run $"heroku help" in my Mac OS X Terminal, I get the following error from the Heroku Cli.
$ heroku help
▸ help is not a heroku command.
▸ Perhaps you meant help
▸ Run heroku help for a list of available commands.
And it applies to every heroku command except "heroku login".
$ heroku restart
▸ restart is not a heroku command.
▸ Perhaps you meant restart
▸ Run heroku help for a list of available commands.
etc...
Is anyone else experiencing the same problem? Or how do I fix it? Thanks.
I'm having the same issue (OSX) and was able to fix it. Here's what I did.
https://devcenter.heroku.com/articles/heroku-cli#troubleshooting
That link has some trouble shooting help. It referenced a log file so I went there.
cat ~/Library/Caches/heroku/error.log
Nothing obviously wrong for me, just references to "...is not a command", but the stack traces called out the following path.
/Users/[username]/.local/share/heroku/
I deleted that folder and did another reinstall of heroku.
Everything started working for me.
One thing I noticed was that although I had ungraded heroku and it said it was installing a new version, running the following command still declared the previous version I had installed.
heroku --version
so it sounds like it's a caching issue.

heroku: bash: bundle: command not found

I am porting a Heroku app from Aspen to Cedar stack at Heroku, following their instructions.
I'm at the last deploy step. I get this error:
2012-10-22T11:23:53+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -p 40310 -e production`
2012-10-22T11:23:54+00:00 app[web.1]: bash: bundle: command not found
I can't see how I can be responsible for telling the Heroku stack where bundle is, or providing it, since bundler is used by it for exactly this job. This command is specified in the Procfile for the app:
web: bundle exec thin start -p $PORT -e $RACK_ENV
Another similar question on stackoverflow suggests that this happens if the app is pushed to Heroku without a Procfile initially, so Heroku gets the wrong idea about what kind of app it is. That poster deleted his app and created a new one and reported success. However, the effort involved in deleting and recreating my ported app is high. Is there some way I can fix this rather than start over?
Heroku's slug build process must have changed with regard to ruby 1.8.7 apps. I'm guessing they started bundling to 1.8 paths instead of 1.9.1 for 1.8 apps. My previously working app stopped working after I tried to push a new revision.
Here's what got it working again:
heroku config:add PATH=bin:vendor/bundle/1.8/bin:/usr/local/bin:/usr/bin:/bin GEM_PATH=vendor/bundle/1.8
I took these paths from a newly created app using the same git repository as I used before.
EDIT: Turns out that heroku published a devcenter article Changing Ruby Version Breaks Path that specifies paths for various ruby versions.
I had the same issue and I solved it by setting the correct heroku config variables
$ heroku config
=== xxxx Config Vars
DATABASE_URL: postgres://(...)
GEM_PATH: vendor/bundle/ruby/1.9.1
HEROKU_POSTGRESQL_CRIMSON_URL: postgres://(...)
LANG: en_US.UTF-8
PATH: bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
PGBACKUPS_URL: https://(...)
RACK_ENV: production
RAILS_ENV: production
you can create an empty rails app, push it to heroku and check the variables it automatically set, then copy (and adapt) them to your application

how to run phantomjs on heroku?

I am trying to run phantomjs on the heroku cedar stack.
I am using a phantomjs buildpack for heroku https://github.com/stomita/heroku-buildpack-phantomjs.
However I followed the instructions but still cannot make it work.
When I run the command heroku run bash and type phantomjs --version it says phantomjs: command not found
I read things about LD_LIBRARY_PATH that needs to be set to "/usr/local/lib:/usr/lib:/lib:/app/vendor/phantomjs/lib", this is what i did but without success.
Is there something that i am missing ?
Where does the buildpack install the phantomjs binary exactly ? Is there a way to know the path where the binary is ?
I am using ruby 1.9.2
Thanks a lot for your help.
EDIT: To be more precise, i want to combine ruby and phantomjs, so i am using this custom buildpack: https://github.com/ddollar/heroku-buildpack-multi, but when i push to heroku i get "Heroku push rejected, failed to compile Multipack app"
Download the 64-bit linux binary file from phantomjs.org here http://phantomjs.org/download.html
Create a bin/ directory in your app if you do not already have one and place the binary file there. You should then be able to test if you can run it with "heroku run 'phantomjs'" or "heroku run 'bin/phantomjs'"
For phantomjs with javascript
I dont know if the previous examples are actually necessary becasue although i am working with javascript it should not be different. For me all i had to do was place the phantomjs buildpack as the first on the list of installed buildpacks on your master.
check available buildpacks
open terminal from the app folder and type:
heroku buildpacks
This wll show the available buildpacks.
eg.
1.heroku/node.js
2.https://github.com/stomita/heroku-buildpack-phantomjs.git
As you can see the buildpack is second on this list. We need tomake it the first in the list.So, what i did was i removed the phantomjs builpack and then add it again but this time made sure its first on the list of all available buildpacks.
So, to remove a buildpack, type:
heroku buildpacks:remove https://github.com/stomita/heroku-buildpack-phantomjs.git
this removes the buildpack.You can check it by typing:
heroku buildpacks
Now, it should only show,
1.heroku/node.js
Great, now we add the phantomjs buildackmaking sure its first . So on terminal type:
heroku buildpacks:add --index 1 https://github.com/stomita/heroku-buildpack-phantomjs.git
You can check if its first by typing:
heroku buildpacks
Now, it should be ,
1.https://github.com/stomita/heroku-buildpack-phantomjs.git
2.heroku/node.js
Thats It!!
now, on terminal , type:
heroku run bash
once you're in bash, type
phantomjs --version
The current verion of phantomjs should be shown on the terminal.
2.1.1

heroku cedar console

I've been trying to get a heroku console session going on cedar and am having no joy.
The old way was:
heroku console
I understand the new way involves 2 steps:
heroku run bash
then
$ rails console
but at the heroku run bash stage i keep geting:
heroku run bash
Running `bash` attached to terminal... up, run.1
!
! Timeout awaiting process
so i checked there isn't a port blocking issue and
telnet rendezvous.heroku.com 5000
gives
Trying 50.19.103.36...
Connected to ec2-50-19-103-36.compute-1.amazonaws.com.
Escape character is '^]'.
which is as expected i think
what am i doing wrong and what do i need to do to get this console up and running?
Thanks!
PS I have tried - heroku run console - also, and that times out too.
In cedar every command that needs to be attached to terminal uses run.
ex:
heroku run console
heroku run rake db:migrate
When its not necessary to be attached don't use the run:
ex: heroku logs
The new way is heroku run console
Ok - it was obvious after a few hours of sleep. Simply had to update the heroku gem that had got corrupted somehow on my mac. If you have something like this problem, then do that first...

Heroku Cedar Stack and command heroku run console

In my old Ruby 1.9.2 Sinatra apps running on Bamboo stack, heroku console provided a shell that not only initialized Active Record but also logged to a history file in my .heroku directory.
After moving to Heroku Cedar stack and using Ruby 1.9.3, I found heroku run console did not load any of my Active Record models. I fixed that by writing a small ruby script to initialize Active Record and load my models.
I execute this using the awkward heroku run 'bundle exec irb -r ./console'
This IRB console fires up fine and gives me access to my model data, but no history is logged.
1) Why is heroku run console so neutered?
2) How can I get my console sessions to log to history?
Please?
Thanks
Add the following line to your Procfile:
console: bundle exec irb -r ./console
Keeping the history is not easily possible, as it will spin up a dyno for every new invocation (cedar stack doesn't keep the history for Rails console, either). You could try using rlwrap to keep your history on the local machine.
From the docs:
You can use heroku console as a stand-in for Rails’s script runner, to
run one-time commands directly from the command line
and
Without an argument, heroku console launches an interactive console
similar to irb or the Rails script/console command
run console is aimed at running the Rails console, or irb.

Resources