heroku deploy doesn't work - ruby-on-rails

i am deploying my rails app to heroku. after openning my heroku account i tried to
and downloading the tool belt
login to heroku .
heroku login
Enter your Heroku credentials.
Email: my email
Password (typing will be hidden):
! Unable to connect to Heroku API, please check internet connectivity and
try again.
i saw some answers that talked about the remote option
so i did that:
heroku git:remote -a my-app-name
and i got the same response
any idea why and how to fix???

Make sure your password is correct. Try changing the password in your dashboard and try again.

Related

Rails server works in dev mode but not in production mode

I have been building an app for a few months now, I had it hosted on heroku, and I started making changes to it for a while without pushing to heroku, just working on localhost. I went to push it to heroku and ran into an issue with the asset pipeline not liking a variable in an erb tag. I took it out to get the code pushed, and ran into a bigger issue. Still, a 500 error but the logs now said:
ActionView::Template::Error (FATAL: Peer authentication failed for user "fullstack".
Now, in my research on this issue, I attempted several things, and here are some of my findings.
I did not change the storage.yml or database.yml files at all. The production server is AWS s3 buckets, and they are connected to config.active_storage.service for both the production and development in the config/environments files.
The production user in the database.yml is named fullstack. The development user does not have a username or password. I was able to reset the server with the original username and password, but when I change the production username and reset the server it says
PG::ConnectionBad: fe_sendauth: no password supplied
So I go into the terminal and check the owner of the fullstack database, a few things with that. First I check psql -l to see all databases, and I have a fullstack_test and a fullstack_development, but no fullstack_production, and I think that is normal since rails only generate the dev and test on creation. Those two are owned by my Ubuntu user, sethb. I tried to create a fullstack_production database to see what would happen, and I get this error
PG::ConnectionBad: FATAL: Peer authentication failed for user "fullstack"
When I was researching this, people were saying to change a setting in my pg_hba. I looked into mine and it already had set to: host all all all trust. I have been at this for about 20 hours at this point and I would love to hear if someone has an idea on how to fix this, I don't even know how to proceed with this honestly. Any help would be very much appreciated. I can also provide more info on any logs that I have had if it would help
So an update to the story, a half way solution. I was cloning the full project and aws, and when I went to push to heroku, someone helped me notice that I didn't have a node.js buildpack installed. As soon as I did that and pushed the new version, it worked. I tried rails s -e production, but that still throws a 500 error. This time it's saying application.css isn't present. But that is an issue I think someone has a solution for later. Either way, check your Heroku settings! Thank you
Seth B.

Error accessing Heroku Logs from Nitrous.io

I am trying to access the log from a small Rails app that I have deployed to Heroku, from Nitrous.io.
When I run 'heroku logs' I get the following:
Unable to connect to api.heroku.com
I am guessing that I don't have something setup correctly, but have no idea what.
Can someone point me in the right direction?
Thanks,
Jim
Assuming you've already run heroku login, Try adding your Nitrous project's SSH keys to heroku. When you're in the Web IDE in your project, type in the command line:
$ heroku keys:add
Then try running heroku logs again.

Heroku commands on Cygwin hangs

I am trying to use Heroku commands on Cygwin but they seem to not do anything, but hang.
I installed the Heroku toolbelt for Windows.
Doing the $ heroku version gives me heroku/toolbelt/3.10.5 (i386-mingw32) ruby/1.9.3.
But whenever I try a $ heroku login or $ heroku login it just hangs and does nothing.
I setup a Heroku remote in one of my Github repo folders and tried to heroku push master but it prompts me for my password, and I type it in, but gives me this message:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Help! Has anyone successfully used Heroku on Cygwin?
It sounds like heroku is trying to log in with your ssh key, which isn't added to your account. Ensure that you've added your public key to your heroku account (if you log in, go to account, add the ssh public key (~/.ssh/id_rsa.pub)). this might help you out as well.

Syncing Heroku and localhost databases

Hey so I am following the One Month Rails guide to learning Ruby and I have hit a wall on one of the lessons. I have just finished uploading an image with Paperclip, and as I finished my work on my localhost and checked it on Heroku, something went wrong. The pin/image appears to have been pushed to my Heroku account, the only problem is that the username and password that works for my localhost:3000 won't work for my Heroku account. The same password should work for both, but for some reason something is wrong. I wish I could give you the action that is going on in my terminal, but the ruby rails is the only thing that has a continuous status flow. The problem may have been when I switched my password after not using my account on localhost for a few weeks, but i thought that once i "git pushed" that to heroku master, it would've synced. I have tried heroku run rake db:setup which didn't seem to do too much as well as wrestled by way through "Importing a Heroku Postgres Database with PG Backups", but I had some trouble working through that. Any ideas? Thanks for the help.
Your 'database.yml' should not be sent to Heroku, they take care of that, creating a new database.yml config file with the proper DB access details.
Try logging into your Heroku instance and deleting the file.
Edit: nevermind, assumed you were not able to connect to the DB, not to login into the website.
So if I'm understanding you correctly, you've deployed your application to Heroku and the login (to your application) that was working locally doesn't work on Heroku.
Deploying your application doesn't deploy data. Assuming you've run heroku run rake db:migrate then your database schemas will at least match.
At this point, you've got a couple of options.
Use a seeds.rb file which you can load with heroku run db:seed to setup some 'seed' data so that you can login.
Push your local database to Heroku - either via heroku db:push or using heroku pg:transfer provided by https://github.com/ddollar/heroku-pg-transfer
Use heroku run console to create your user account via the command line
User.create(email: 'someemail.com', password: 'somepassword', password_confirmation: 'somepassword')
I'd be inclined to go with the later option.
How did the user get in their in the first place? Perhaps going back to that step in the tutorial - just remember, if you are using rails console locally to use heroku run console on Heroku.

Heroku and Github log in issues, (Heroku.account = work, No such account: work)

I am having trouble pushing and logging into Heroku.
When attempting to log in, it renders the error;
No such account: work
So, looking at my github config list I see that it states;
heroku.account=work
I can't find the correct method to change these; how to revert these two back to their default settings or personal account?
I managed to sort this by firstly deleting the heroku account in the git config --edit file, then was able to go heroku accounts:add personal --auto then setting this as a default using heroku accounts:default personal.
Thats coming from the Heroku Accounts plugin (https://github.com/ddollar/heroku-accounts) which allows you to switch accounts. Once reinstalled you probaby need to do heroku accounts:add work and enter your work credentials and it should start working.
Try to remove the existing account credentials by rm -rf ~/.heroku/plugins/heroku-accounts and then type heroku login enter your credentials.. okay now.

Resources