Issue with heroku - ruby-on-rails

I have gone through the proper protocol with Heroku, installed the gem puma, created a Procfile, and have successfully implemented the git push heroku master command. But when I opt to initiate Heroku open, the website will not display my app. I ran Heroku logs --tail, and the error comes up that the app crashed. When I ran Heroku run rake db:migrate, this message came up:
heroku run rake db:migrate
Running rake db:migrate on stormy-tor-8615... up, run.9976
ActiveRecord::SchemaMigration Load (1.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
Is this indicative that my app's models were successfully migrated? If not, how can I properly troubleshoot this issue?

Firstly I will suggest you check if you are still on a feature branch locally. if you are, you may want to push that branch instead. you can do that by typing git push heroku master:(your branch name)

I just resolved the problems with my app, it turned out that the spec file was duplicated in the app directory, and once I removed it, I then directed my attention to the config/secrets.yml, where the residing issue was how I initially setup the secret_key_base ENV hash. There was a slight error in the original entry, which in retrospect, broke the app when I attempted to push it to Heroku. After I correctly reconfigured the ENV hash, the app was able to be accessed via Heroku. And, then I was able to manually input the Facebook App id and APP secret key via the terminal.

Related

Rails Heroku app push and see changes

I would like to ask a question about heroku and rails. As I am kind of new to rails I want to know how it works with Heroku. I have an app and would like to push it to heroku.
I know that, rails takes all js/css files and compress when you are in production mode. My problem is, when I change js or css locally and push back to same heroku app, how rails handles these changes. It would be so stupid to destroy heroku app and push again.
Everytime you make changes to your application locally you should run "bundle exec rake assets:precompile RAILS_ENV=production". This will compile your assets in the public folder and then you should commit them to git . Then upon running "git push heroku master" you will see your new assets on the deployed app once it is reloaded.
As far as destroying the app. goes, when pushing changes it is only restarted. Your database and all else are kept in tact.

Unable to deploy rails test app to Heroku

I'm working through the odin project's web development course and I'm getting tripped up on the last part of the installations project where you are tasked with deploying a rails app to Heroku. I've been working on this for about a week but I refuse to give up but I realize that I need some help.
Here's the link to the tutorial I'm trying to work through (on a mac):
http://installfest.railsbridge.org/installfest/deploy_a_rails_app
I have a Heroku account set up, and am running Ruby 2.3.0 and rails 4.2.5.1. Rubygems are at 2.6.1 (but I tried them at 2.5.1 too).
Everything works fine but when I get to heroku run rake db:migrate I always get the time out error:
[~/railsbridge/test_app] ruby-2.3.0 $ git push heroku master
Everything up-to-date
[~/railsbridge/test_app] ruby-2.3.0 $ heroku run rake db:migrate
Running rake db:migrate on powerful-journey-35824... up, run.9421
▸ ETIMEDOUT: connect ETIMEDOUT 50.19.103.36:5000
I saw another post suggesting that the problem is a result of the connection I'm using blocking port 5000 (I'm at a library). I checked port 5000 on canyouseeme.org as well but it also timed out.
I then tried deploying the app detached using heroku run:detached rake db:migrate and it seems to work until I open heroku again and it shows that the page I'm looking for doesn't exist.
Basically what I'm asking is, does anyone have any idea why this test app isn't getting pushed from my terminal to the heroku deployment page?
I'm a python/django guy, but taking a guess the "everything up to date" message is likely because you have not commited your changes to git. Try:
git commit -a
git push heroku master
Now run your rake command.

Heroku rake command

I'm trying to push my Rails app to Heroku, and I'm at the point where I'm trying to create/migrate the database, but I cannot get the rake command to run. Here's the message I'm getting:
$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.2439
bash: rake: command not found
I spent a lot of time getting Postgres set up on my local machine, and it's working fine (was able to run rake commands without issue, and the app is running locally), but I don't know why I'm getting this error when I try to migrate the heroku database.
Figured it out. Turns out I had an error when I tried to deploy the app to Heroku, so it was never deployed. I didn't realize this because I was trying to push a branch that was not the "master" branch to heroku, thinking it would be fine. I wasn't getting any errors on that push, but that's because heroku won't try to deploy anything other than the "master" branch. Once I pushed the "master" branch, I got a bunch of pre-compile errors. Once those were cleaned up, I the app was deployed properly and I was able to run the rake commands.
Long story short, make sure your app successfully deployed before trying to run rake commands.

Deploying Heroku app--updating my code?

This is a basic, stupid question, but I configured my Rails app to deploy on Heroku, and I'm able to open the application from my Heroku account, etc. But when I want to change my code, do I need to re-deploy the whole application? I tried just committing/pushing to heroku master, but I get the error "fatal: remote end hung up unexpectedly." What should I do instead?
Also: am I supposed to run db:migrate BEFORE deploying/pushing?
There is nothing stupid about a basic question, as everyone has to start somewhere.
The basic process with deploying a Rails app to Heroku is to:
Make changes
Add and Commit your changes ($ git add files_changed.rb & $ git commit -m "make changes")
Push your changes to Heroku ($ git push heroku master)
This then pushes your code to the remote Heroku repository and redeploys your Rails application. If you have made any database migrations, you need to run:
$ heroku run rake db:migrate
This runs db:migrate on your heroku app - see how that works? :)
Running rake db:migrate locally simply migrates your local development database.

deploy rails app on heroku

Hey
I'm afraid I should ask a rookie question :
After push my app to heroku. I got error of no database
This is the command I use
heroku rake db:migrate
My app can run locally with no problem, but I notice the database file only in development.
and my test evironment only use rails server and localhost:3000
anyone tell me how to make the database in production mode in heroku.
Thanks
here's the heroku log file:
here's the logs
Started GET "/drummers/1" for
221.9.247.14 at Sat Dec 18 06:17:40 -0800 2010 Processing by DrummersController#show as HTML
Parameters: {"id"=>"1"} Completed in
167ms
ActiveRecord::RecordNotFound (Couldn't
find Drummer with ID=1):
app/controllers/drummers_controller.rb:11:in
`show'
I think it may due to the datebase,config file, become I use sqlite3 in local test, and all the migration file is development prefix,
It's not telling you that you have no Database.
It's telling you that it can't find a specific record
(Couldn't find Drummer with ID=1):
It's likely that you have code that's doing Drummer.find(1) and that doesn't exist on your production environment.
Recommend you either:
create a seeds file (heroku rake db:seed) rails cast
push your entire database to heroku (heroku db:push) [make sure you understand this will wipe out your production database]
Heroku creates a database for each application deployed to it (no need to run heroku rake db:create. Here are the commands you should be using to deploy a Rails application to Heroku:
git init
git add .
git commit -m "initial import"
heroku create
git push heroku master
heroku rake db:migrate
heroku open
I believe Heroku creates a new database.yml for you on deploy if you have no production according to the Docs.

Resources