Heroku rake db:migrate error - ruby-on-rails

Im trying to rake my heroku app.
I ran the logs and this is what I get.
dhcp-v12-201774:staplesounds mattthomas$ heroku run rake db:migrate
Running rake db:migrate on musicfinal... up, run.2067
▸ ETIMEDOUT: connect ETIMEDOUT 50.19.103.36:5000
dhcp-v12-201774:staplesounds mattthomas$ heroku logs
2016-02-11T03:49:26.683947+00:00 heroku[api]: Enable Logplex by mattcthomas#me.com
2016-02-11T03:49:26.683947+00:00 heroku[api]: Release v2 created by mattcthomas#me.com
2016-02-11T03:50:20.892163+00:00 heroku[api]: Set LANG, RACK_ENV, RAILS_ENV, RAILS_SERVE_STATIC_FILES, SECRET_KEY_BASE config vars by mattcthomas#me.com
2016-02-11T03:50:20.892163+00:00 heroku[api]: Release v3 created by mattcthomas#me.com
2016-02-11T03:50:21.454068+00:00 heroku[api]: Attach DATABASE resource by mattcthomas#me.com
2016-02-11T03:50:21.454068+00:00 heroku[api]: Release v4 created by mattcthomas#me.com
2016-02-11T03:50:21.778790+00:00 heroku[api]: Scale to web=1 by mattcthomas#me.com
2016-02-11T03:50:21.861786+00:00 heroku[api]: Deploy fc99da3 by mattcthomas#me.com
2016-02-11T03:50:21.861786+00:00 heroku[api]: Release v5 created by mattcthomas#me.com
2016-02-11T03:50:22.235257+00:00 heroku[slug-compiler]: Slug compilation started
2016-02-11T03:50:22.235266+00:00 heroku[slug-compiler]: Slug compilation finished
2016-02-11T03:50:24.263214+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 52747 -e production`
2016-02-11T03:50:29.824709+00:00 app[web.1]: [2016-02-11 03:50:29] INFO WEBrick 1.3.1
2016-02-11T03:50:29.824725+00:00 app[web.1]: [2016-02-11 03:50:29] INFO ruby 2.2.4 (2015-12-16) [x86_64-linux]
2016-02-11T03:50:29.825057+00:00 app[web.1]: [2016-02-11 03:50:29] INFO WEBrick::HTTPServer#start: pid=3 port=52747
2016-02-11T03:50:30.076895+00:00 heroku[web.1]: State changed from starting to up
2016-02-11T03:50:31.502816+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by mattcthomas#me.com
2016-02-11T03:50:33.860069+00:00 heroku[run.5073]: Awaiting client
2016-02-11T03:50:34.290992+00:00 heroku[run.5073]: State changed from starting to up
2016-02-11T03:51:03.862924+00:00 heroku[run.5073]: Error R13 (Attach error) -> Failed to attach to process
2016-02-11T03:51:04.566425+00:00 heroku[run.5073]: State changed from up to complete
2016-02-11T03:51:04.556094+00:00 heroku[run.5073]: Process exited with status 128
2016-02-11T03:51:29.022012+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by mattcthomas#me.com
2016-02-11T03:51:34.869016+00:00 heroku[run.8794]: Starting process with command `bundle exec rake db:migrate`
2016-02-11T03:51:35.464019+00:00 heroku[run.8794]: State changed from starting to up
2016-02-11T03:51:39.975105+00:00 app[run.8794]: == 20160204020529 CreateSongs: migrating ======================================
2016-02-11T03:51:39.975125+00:00 app[run.8794]: -- create_table(:songs)
2016-02-11T03:51:39.975127+00:00 app[run.8794]: -> 0.0086s
2016-02-11T03:51:39.975127+00:00 app[run.8794]: == 20160204020529 CreateSongs: migrated (0.0087s) =============================
2016-02-11T03:51:39.975128+00:00 app[run.8794]:
2016-02-11T03:51:39.975129+00:00 app[run.8794]: == 20160205022634 ActsAsTaggableOnMigration: migrating ========================
2016-02-11T03:51:39.975130+00:00 app[run.8794]: -- create_table(:tags)
2016-02-11T03:51:39.975130+00:00 app[run.8794]: -> 0.0066s
2016-02-11T03:51:39.975131+00:00 app[run.8794]: -- create_table(:taggings)
2016-02-11T03:51:39.975131+00:00 app[run.8794]: -> 0.0099s
2016-02-11T03:51:39.975133+00:00 app[run.8794]: -- add_index(:taggings, :tag_id)
2016-02-11T03:51:39.975133+00:00 app[run.8794]: -> 0.0094s
2016-02-11T03:51:39.975134+00:00 app[run.8794]: -- add_index(:taggings, [:taggable_id, :taggable_type, :context])
2016-02-11T03:51:39.975134+00:00 app[run.8794]: -> 0.0070s
2016-02-11T03:51:39.975135+00:00 app[run.8794]: == 20160205022634 ActsAsTaggableOnMigration: migrated (0.0332s) ===============
2016-02-11T03:51:39.975135+00:00 app[run.8794]:
2016-02-11T03:51:39.975136+00:00 app[run.8794]: == 20160205022635 AddMissingUniqueIndices: migrating ==========================
2016-02-11T03:51:39.975137+00:00 app[run.8794]: -- add_index(:tags, :name, {:unique=>true})
2016-02-11T03:51:39.975138+00:00 app[run.8794]: -- remove_index(:taggings, :tag_id)
2016-02-11T03:51:39.975137+00:00 app[run.8794]: -> 0.0083s
2016-02-11T03:51:39.975138+00:00 app[run.8794]: -> 0.0030s
2016-02-11T03:51:39.975139+00:00 app[run.8794]: -- remove_index(:taggings, [:taggable_id, :taggable_type, :context])
2016-02-11T03:51:39.975140+00:00 app[run.8794]: -> 0.0053s
2016-02-11T03:51:39.975142+00:00 app[run.8794]: -> 0.0071s
2016-02-11T03:51:39.975143+00:00 app[run.8794]:
2016-02-11T03:51:39.975144+00:00 app[run.8794]: -> 0.0128s
2016-02-11T03:51:39.975142+00:00 app[run.8794]: == 20160205022635 AddMissingUniqueIndices: migrated (0.0240s) =================
2016-02-11T03:51:39.975141+00:00 app[run.8794]: -- add_index(:taggings, [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type], {:unique=>true, :name=>"taggings_idx"})
2016-02-11T03:51:39.975143+00:00 app[run.8794]: == 20160205022636 AddTaggingsCounterCacheToTags: migrating ====================
2016-02-11T03:51:39.975146+00:00 app[run.8794]: == 20160205022637 AddMissingTaggableIndex: migrating ==========================
2016-02-11T03:51:39.975144+00:00 app[run.8794]: -- add_column(:tags, :taggings_count, :integer, {:default=>0})
2016-02-11T03:51:39.975145+00:00 app[run.8794]: == 20160205022636 AddTaggingsCounterCacheToTags: migrated (0.0351s) ===========
2016-02-11T03:51:39.975148+00:00 app[run.8794]: -> 0.0101s
2016-02-11T03:51:39.975146+00:00 app[run.8794]:
2016-02-11T03:51:39.975147+00:00 app[run.8794]: -- add_index(:taggings, [:taggable_id, :taggable_type, :context])
2016-02-11T03:51:39.975148+00:00 app[run.8794]: == 20160205022637 AddMissingTaggableIndex: migrated (0.0102s) =================
2016-02-11T03:51:39.975149+00:00 app[run.8794]: == 20160205022638 ChangeCollationForTagNames: migrating =======================
2016-02-11T03:51:39.975150+00:00 app[run.8794]:
2016-02-11T03:51:39.975150+00:00 app[run.8794]: == 20160205022638 ChangeCollationForTagNames: migrated (0.0022s) ==============
2016-02-11T03:51:39.975149+00:00 app[run.8794]:
2016-02-11T03:51:39.975151+00:00 app[run.8794]: == 20160205024602 DeviseCreateUsers: migrating ================================
2016-02-11T03:51:39.975151+00:00 app[run.8794]: -- create_table(:users)
2016-02-11T03:51:39.975152+00:00 app[run.8794]: -> 0.0269s
2016-02-11T03:51:39.975153+00:00 app[run.8794]: -- add_index(:users, :email, {:unique=>true})
2016-02-11T03:51:39.975153+00:00 app[run.8794]: -> 0.0114s
2016-02-11T03:51:39.975154+00:00 app[run.8794]: -- add_index(:users, :reset_password_token, {:unique=>true})
2016-02-11T03:51:39.975154+00:00 app[run.8794]: -> 0.0119s
2016-02-11T03:51:39.975155+00:00 app[run.8794]: == 20160205024602 DeviseCreateUsers: migrated (0.0505s) =======================
2016-02-11T03:51:39.975155+00:00 app[run.8794]:
2016-02-11T03:51:39.975156+00:00 app[run.8794]: == 20160208210640 ActsAsVotableMigration: migrating ===========================
2016-02-11T03:51:39.975156+00:00 app[run.8794]: -- create_table(:votes)
2016-02-11T03:51:39.975157+00:00 app[run.8794]: -- add_index(:votes, [:voter_id, :voter_type, :vote_scope])
2016-02-11T03:51:39.975157+00:00 app[run.8794]: -> 0.0078s
2016-02-11T03:51:39.975158+00:00 app[run.8794]: -> 0.0108s
2016-02-11T03:51:39.975158+00:00 app[run.8794]: -- add_index(:votes, [:votable_id, :votable_type, :vote_scope])
2016-02-11T03:51:39.975159+00:00 app[run.8794]: -> 0.0060s
2016-02-11T03:51:39.975159+00:00 app[run.8794]: == 20160208210640 ActsAsVotableMigration: migrated (0.0250s) ==================
2016-02-11T03:51:39.975160+00:00 app[run.8794]:
2016-02-11T03:51:40.965744+00:00 heroku[run.8794]: State changed from up to complete
2016-02-11T03:51:40.921160+00:00 heroku[run.8794]: Process exited with status 0
2016-02-11T03:54:23.806665+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by mattcthomas#me.com
2016-02-11T03:54:26.593029+00:00 heroku[run.2067]: Awaiting client
2016-02-11T03:54:27.023636+00:00 heroku[run.2067]: State changed from starting to up
2016-02-11T03:54:56.595702+00:00 heroku[run.2067]: Error R13 (Attach error) -> Failed to attach to process
2016-02-11T03:54:57.366547+00:00 heroku[run.2067]: State changed from up to complete
2016-02-11T03:54:57.351789+00:00 heroku[run.2067]: Process exited with status 128
dhcp-v12-201774:staplesounds mattthomas$
I've looked at people with the same errors and I cant seem to get it to work I've tried
dhcp-v12-201774:staplesounds mattthomas$ heroku run:detached rake db:migrate
Running `rake db:migrate` detached... up, run.8794
Use `heroku logs -p run.8794 -a musicfinal` to view the output.
dhcp-v12-201774:staplesounds mattthomas$ heroku logs
2016-02-11T03:49:26.683947+00:00 heroku[api]: Enable Logplex by mattcthomas#me.com
2016-02-11T03:49:26.683947+00:00 heroku[api]: Release v2 created by mattcthomas#me.com
2016-02-11T03:50:20.892163+00:00 heroku[api]: Set LANG, RACK_ENV, RAILS_ENV, RAILS_SERVE_STATIC_FILES, SECRET_KEY_BASE config vars by mattcthomas#me.com
2016-02-11T03:50:20.892163+00:00 heroku[api]: Release v3 created by mattcthomas#me.com
2016-02-11T03:50:21.454068+00:00 heroku[api]: Attach DATABASE resource by mattcthomas#me.com
2016-02-11T03:50:21.454068+00:00 heroku[api]: Release v4 created by mattcthomas#me.com
2016-02-11T03:50:21.778790+00:00 heroku[api]: Scale to web=1 by mattcthomas#me.com
2016-02-11T03:50:21.861786+00:00 heroku[api]: Deploy fc99da3 by mattcthomas#me.com
2016-02-11T03:50:21.861786+00:00 heroku[api]: Release v5 created by mattcthomas#me.com
2016-02-11T03:50:22.235257+00:00 heroku[slug-compiler]: Slug compilation started
2016-02-11T03:50:22.235266+00:00 heroku[slug-compiler]: Slug compilation finished
2016-02-11T03:50:24.263214+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 52747 -e production`
2016-02-11T03:50:29.824709+00:00 app[web.1]: [2016-02-11 03:50:29] INFO WEBrick 1.3.1
2016-02-11T03:50:29.824725+00:00 app[web.1]: [2016-02-11 03:50:29] INFO ruby 2.2.4 (2015-12-16) [x86_64-linux]
2016-02-11T03:50:29.825057+00:00 app[web.1]: [2016-02-11 03:50:29] INFO WEBrick::HTTPServer#start: pid=3 port=52747
2016-02-11T03:50:30.076895+00:00 heroku[web.1]: State changed from starting to up
2016-02-11T03:50:31.502816+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by mattcthomas#me.com
2016-02-11T03:50:33.860069+00:00 heroku[run.5073]: Awaiting client
2016-02-11T03:50:34.290992+00:00 heroku[run.5073]: State changed from starting to up
2016-02-11T03:51:03.862924+00:00 heroku[run.5073]: Error R13 (Attach error) -> Failed to attach to process
2016-02-11T03:51:04.566425+00:00 heroku[run.5073]: State changed from up to complete
2016-02-11T03:51:04.556094+00:00 heroku[run.5073]: Process exited with status 128
2016-02-11T03:51:29.022012+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by mattcthomas#me.com
2016-02-11T03:51:34.869016+00:00 heroku[run.8794]: Starting process with command `bundle exec rake db:migrate`
2016-02-11T03:51:35.464019+00:00 heroku[run.8794]: State changed from starting to up
Thank you so much!
Here's the github link, I'm not sure how much that helps but...
Thanks again. Sorry, I'm pretty new to rails!

