Deploying rails app on heroku - ruby-on-rails

I'm learning RoR and trying to deploy my test app to heroku receiving next error:
Unresolved dependencies detected; Installing...
Using --without developmen
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control
You have added to the Gemfile:
* therubyracer (~> 0.9.3.beta1)
* pg
FAILED: http://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler
Please! Help!

Have you committed your Gemfile.lock?
bundle install
git add Gemfile.lock
git commit -am "Add lock file"
git push heroku master

This error might be because you did not completely do bundle install.
First do
bundle install
Add gem 'pg' to the gem file and install the postgres gems and postgres on your local machine. If you dont want to install postgres on your local machine then add gem 'pg to production environment and run bundle install without test environment. Though heroku discourages this way of running your application. It is always better to use same database for running locally and in production. Installing postgres is pain but it is worth it.
Your ruby should be 1.9.2.
After installing all the dependencies and post gres on your machine do bundle install and add your gem file to heroku.
git add Gemfile
git add Gemfile.lock
git commit
git push heroku master

Related

Mina Deploy "Bundle is locked to rake"

After running
mina deploy
I get this error
mina deploy
-----> Creating a temporary build path
-----> Fetching new git commits
-----> Using git branch 'master'
Cloning into '.'...
done.
-----> Using this git commit
root (e1bd364):
> fixes fo rmina
-----> Symlinking shared paths
-----> Installing gem dependencies using Bundler
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Your Gemfile has no gem server sources. If you need gems that are not already on
your machine, add a line like this to your Gemfile:
source 'https://rubygems.org'
Your bundle is locked to rake (12.0.0), but that version could not be found in
any of the sources listed in your Gemfile. If you haven't changed sources, that
means the author of rake (12.0.0) has removed it. You'll need to update your
bundle to a different version of rake (12.0.0) that hasn't been removed in order
to install.
! ERROR: Deploy failed.
-----> Cleaning up build
Unlinking current
OK
Connection to app.com closed.
! Run Error
If I run bundle show rake I see this
/var/lib/gems/2.3.0/gems/rake-12.0.0
I tried looking in app/vendor and bundler is not there. I tried using bundle install and bundle update.
Update:
I checked and source 'https:rubygems.org' is in my gemfile.
I tried running bundle install deployment
bundle install --deployment
and ran into the same error.
Your Gemfile has no gem server sources. If you need gems that are not already on your machine, add a line like this to your Gemfile:
source 'https://rubygems.org'
Seems like there is no gem source specified in your Gemfile
You may try adding this line at the top of your Gemfile
source 'https://rubygems.org'
and then try again
So the issue had to do with permissions and running as root as the error stated.
I had mina and some of the other gem folders under a different user, while deploying as root. Once I cleared up the ownership of files, and added the user as a root user, mina deployed correctly.

"sqlite3.h" missing when pushing Rails app to Heroku

I'm following this tutorial, but it fails when I try to push to Heroku. It seems "sqlite3.h" is missing. I'm new to development so I'm not sure what information will help people diagnose the problem, so here's everything :). I'm running on Mac OS X 10.7 Lion. Here are the versions of everything I'm working with:
Amits-MacBook-Air-2:demo_app amitgupta$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]
Amits-MacBook-Air-2:demo_app amitgupta$ rails -v
Rails 3.2.3
Amits-MacBook-Air-2:demo_app amitgupta$ sqlite3 -version
3.7.11 2012-03-20 11:35:50 00bb9c9ce4f465e6ac321ced2a9d0062dc364669
Amits-MacBook-Air-2:demo_app amitgupta$ heroku -v
2.25.0
Amits-MacBook-Air-2:demo_app amitgupta$ port -v
MacPorts 2.0.4
Entering interactive mode... ("help" for help, "quit" to quit)
[RailsApps/demo_app] > quit
Goodbye
When I try to push to Heroku:
Amits-MacBook-Air-2:demo_app amitgupta$ heroku create --stack cedar
Creating floating-stream-8009... done, stack is cedar
http://floating-stream-8009.herokuapp.com/ | git#heroku.com:floating-stream-8009.git
Amits-MacBook-Air-2:demo_app amitgupta$ git push heroku master
Here's what I get:
Counting objects: 119, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (104/104), done.
Writing objects: 100% (119/119), 33.74 KiB, done.
Total 119 (delta 17), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.1.2
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
Fetching gem metadata from https://rubygems.org/.......
Installing rake (0.9.2.2)
.
.
.
Installing sqlite3 (1.3.6) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
.
.
.
--disable-local
Gem files will remain installed in /tmp/build_2l2dn7bx7lu34/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6 for inspection.
Results logged to /tmp/build_2l2dn7bx7lu34/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out
An error occured while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
To git#heroku.com:blazing-mountain-3659.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:blazing-mountain-3659.git'
When I do:
Amits-MacBook-Air-2:demo_app amitgupta$ sudo port install sqlite3 +universal
I get:
Password:
---> Computing dependencies for sqlite3
---> Cleaning sqlite3
Next I tried:
Amits-MacBook-Air-2:demo_app amitgupta$ sudo gem install sqlite3 -v '1.3.6'
And get:
Building native extensions. This could take a while...
Successfully installed sqlite3-1.3.6
1 gem installed
Installing ri documentation for sqlite3-1.3.6...
Installing RDoc documentation for sqlite3-1.3.6...
Then:
Amits-MacBook-Air-2:demo_app amitgupta$ bundle install
gives:
Using rake (0.9.2.2)
.
.
.
Using sqlite3 (1.3.6)
Using uglifier (1.2.4)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Then I try pushing to Heroku again, but get the same problem. Perhaps it has something to do with the discrepancy between the first command "Creating floating-stream-8009" and the second command "failed to push some refs to 'git#heroku.com:blazing-mountain-3659.git'"?
gem 'sqlite3', :group => [:development, :test]
group :production do
gem 'pg'
end
edit Gemfile as above
remove Gemfile.lock
run bundle install --without production
git add .
git commit -am "bundle updating sqlite3"
git push heroku master
Heroku uses postgresql so you want to remove sqlite3 or move it into a development group in your Gemfile.
Check you Gemfile.lock for any other gems that may have dependencies on sqlite3, as this can also cause problems.
I had a similar problem and I wasn't even using sqlite3 for anything but after removing it from the gem file I still got that error
what solved it for me was a commit command
git commit -am
that I found on this tutorial
What happened to me was, I was following along the Heroku tutorial and when I used git push heroku master it was pushing from my latest Git commit (obviously!)
What I forgot was that in the eyes of Git, I was still using sqlite in the gemfile! Silly me!
So I used git add . followed by a git commit -m "Changed to Postgres." so Git knew about these changes. Pushing after that worked fine for me.
Yes, as these answers suggest, most of the time you will want to avoid using SQLite in production due to the constraints of the Heroku platform. However, you may have a perfectly acceptable use case (ex. read-only config) for using SQLite anyway. My recommendation is to:
Add the heroku-buildpack-apt buildpack
Add to your Aptfile:
libsqlite3-dev
libsqlite3-0

