Some heroku commands couldn't find my application - ruby

I can find my apps in heroku apps command, and also do some command to read information from app like heroku addons --app appname.
But I couldn't find my apps in some command like heroku addons:add addon_name, heroku pg:reset.
Work commands
heroku apps:
=== My Apps
my_app_1
my_app_2
(Also I can see my apps in heroku web dashboard.)
heroku addons --app my_app_1(not in my_app_1 folder):
=== my_app_1 Configured Add-ons
shared-database:5mb
heroku addons(in my_app_1 folder):
=== my_app_1 Configured Add-ons
shared-database:5mb
Doesn't work commands
heroku addons:add sendgrid(in my_app_1 folder):
! No app specified.
! Run this command from an app folder or specify which app to use with --app
heroku pg:reset DATABASE --confirm my_app_1(in my_app_1 folder):
Resetting SHARED_DATABASE (DATABASE_URL)... failed
! Resource not found
Here is my environment.
Max OS X Lion (10.7.4)
rvm 1.13.8 (stable)
ruby 1.9.3p194
heroku 2.26.5

Adding the heroku's remote configuration to git did the trick for me. Validate if you have it configured with git remote -v on the terminal and you should get something like:
heroku git#heroku.com:your-app.git (fetch)
heroku git#heroku.com:your-app.git (push)
if you don't, add it with
git remote add heroku git#heroku.com:your-app.git

It looks like the latest version fo the Heroku gem (2.26.5) is broken. A workaround is to downgrade to 2.26.3.
gem uninstall heroku -v 2.26.5
gem install heroku -v 2.26.3