It could be about your firewall issues.
Heroku docs states that: -
Timeout awaiting process The heroku run command opens a connection to
Heroku on port 5000. If your local network or ISP is blocking port
5000, or you are experiencing a connectivity issue, you will see an
error similar to: $ heroku run rails console Running rails console
attached to terminal... Timeout awaiting process You can test your
connection to Heroku by trying to connect directly to
rendezvous.runtime.heroku.com on port 5000 using telnet. A successful
session will look like this: $ telnet rendezvous.runtime.heroku.com
5000 Trying 50.19.103.36... Connected to
ec2-50-19-103-36.compute-1.amazonaws.com. Escape character is '^]'. If
you do not get this output, your computer is being blocked from
accessing our services. We recommend contacting your IT department,
ISP, or firewall manufacturer to move forward with this issue.
You can do a heroku run and then do a telnet rendezvous.runtime.heroku.com 5000 to see if your computer is blocking the connection.

Related

Heroku app crashes, but logs don't display error?

I looked at the other similar questions, and none of the solutions worked for me.
I'm using rails, ruby > 2.2. I precompiled my assests beforehand, and followed the steps on the heroku website for deployment.
Heroku restart or Heroku open yields the following logs
T13:23:51.140722+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=tranquil-reef-67177.herokuapp.com request_id=ddb61e34-f755-4c7b-b6e7-fbb7d2d2c545 fwd="99.99.45.37" dyno= connect= service= status=503 bytes= protocol=https
2017-08-16T13:26:09.989021+00:00 heroku[web.1]: State changed from crashed to starting 2017-08-16T13:26:12.914632+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 16431 -e production` 2017-08-16T13:26:18.084985+00:00 heroku[web.1]: Process exited with status 1
2017-08-16T13:26:17.981060+00:00 app[web.1]: 2017-08-16T13:26:17.981072+00:00 app[web.1]:
2017-08-16T13:26:17.981118+00:00 app[web.1]: >>>> A cacert.pem bundle could not be downloaded. 2017-08-16T13:26:17.981452+00:00 app[web.1]: => Booting Puma
2017-08-16T13:26:17.981454+00:00 app[web.1]: => Run `rails server -h` for more startup options 2017-08-16T13:26:17.981454+00:00 app[web.1]: => Rails 5.1.3 application starting in production on http://0.0.0.0:16431 2017-08-16T13:26:17.981457+00:00 app[web.1]: Exiting
2017-08-16T13:26:18.097040+00:00 heroku[web.1]: State changed from starting to crashed 2017-08-16T13:28:52.442323+00:00 app[api]: Starting process with command `bundle exec rake db:setup` by user smantri7#gatech.edu 2017-08-16T13:28:58.768622+00:00 heroku[run.9307]: Awaiting client
2017-08-16T13:28:58.793376+00:00 heroku[run.9307]: Starting process with command `bundle exec rake db:setup`
2017-08-16T13:28:58.977883+00:00 heroku[run.9307]: State changed from starting to up 2017-08-16T13:29:06.107123+00:00 heroku[run.9307]: State changed from up to complete
2017-08-16T13:29:06.088150+00:00 heroku[run.9307]: Process exited with status 1 2017-08-16T13:29:25.187872+00:00 heroku[run.6090]: Awaiting client
2017-08-16T13:29:25.261306+00:00 heroku[run.6090]: Starting process with command `bundle exec rake db:create`
2017-08-16T13:29:25.463655+00:00 heroku[run.6090]: State changed from starting to up 2017-08-16T13:29:21.565730+00:00 app[api]: Starting process with command `bundle exec rake db:create` by user smantri7#gatech.edu
2017-08-16T13:29:33.024076+00:00 heroku[run.6090]: State changed from up to complete
2017-08-16T13:29:33.008825+00:00 heroku[run.6090]: Process exited with status 1
2017-08-16T13:31:57.967030+00:00 app[api]: Starting process with command `bundle exec rake db:push` by user smantri7#gatech.edu
2017-08-16T13:32:01.731122+00:00 heroku[run.8862]: Awaiting client
2017-08-16T13:32:01.787259+00:00 heroku[run.8862]: Starting process with command `bundle exec rake db:push`
2017-08-16T13:32:01.976994+00:00 heroku[run.8862]: State changed from starting to up
2017-08-16T13:32:09.014212+00:00 heroku[run.8862]: State changed from up to complete
2017-08-16T13:32:08.996819+00:00 heroku[run.8862]: Process exited with status 1 2017-08-16T13:33:08.827762+00:00 heroku[web.1]: State changed from crashed to starting
2017-08-16T13:33:12.246286+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 40298 -e production`
The problem is here: >>>> A cacert.pem bundle could not be downloaded. You need to check an issue with cacert.pem