Heroku Error when pushing to staging server

I have tried everything that I can find in StackOverflow as well as some other sites and my problem still exists.
Gemfile detected, running Bundler version 1.0.7
Unresolved dependencies detected; Installing...
Using --without development:test
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control
You have added to the Gemfile:
* libnotify
* rb-inotify
You have deleted from the Gemfile:
* growl
* rb-fsevent
Here is what I've tried and my Gemfile
https://gist.github.com/2244347
I thought that I head read in your Gist that you tried removing Gemfile.lock from your git and re-adding it. But since I don't see that I'm going to assume that you forgot to commit it:
git add Gemfile.lock
git commit -m "Adding Gemfile.lock"
bundle install
git add Gemfile.lock
git commit -am "Updated
Gemfile"
git push heroku master

Trouble pushing barebones app to Heroku with paperclip gem

We have an app that's been running on Heroku (bamboo) for over a year. When pushing a change yesterday, the push was rejected when it failed to install the paperclip gem. No changes had been made to the gem list up to the point of failure. I tried a brand new, barebones app and got the same result. It seems the bamboo stack has changed in some way. Anybody else experiencing this or know what might be going on?
Here are repro steps:
$ rails temp-app
$ cd temp-app
$ cat >.gems
rails -v 2.3.14
paperclip -v 2.5.0
<control-D>
$ git init
$ git add .
$ git commit -m "init"
$ heroku create --stack bamboo
$ git push heroku master
this is the output:
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Configure Rails to log to stdout
Installing rails_log_stdout... done
-----> Installing gem rails 2.3.14 from http://rubygems.org
Successfully installed activesupport-2.3.14
Successfully installed activerecord-2.3.14
Successfully installed actionpack-2.3.14
Successfully installed actionmailer-2.3.14
Successfully installed activeresource-2.3.14
Successfully installed rails-2.3.14
6 gems installed
-----> Installing gem paperclip 2.5.0 from http://rubygems.org
ERROR: While executing gem ... (NoMethodError)
undefined method `call' for nil:NilClass
! Heroku push rejected, failed to install gem
I did get an answer from Heroku support: Paperclip specifies a dependency on Active Record like this: 'activerecord', '>= 2.3.0' which causes the latest AR version to be installed. The latest version as of a few days ago is 3.2, which is broken on Rails 2.3, hence the failure.
I solved this by adding --ignore-dependencies to the paperclip gem in .gems and manually adding dependencies to .gems.

Cant seem to push to Heroku

I am working with a rails app and I can't seem to be able to push my app to Heroku. I have set up everything and use git but everytime I push it to heroku I get this:
Unresolved dependencies detected; Installing...
Using --without development:test
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control
You have added to the Gemfile:
* therubyracer (>= 0.8.2)
* libnotify
* rb-inotify
You have deleted from the Gemfile:
* growl
* rb-fsevent
FAILED: http://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler
I have noticed that my version of gem is 1.0.11 but the heroku push is using running Bundler version 1.0.7. I dont know if this makes a difference but I don't know how to go back to an older version.
Thanks for any help.
It looks like you failed to add your Gemfile.lock into the git repo for heroku.
Make sure it's not in your .gitignore, then:
git add Gemfile.lock
git commit -m "Adding Gemfile.lock"
If you have therubyracer in your Gemfile are you using Rails 3.1? You would be much better off running on the Cedar stack as opposed to the Bamboo stack. Cedar does not require the rubyracer gem to be in your gemfile. Bundler version doesn't matter in this case, 1.0.11 is used on Cedar whilst 1.0.7 is used on Bamboo but that's all managed by Heroku.

Resources