All I’m trying to do is deploy an app I made using Heroku, because it
seemed simple enough when I read the instructions on various sites
explaining how to do this.
1.)Make a heroku account and install it
2.)Make a config.ru file in the root directory of the project containing
require ‘movies’ #movies is the name of my app
run Sinatra::Application
3.)Create the app on Heroku ($ heroku create)
4.) Use git and push the app to Heroku ($ git push heroku master)
I do all of this, and my app is being pushed to Heroku, but all I get is
an application error when I load the URL in a browser. So I run $ heroku
logs, and just get something telling me that it crashed, not giving me a
clue as to why. I was starting to think maybe it had to do with the
database? So I decided to try deploying a simple “hello world” app using
these same steps and I get the exact same error. What am I missing here?
I even tried using Bundler to make sure it gets all the required gems.
Link to github repository is GitHub - bgerke/Ruby-Project for
anyone who is interested in helping me.
I attached the heroku logs, maybe someone here can make sense of them.
I’m already confused because they appear different from when I first
looked at them even though nothing has really changed.
On Mon, May 23, 2011 at 11:05 AM, Brandon G. [email protected]
wrote:
I attached the heroku logs, maybe someone here can make sense of them.
I’m already confused because they appear different from when I first
looked at them even though nothing has really changed.
Attachments:
http://www.ruby-forum.com/attachment/6219/herokuLogs.txt
You said “not giving me a clue as to why” but this is not true:
2011-05-23T07:36:38+00:00 heroku[web.1]: Starting process with
command: thin -p 37458 -e production -R /home/heroku_rack/heroku.ru start
2011-05-23T07:36:39+00:00 app[web.1]:
internal:lib/rubygems/custom_require:29:in require': no such file to load -- movies (LoadError) 2011-05-23T07:36:39+00:00 app[web.1]: from <internal:lib/rubygems/custom_require>:29:in
require’
This tells you that a file named “movies” is attempted to be required
but Ruby interpreter cannot find it. Either it is missing completely
or you do not have your load path configured properly.
Kind regards
robert
Thank you both very much, so far you both have been helpful.
Now I added DataMapper to the Gemfile, and it installed it. Added
require 'bundler/setup'
to movies.db, and changed require "movies"
to require File.dirname(__FILE__)+"/movies"
in the config file. Everything pushed
to Heroku just fine after these changes, but I still get errors that I’m
not sure how to solve.
/app/.bundle/gems/ruby/1.9.1/gems/dm-core-1.1.0/lib/dm-core/adapters.rb:163:in
`require’: no such file to load – dm-sqlite-adapter (LoadError)
I also attached a new heroku log in case there are other errors I am not
seeing.
Thanks in advance for your help, greatly appreciate it.
On Mon, May 23, 2011 at 3:41 AM, Brandon G. [email protected] wrote:
3.)Create the app on Heroku ($ heroku create)
Link to github repository is https://github.com/bgerke/Ruby-Project for
anyone who is interested in helping me.
Attachments:
http://www.ruby-forum.com/attachment/6218/Ruby-Project.zip
–
Posted via http://www.ruby-forum.com/.
Your logs say: “2011-05-23T08:31:50+00:00 app[web.1]:
internal:lib/rubygems/custom_require:29:in `require’: no such file
to load – movies (LoadError)”
On Ruby < 1.9.2, the current directory is part of the path, so if you
run the app from the app’s directory, it will happen to find the
movies file. But this behaviour is unreliable, so in 1.9.2, they
removed the current directory from the path. This means you need to
either be explicit about the location of the file, or alter the path
to include your app’s directory.
The easiest solution os to change require "movies"
to require File.dirname(__FILE__)+"/movies"
Additionally, looking at your source code, you have another issue that
will come up. You are not actually using Bundler. You need to put
require 'bundler/setup'
before you require any of your gems.
I also see that Datamapper is not in your Gemfile. You don’t notice
this problem, because your app isn’t loading bundler. As soon as you
fix that, it will become apparent.
I decided to add gem ‘dm-sqlite-adapter’ to the gemfile and for some
reason this fixed my last problem. It’s up and working now.
2011/5/23 Brandon G. [email protected]:
Okay it’s not really working I got excited and didn’t bother testing it
after I saw something appear on each page. I get an internal server
error when attempting to submit anything from the form.
DataObjects::ConnectionError - attempt to write a readonly database:
How would I change it to a read/write?
You can’t use SQLite on Heroku, you have to use their PostgreSQL
database. Instead of
Datamapper.setup(:default, “sqlite:some.db”)
use
Datamapper.setup(:default, ENV[“DATABASE_URL”] || “sqlite:some.db”)
This will work both locally and on Heroku. You will also need to add
dm-postgres-adapter to your Gemfile.
Okay it’s not really working I got excited and didn’t bother testing it
after I saw something appear on each page. I get an internal server
error when attempting to submit anything from the form.
DataObjects::ConnectionError - attempt to write a readonly database:
How would I change it to a read/write?
PS: Tried to add this to the last post, but took just a hair too long.
Didn’t realize you had to make edits within 15 minutes.