Can't figure out why worker doesn't function Heroku

I have been looking at my Heroku logs and I just can't figure out why my woker is not functioning. It works locally and when I do heroku run rake perform_later I get a response that my job is enqueued
Heroku logs
2016-02-09T20:02:04.364227+00:00 heroku[scheduler.2066]: State changed from up to complete
2016-02-09T20:02:04.350705+00:00 heroku[scheduler.2066]: Process exited with status 0
2016-02-09T21:00:57.182878+00:00 heroku[api]: Starting process with command `bundle exec rake perform_later` by scheduler#addons.heroku.com
2016-02-09T21:01:04.063903+00:00 heroku[scheduler.9121]: Starting process with command `bundle exec rake perform_later`
2016-02-09T21:01:04.681867+00:00 heroku[scheduler.9121]: State changed from starting to up
2016-02-09T21:01:07.923640+00:00 app[scheduler.9121]: [Simple Form] Simple Form is not configured in the application and will use the default values. Use `rails generate simple_form:install` to generate the Simple Form configuration.
2016-02-09T21:01:07.965160+00:00 app[scheduler.9121]: [ActiveJob] Enqueued GettweetsJob (Job ID: d3363b17-a2f9-4ffd-85b7-a5188b89605d) to Sidekiq(default)
2016-02-09T21:01:08.614883+00:00 heroku[scheduler.9121]: Process exited with status 0
2016-02-09T21:01:08.611923+00:00 heroku[scheduler.9121]: State changed from up to complete
2016-02-09T21:24:48.087768+00:00 heroku[web.1]: State changed from down to starting
2016-02-09T21:24:48.087325+00:00 heroku[web.1]: Unidling
2016-02-09T21:24:51.847314+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
2016-02-09T21:24:53.513605+00:00 app[web.1]: [3] Puma starting in cluster mode...
2016-02-09T21:24:53.513625+00:00 app[web.1]: [3] * Version 2.15.3 (ruby 2.2.3-p173), codename: Autumn Arbor Airbrush
2016-02-09T21:24:53.513627+00:00 app[web.1]: [3] * Environment: production
2016-02-09T21:24:53.513663+00:00 app[web.1]: [3] * Preloading application
2016-02-09T21:24:53.513626+00:00 app[web.1]: [3] * Min threads: 3, max threads: 3
2016-02-09T21:24:53.513628+00:00 app[web.1]: [3] * Process workers: 2
2016-02-09T21:24:55.539022+00:00 app[web.1]: [3] * Listening on tcp://0.0.0.0:23385
2016-02-09T21:24:55.539160+00:00 app[web.1]: [3] Use Ctrl-C to stop
2016-02-09T21:24:55.544071+00:00 app[web.1]: [3] - Worker 0 (pid: 6) booted, phase: 0
2016-02-09T21:24:55.520328+00:00 app[web.1]: [Simple Form] Simple Form is not configured in the application and will use the default values. Use `rails generate simple_form:install` to generate the Simple Form configuration.
2016-02-09T21:24:55.545450+00:00 app[web.1]: [3] - Worker 1 (pid: 10) booted, phase: 0
2016-02-09T21:24:56.075839+00:00 heroku[web.1]: State changed from starting to up
Job
class GettweetsJob < ActiveJob::Base
queue_as :default
def perform(*args)
client = Twitter::REST::Client.new do |config|
config.consumer_key = "aaaa"
config.consumer_secret = "bbbb"
config.access_token = "cccc"
config.access_token_secret = "dddd"
end
client.mentions_timeline.each do |tweet|
Tweet.create({text: tweet.text, username: tweet.user.screen_name})
end
end
end
rake task
desc "This task is called by the Heroku scheduler add-on"
task :perform_later => :environment do
GettweetsJob.perform_later
end
response heroku run rake perform_later
[Simple Form] Simple Form is not configured in the application and will use the default values. Use `rails generate simple_form:install` to generate the Simple Form configuration.
[ActiveJob] Enqueued GettweetsJob (Job ID: 5f71c5e3-f2f3-4c5d-8396-1eb5cb25068b) to Sidekiq(default)
procfile
web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -C config/sidekiq.yml
sidekiq.yml
:concurrency: 3
:timeout: 60
:verbose: true
:queues:
- default
- mailers