It looks like you have a conflict between the Heroku gem, and the Heroku Toolbelt. I'm guessing you have installed the Heroku Toolbelt, but still have the Heroku gem in your gem file.
Remove the Heroku gem from your Gemfile and save.
Run the bundle command to update your Gemfile.lock
In Terminal, run gem uninstall heroku (NOTE: there may be multiple versions of the Heroku gem installed, and you'll need to uninstall all of them.)
In Terminal, run heroku addons
If you get heroku: command not found then you don't have the Heroku Toolbelt installed.
Install the Heroku Toolbelt and run the command again.
NOTE: If you're not in the app's directory, you'll need to add --app myapp1 to the Heroku commands.
Hope this helps.

Related

Heroku ps:exec changes get reset after server restart

I wanted to create/change/command directly to the heroku app through heroku CLI, ps:exec command.
For example, I actually tried to update an spree(ecommerce framework written Rails) app I created using Heroku button. After I created the app with Heroku button, I found I need an extension,
spree_digital to create digital product. So I tried following steps:
heroku ps:exec -a spreeapp
$ # install nano editor here
$ nano Gemfile # added a line: gem 'spree_digital', github: 'spree-contrib/spree_digital'
$ bundle install
$ bundle exec rails g spree_digital:install # and no error.
$ exit
heroku ps:restart # the git repo says server restart is required so
heroku ps:exec -a spreeapp # and test if that the Gemfile is same as the line added one
$ cat Gemfile # and I found that the file I changed didn't change..
I'm new to Heroku, your each comment must be fuge help for me. Thanks.

Upgrading to cedar-14 when deploying via the heroku

I tried to migrate my app to cedar-14 stack, but when i do:
heroku stack:set cedar-14
i ve got the message: stack:set` is not a heroku command
What can i do please?
Thanks
Please use following command to move from cedar to cedar-14
heroku stack:migrate cedar-14 -a <app name>
This error indicates your version of the heroku toolbelt doesn't know this command. You should update to the latest version.
You can check the version you have installed with the heroku version command:
heroku version
heroku-toolbelt/3.42.20 (x86_64-darwin10.8.0) ruby/1.9.3
heroku-cli/4.26.1-bf7a4d8 (amd64-darwin) go1.5.1
The heroku update command should update you to the latest version. If that doesn't work, try reinstalling it from scratch: https://toolbelt.heroku.com/
You also need to make sure you aren't using the gem version of the toolbelt, which has been deprecated for several years. Uninstall it with the gem uninstall heroku command.

Switch from heroku gem to heroku-api topolbelt

Heroku is so good at making things simple...but this...not so much. How do you switch from the heroku gem to the new tool belt? Here are the steps I have taken:
$ heroku version: heroku-gem/2.32.5 (x86_64-darwin11.4.1) ruby/1.9.3 autoupdate
removed 'gem "heroku"' from gem file
added 'gem "heroku-api"' to gemfile
deleted gemfile.lock
$ bundle install
installed toolbelt via the package installer
$ heroku login ... returns "Authentication successful"
$ heroku version: STILL RETURNS heroku-gem/2.32.5 (x86_64-darwin11.4.1) ruby/1.9.3 autoupdate
Two questions:
#1 Why is my version still using the heroku-gem after taking the steps above?
#2 Where do I put "heroku = Heroku::API.new(:api_key => API_KEY)" for use with the heroku-api gem?
Deleting the gemfile.lock file didn't cut it. I had to run gem uninstall heroku (which I had 9 version of)... After that, heroku version showed to tool belt.

Can't deploy to Heroku the app with RJB gem

I've set the JAVA_HOME variable
heroku config:add JAVA_HOME=/usr/lib/jvm/java-6-openjdk
checked that heroku config shows this variable with value,
then pushed:
git push heroku master
and still get
JAVA_HOME is not set
error while bundler is installing RJB gem.
I can successfully deploy the same source to another Heroku application, and all environment variables are the same.
What is wrong?
I had the same question, and in case anyone else wants to know, this is what Heroku told me:
By default the config variables aren't made available when the
application is compiled - only at runtime.
You can change this by making sure you have the latest heroku gem
install, then enable the user_env_compile lab flag
$ heroku labs:enable user-env-compile
this will make JAVA_HOME available when the gem installs, hopefully
getting you past this issue.
First find JAVA_HOME PATH by using,
heroku run 'which java |xargs readlink -f | sed "s:bin/java::"'
It will return you,
usr/lib/jvm/java-6-openjdk/jre
Using this now you came know about JAVA_HOME path on heroku. Now set JAVA_HOME path in heroku and in Gemfile
on heroku cli :
heroku config:add JAVA_HOME=/usr/lib/jvm/java-6-openjdk
In Gemfile on top :
java_home = '/usr/lib/jvm/java-6-openjdk'
ENV['JAVA_HOME'] = java_home if Dir.exist?(java_home)
Got Heroku to install gems that depend on $JAVA_HOME by adding the following to my Gemfile:
# set JAVA_HOME so Heroku will install gems that need it
heroku_java_home = '/usr/lib/jvm/java-6-openjdk'
ENV['JAVA_HOME'] = heroku_java_home if Dir.exist?(heroku_java_home)
Have you tried deploying your app to a different stack?
I did a little searching and this seems to fit your explanation.
https://github.com/carlhuda/bundler/issues/1742
probably yours report, isn't it?
I would advice you to contact Heroku and ask them to look into it.
It seems like it's missing dependencies which may, not be available on your current stack.
for migration from heroku cedar-14 to heroku-16 or heroku-18
$ heroku config:unset JAVA_HOME #remove JAVA_HOME env if exists
$ heroku stack:set heroku-18
$ heroku buildpacks:add --index 1 heroku/jvm
$ git push heroku master
To deploy to the heroku-20 stack, make sure you add the following build packs in this order:
heroku buildpacks:add heroku/jvm
heroku buildpacks:add heroku/ruby
You do NOT need to set JAVA_HOME manually with heroku-20. Nor will Heroku set it for you. The variable is already internally available to rjb when it is being installed.
Your final result should look like this:

Heroku wrongly detecting my Node app as a Ruby app

I have a Node project that is using Bundler and Guard to handle my pre-compilations steps.
This means that I have a Gemfile in the root of my project along with the package.json file.
My problem is that Heroku believes that my project is a Ruby app, just because the Gemfile exists. And complains that I have not committed the Gemfile.lock, which I don't want to commit.
-----> Heroku receiving push
-----> Ruby app detected
!
! Gemfile.lock is required. Please run "bundle install" locally
! and commit your Gemfile.lock.
!
! Heroku push rejected, failed to compile Ruby app
Is there a way to tell Heroku that the app is a Node app and not a Ruby app?
The solution to this, with a lot of help from Heroku Support is: use a build pack!
Override the Heroku default buildpacks by specifying a custom buildpack in the BUILDPACK_URL config var
$ heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs
You can also specify a buildpack during app creation
$ heroku create -s cedar --buildpack https://github.com/heroku/heroku-buildpack-nodejs
Simple when you know it. Some more documentation can be found at Heroku Dev Center
It seems there's a new way to do this as BUILDPACK_URL is now deprecated, explained here, but essentially the command is:
$ heroku buildpacks:set heroku/nodejs
You may also specify a buildpack during app creation:
$ heroku create myapp --buildpack heroku/nodejs

Resources