Monday, 15 July 2013

ruby - https://github.com/twilio/hurl and Heroku -



ruby - https://github.com/twilio/hurl and Heroku -

https://github.com/twilio/hurl

i can't accomplish running server on heroku steps readme file.

steps did:

git clone git://github.com/twilio/hurl cd hurl gem install bundler bundle install heroku create git force heroku master heroku open

using heroku logs see error of getting connection pg

"/app/app/models/db.rb:16:in `initialize': not connect server: connection refused (pg::error)"

please help i'm doing wrong..

update:

file:`db.rb` 15 class postgresdb < abstractdb 16 conn = pg::connection::new( 17 env.fetch("postgres_host", "localhost"), 18 env.fetch("postgres_port", 5432), 19 :dbname => env.fetch("postgres_database", "hurls"), 20 :user => env.fetch("postgres_user", "postgres"), 21 :password => env.fetch("postgres_password", "postgres") 22 )

changed details config heroku addon server of postgresql , got error:

starting process command `bundle exec rackup config.ru -p 16112` 2013-02-14t07:55:41+00:00 app[web.1]: line 1: insert hurls values ($1::varchar, $2::bytea) 2013-02-14t07:55:41+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1137:in `new' 2013-02-14t07:55:41+00:00 app[web.1]: /app/app/models/db.rb:39:in `exec': error: relation "hurls" not exist (pg::error) 2013-02-14t07:55:41+00:00 app[web.1]: /app/app/app.rb:35:in `initialize' 2013-02-14t07:55:41+00:00 app[web.1]: config.ru:1:in `new' 2013-02-14t07:55:41+00:00 app[web.1]: ^ 2013-02-14t07:55:41+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1137:in `new' 2013-02-14t07:55:41+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/bin/rackup:4:in `<top (required)>' 2013-02-14t07:55:41+00:00 app[web.1]: /app/app/helpers.rb:69:in `each' 2013-02-14t07:55:41+00:00 app[web.1]: config.ru:13:in `block in <main>' 2013-02-14t07:55:41+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:162:in `app' 2013-02-14t07:55:41+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in `load' 2013-02-14t07:55:41+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:248:in `wrapped_app' 2013-02-14t07:55:41+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in `<main>' 2013-02-14t07:55:41+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval' 2013-02-14t07:55:41+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:100:in `start' 2013-02-14t07:55:41+00:00 app[web.1]: /app/app/helpers.rb:70:in `block in setup_default_hurls' 2013-02-14t07:55:41+00:00 app[web.1]: /app/app/helpers.rb:69:in `setup_default_hurls' 2013-02-14t07:55:41+00:00 app[web.1]: config.ru:1:in `<main>' 2013-02-14t07:55:41+00:00 app[web.1]: /app/app/app.rb:245:in `save_hurl' 2013-02-14t07:55:41+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize' 2013-02-14t07:55:41+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:35:in `eval' 2013-02-14t07:55:41+00:00 app[web.1]: /app/app/models/db.rb:39:in `save' 2013-02-14t07:55:41+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:35:in `parse_file' 2013-02-14t07:55:41+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:213:in `start' 2013-02-14t07:55:42+00:00 heroku[web.1]: process exited status 1 2013-02-14t07:55:42+00:00 heroku[web.1]: state changed starting crashed 2013-02-14t07:55:43+00:00 heroku[router]: at=error code=h10 desc="app crashed" method=get path=/ host=my-hurl-*****.herokuapp.com fwd=95.65.21.178 dyno= queue= wait= connect= service= status=503 bytes=

anyone achieved working heroku server?

solved

added configuration variables using:

$ heroku config:add postgres_database=your_database $ heroku config:add postgres_host=your_host $ heroku config:add postgres_user=your_user $ heroku config:add postgres_password=your_password $ heroku config:add postgres_port=5432

or in 1 line: $ heroku config:add postgres_database=your_database postgres_host=your_host postgres_user=your_user postgres_password=your_password postgres_port=5432

else create tables manually:

$ heroku pg:psql create table users (id character(40), content bytea); create table hurls (id character(40), content bytea);

ruby postgresql heroku github rack

No comments:

Post a Comment