Heroku: Error R99 (Platform error) when running `heroku run rake db:migrate`

I am running a Heroku app under multiple environments as described here. I am able to run under my original single environment fine, but when I push to one of the others and run heroku run rake db:migrate --remote REMOTE_NAME I get an error of the form Error: Operation timed out - connect(2) (Errno::ETIMEDOUT).
The heroku logs output for this instance is as follows:
heroku[api]: Starting process with command `rake db:migrate`
heroku[run.9488]: Awaiting client
heroku[run.9488]: Starting process with command `rake db:migrate`
heroku[run.9488]: Error R99 (Platform error) -> Failed to launch the dyno within 10 seconds
heroku[run.9488]: Stopping process with SIGKILL
heroku[run.9488]: Error R13 (Attach error) -> Failed to attach to process
heroku[run.9488]: Process exited with status 128
heroku[run.9488]: State changed from starting to complete
What is the correct process for migrating a database when working with multiple deployment environments?

Can't create admin user on Heroku

I am new to rails and I have gone through Kevin Skoglund's Ruby on Rails 3 Essential Training course on Lynda.com. Through the course you set up a simple cms, which I did. It doesn't cover Git or deployment but I've pushed my simple cms to github (https://github.com/nick5a1/Simple_CMS) and deployed to Heroku (http://nkarrasch.herokuapp.com/).
In order to deploy to Heroku I followed the Heroku setup guide (https://devcenter.heroku.com/articles/rails3) and switched my database from MySQL to PostgreSQL. As instructed I changed gen'mysql2' to gen 'sqlite3' in my Gemfile and ran bundle install before pushing. I then ran heroku run rake db:migrate.
I'm running into 2 problems. When I try to log in (http://nkarrasch.herokuapp.com/access) I get an error "We're sorry, but something went wrong". I should instead be getting a flash message with invalid username/password combination. This is what I'm getting on my test environment on my local machine.
Secondly, when I log into the Heroku console to create and create an admin user, when I try to save that user I get the following error:
irb(main):004:0> user.save
(1.2ms) BEGIN
AdminUser Exists (1.9ms) SELECT 1 AS one FROM "admin_users" WHERE "admin_users"."username" = 'Nick5a1' LIMIT 1
(1.7ms) ROLLBACK
=> false
Any advice on how to troubleshoot would be greatly appreciated :).
Thanks very much,
Nick
EDIT: Here are my Heroku logs:
2012-06-27T20:36:44+00:00 heroku[slugc]: Slug compilation started
2012-06-27T20:37:34+00:00 heroku[api]: Add shared-database:5mb add-on by *
2012-06-27T20:37:34+00:00 heroku[api]: Release v2 created by *
2012-06-27T20:37:34+00:00 heroku[api]: Add RAILS_ENV, LANG, PATH, RACK_ENV, GEM_PATH config by *
2012-06-27T20:37:34+00:00 heroku[api]: Release v3 created by *
2012-06-27T20:37:34+00:00 heroku[api]: Release v4 created by *
2012-06-27T20:37:34+00:00 heroku[api]: Deploy 1d82839 by *
2012-06-27T20:37:35+00:00 heroku[slugc]: Slug compilation finished
2012-06-27T20:37:36+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 45450`
2012-06-27T20:37:40+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2012-06-27T20:37:40+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2012-06-27T20:37:40+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2012-06-27T20:37:44+00:00 app[web.1]: => Rails 3.2.6 application starting in production on http://0.0.0.0:45450
2012-06-27T20:37:44+00:00 app[web.1]: => Call with -d to detach
2012-06-27T20:37:44+00:00 app[web.1]: => Booting WEBrick
2012-06-27T20:37:44+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2012-06-27T20:37:44+00:00 app[web.1]: => Ctrl-C to shutdown server
2012-06-27T20:37:44+00:00 app[web.1]: [2012-06-27 20:37:44] INFO WEBrick 1.3.1
2012-06-27T20:37:44+00:00 app[web.1]: [2012-06-27 20:37:44] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux]
2012-06-27T20:37:44+00:00 app[web.1]: [2012-06-27 20:37:44] INFO WEBrick::HTTPServer#start: pid=2 port=45450
2012-06-27T20:37:45+00:00 heroku[web.1]: State changed from starting to up
2012-06-27T20:39:44+00:00 heroku[run.1]: Awaiting client
2012-06-27T20:39:44+00:00 heroku[run.1]: Starting process with command `bundle exec rake db:migrate`
2012-06-27T20:39:44+00:00 heroku[run.1]: State changed from starting to up
2012-06-27T20:39:51+00:00 heroku[run.1]: Process exited with status 0
2012-06-27T20:39:51+00:00 heroku[run.1]: State changed from up to complete
2012-06-27T20:41:05+00:00 heroku[run.1]: Awaiting client
2012-06-27T20:41:05+00:00 heroku[run.1]: Starting process with command `bundle exec rails console`
2012-06-27T20:41:05+00:00 heroku[run.1]: State changed from starting to up
2012-06-27T20:46:09+00:00 heroku[run.1]: Process exited with status 0
2012-06-27T20:46:09+00:00 heroku[run.1]: State changed from up to complete
You are declaring two different databases... Try removing these two lines from your Gemfile:
gem 'pg'
gem 'mysql2'
And adding the below:
group :production do
gem 'pg'
gem 'thin'
end
group :development, :test do
gem 'mysql2'
end
In this way you are defining one database to be used for development (mysql) and another one (pg) for production.
After changing the gemfile:
git add .
git commit -m "gemfile updated"
git push
git push heroku master
heroku run rake db:migrate
EDIT - looking at your routes.rb I realised that you are using the match ':controller(/:action(/:id))(.:format)', which will make all your actions available through get request. However, I have never used it and I think you might have a problem with your routes.
Jast to make sure that it is pointing to access/attempt_login, can you please include the the routes generated by:
rake routes

Deploying Rails 3.1 app to heroku error (sqlite3->Postgresql)?

I am having trouble with deploying rails 3.1. app to heroku.
After some research, I found out that the main reason behind the issue is this - http://devcenter.heroku.com/articles/how-do-i-use-sqlite3-for-development
After changing my gem file:
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
Still the "We're sorry, but something went wrong." page error.
Here is the log file:
←[36m2011-11-26T16:34:31+00:00 heroku[api]:←[0m Add-on add logging:basic by emil
s.veveris#thrillengine.com
←[36m2011-11-26T16:34:31+00:00 heroku[api]:←[0m Release v2 created by emils.veve
ris#thrillengine.com
←[36m2011-11-26T16:34:31+00:00 heroku[api]:←[0m Add-on update shared-database
←[36m2011-11-26T16:34:31+00:00 heroku[api]:←[0m Release v3 created by emils.veve
ris#thrillengine.com
←[33m2011-11-26T16:43:15+00:00 heroku[slugc]:←[0m Slug compilation started
←[36m2011-11-26T16:44:17+00:00 heroku[api]:←[0m Deploy 277a3f4 by emils.veveris#
thrillengine.com
←[36m2011-11-26T16:44:17+00:00 heroku[api]:←[0m Release v4 created by emils.veve
ris#thrillengine.com
←[32m2011-11-26T16:44:18+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[33m2011-11-26T16:44:18+00:00 heroku[slugc]:←[0m Slug compilation finished
←[32m2011-11-26T16:44:28+00:00 heroku[web.1]:←[0m State changed from starting to
up
←[35m2011-11-26T17:09:51+00:00 heroku[nginx]:←[0m 81.198.241.178 - - [26/Nov/201
1:09:09:51 -0800] "GET / HTTP/1.1" 500 728 "-" "Mozilla/5.0 (Windows NT 5.1; rv:
8.0) Gecko/20100101 Firefox/8.0" stormy-night-6239.heroku.com
←[32m2011-11-26T18:12:59+00:00 heroku[web.1]:←[0m Idling
←[32m2011-11-26T18:13:00+00:00 heroku[web.1]:←[0m State changed from up to down
←[32m2011-11-26T18:13:00+00:00 heroku[web.1]:←[0m State changed from down to cre
ated
←[32m2011-11-26T18:13:01+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[32m2011-11-26T18:13:02+00:00 heroku[web.1]:←[0m Stopping process with SIGTERM
←[32m2011-11-26T18:13:02+00:00 app[web.1]:←[0m >> Stopping ...
←[32m2011-11-26T18:13:02+00:00 heroku[web.1]:←[0m Process exited
←[32m2011-11-26T18:13:11+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
me Crazy Delicious)
←[32m2011-11-26T18:13:11+00:00 app[web.1]:←[0m >> Maximum connections set to 102
4
←[32m2011-11-26T18:13:11+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:29604, CT
RL+C to stop
←[32m2011-11-26T18:13:12+00:00 heroku[web.1]:←[0m State changed from starting to
up
←[32m2011-11-26T19:16:24+00:00 heroku[web.1]:←[0m Idling
←[32m2011-11-26T19:16:25+00:00 heroku[web.1]:←[0m State changed from up to down
←[32m2011-11-27T11:29:48+00:00 heroku[web.1]:←[0m Unidling
←[32m2011-11-27T11:29:48+00:00 heroku[web.1]:←[0m State changed from down to cre
ated
←[32m2011-11-27T11:29:50+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[32m2011-11-27T11:29:53+00:00 heroku[web.1]:←[0m Starting process with command
`thin -p 16668 -e production -R /home/heroku_rack/heroku.ru start`
←[32m2011-11-27T11:29:59+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
me Crazy Delicious)
←[32m2011-11-27T11:29:59+00:00 app[web.1]:←[0m >> Maximum connections set to 102
4
←[32m2011-11-27T11:29:59+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:16668, CT
RL+C to stop
←[32m2011-11-27T11:30:00+00:00 heroku[web.1]:←[0m State changed from starting to
up
←[31m2011-11-27T11:30:01+00:00 heroku[router]:←[0m GET stormy-night-6239.heroku.
com/ dyno=web.1 queue=0 wait=0ms service=230ms status=500 bytes=728
I don't see any errors there.
I also tried running heroku rake db:migrate
And gotthis error :
rake aborted!
An error has occurred, this and all later migrations canceled:
PGError: ERROR: column "location_id" of relation "trips" already exists
: ALTER TABLE "trips" ADD COLUMN "location_id" integer
Currently I really don't understand what do, where to look and what to change.
Everything works fine on my local machine, tough!
Thanks for any help/ROR Newbie!
UPDATE:
after heroku rake db:reset
Couldn't drop dahrzbhlza : #<ActiveRecord::StatementInvalid: PGError: ERROR: mu
st be owner of database dahrzbhlza
: DROP DATABASE IF EXISTS "dahrzbhlza">
dahrzbhlza already exists
-- create_table("categories", {:force=>true})
-> 0.0595s
-- create_table("categories_trips", {:id=>false, :force=>true})
-> 0.0031s
-- create_table("details", {:force=>true})
-> 0.0129s
-- create_table("details_trips", {:id=>false, :force=>true})
-> 0.0042s
-- create_table("images", {:force=>true})
-> 0.1982s
-- create_table("locations", {:force=>true})
-> 0.1065s
-- create_table("trips", {:force=>true})
-> 0.0422s
-- create_table("users", {:force=>true})
-> 0.1486s
-- add_index("users", ["email"], {:name=>"index_users_on_email", :unique=>true})
-> 0.0102s
-- initialize_schema_migrations_table()
-> 0.0017s
-- assume_migrated_upto_version(20111116120713, ["/app/db/migrate"])
-> 0.0091s
After heroku rake db:migrate:redo
== AddTitleToImages: reverting ===============================================
-- remove_column("images", :title)
-> 0.0058s
== AddTitleToImages: reverted (0.0059s) ======================================
== AddTitleToImages: migrating ===============================================
-- add_column(:images, :title, :string)
-> 0.0032s
== AddTitleToImages: migrated (0.0033s) ======================================
Another Question - why it is migrating only those two columns above - not all ?
another thing you'll want to do is move to the Cedar stack for Rails 3.1 sites - you're running on Bamboo from that stack trace - heroku create --stack cedar and then repush. You also won't need the rubyracer gem listed in your gemfile, it's very memory hungry and not required anymore on Cedar.
Try rebuilding the database by pushing a working copy from your local machine. You can use taps for that, like so
#On your local machine, that has a working database
$heroku db:push
Once they're the same, your migrations should start making more sense.
try this
group :production do
# gems specifically for Heroku go here
gem 'therubyracer-heroku', '0.8.1.pre3'
gem "pg"
end

Resources