Rails app on heroku stopped working - ruby-on-rails

I have a rails app deployed on heroku. It worked for about a year. Lately I just can't enter the app. Connection takes too long. I tried to restart dynos but it has no effect. I have also changed from unicorn to puma.
After restart I have in logs
2016-01-20T21:15:06.007597+00:00 app[web.1]: Puma starting in single mode...
2016-01-20T21:15:06.007619+00:00 app[web.1]: * Version 2.15.3 (ruby 2.0.0-p648), codename: Autumn Arbor Airbrush
2016-01-20T21:15:06.007621+00:00 app[web.1]: * Min threads: 5, max threads: 5
2016-01-20T21:15:06.007622+00:00 app[web.1]: * Environment: production
2016-01-20T21:15:09.455202+00:00 heroku[web.1]: State changed from starting to up
2016-01-20T21:15:09.218059+00:00 app[web.1]: I, [2016-01-20T21:15:08.018346 #3] INFO -- : Loading Rails (4.2.5) integration
2016-01-20T21:15:09.218129+00:00 app[web.1]: appsignal: Starting AppSignal 0.11.7 on 2.0.0/x86_64-linux
2016-01-20T21:15:09.221967+00:00 app[web.1]: appsignal: Started Appsignal agent
2016-01-20T21:15:09.323110+00:00 app[web.1]: * Listening on tcp://0.0.0.0:48877
== EDIT: ==
After curl I get
curl: (52) Empty reply from server
I have found here stack overflow question to use https instead of http, however from https curl I get
curl https://myapp.herokuapp.com
<html><body>You are being redirected.</body></html>%
I have run out of ideas. Any help would be appreciated.

It turend out that server settings was the problem. I had a redirection to ip. Don't know how it had worked for so long. I have changed it for a CNAME record and it works like a charm.

Related

My Heroku app using Rails and Postgres suddenly stops working

The error message when I tried to start my app 'lvmine.herokuapp.com':
Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
$ heroku logs --tail -a lvmine
We got
2022-02-06T05:34:41.193073+00:00 heroku[web.1]: State changed from crashed to starting
2022-02-06T05:34:43.080374+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 17601`
2022-02-06T05:34:45.446271+00:00 app[web.1]: => Booting WEBrick
2022-02-06T05:34:45.446285+00:00 app[web.1]: => Rails 3.2.19 application starting in production on http://0.0.0.0:17601
2022-02-06T05:34:45.446285+00:00 app[web.1]: => Call with -d to detach
2022-02-06T05:34:45.446285+00:00 app[web.1]: => Ctrl-C to shutdown server
2022-02-06T05:34:45.446286+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2022-02-06T05:34:46.018783+00:00 app[web.1]: Exiting
2022-02-06T05:34:46.019530+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `initialize': SSL error: tlsv1 alert protocol version (PG::ConnectionBad)
2022-02-06T05:34:46.019531+00:00 app[web.1]: FATAL: no pg_hba.conf entry for host "44.200.80.186", user "sajwovtzpjymwu", database "d14n914sh0nmn", SSL off
Seems like SSL problem and Postgres error? I have no clues.
Can anyone help?

My rails application(in local) suddenly stop responding to requests

I have been working on a rails application for the past four months. Suddenly one-day puma server stops responding to the requests.
Here is what I see in the terminal:
$ rails s
=> Booting Puma
=> Rails 5.1.7 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
Puma version: 5.5.2 (ruby 2.6.3-p62) ("Zawgyi")
Min threads: 5
Max threads: 5
Environment: development
PID: 12446
Listening on http://127.0.0.1:3000
Listening on http://[::1]:3000
Use Ctrl-C to stop
Started GET "/" for ::1 at 2021-11-10 12:28:58 +0530
Started GET "/recommendations" for ::1 at 2021-11-10 12:29:20 +0530
Started GET "/" for ::1 at 2021-11-10 12:29:39 +0530
Started GET "/" for ::1 at 2021-11-10 12:29:40 +0530
I tried many things like changing the port, making sure that the rails version in my local and gemfile are the same, trying with other ruby versions, uninstalling and reinstalling ruby and rails in local.
Tried keeping binding.pry in the application controller's index action but that not getting hit. I am not able to exit from that point, the server gets stuck there. There are no recent changes in my application.
Can anyone suggest to me what might be the problem?

Heroku Rails server API not setting the correct port number when starting up

I have a Rails API Backend with a React front end that is deployed to Heroku. When I try to load a page that makes a call to the API, it hangs and then finally gives this error in the console:
GET https://MYAPP.herokuapp.com:3001/auth/refresh_token net::ERR_TIMED_OUT
When I look at the logs while the application is starting up, it looks as though I'm setting the port to 3001 which is what I want but it looks as those puma is listening on a different port number:
2020-10-01T04:28:51.720203+00:00 heroku[web.1]: Starting process with command `bundle exec puma -t 5:5 -p ${PORT:-3001} -e ${RACK_ENV:-production}`
2020-10-01T04:28:55.321298+00:00 app[web.1]: Puma starting in single mode...
2020-10-01T04:28:55.321325+00:00 app[web.1]: * Version 4.3.5 (ruby 2.6.6-p146), codename: Mysterious Traveller
2020-10-01T04:28:55.321326+00:00 app[web.1]: * Min threads: 5, max threads: 5
2020-10-01T04:28:55.321326+00:00 app[web.1]: * Environment: production
2020-10-01T04:29:04.625683+00:00 app[web.1]: * Listening on tcp://0.0.0.0:55912
Should I be configuring my fetches to use this URL instead?: https://MYAPP.herokuapp.com/auth/refresh_token
Basically, what I'm asking is: Based on this log information where is my Rails API listening if my React application is listening at: https://MYAPP.herokuapp.com?

Rails Server working in command line. Not at Localhost

rails server
=> Booting Puma
=> Rails 5.2.0 application starting in development
=> Run rails server -h for more startup options
[44266] Puma starting in cluster mode...
[44266] * Version 3.6.2 (ruby 2.5.1-p57), codename: Sleepy Sunday Serenity
[44266] * Min threads: 5, max threads: 5
[44266] * Environment: development
[44266] * Process workers: 1
[44266] * Preloading application
[44266] * Listening on tcp://localhost:3000
[44266] Use Ctrl-C to stop
[44266] - Worker 0 (pid: 44286) booted, phase: 0
^C[44266] - Gracefully shutting down workers...
[44266] === puma shutdown: 2018-06-12 14:28:53 -0500 ===
[44266] - Goodbye!
Exiting
went to http://www.localhost3000.org/
says you forgot to start your server
Running
Rails 5.2.0
Postgesql 9.6
It looks like http://www.localhost3000.org/ is a website that someone bought to help you when you mistype your attempt to get to your localhost. It's not your own server responding
As the website suggests, try to go instead to http://localhost:3000
Use this address localhost:3000. The link you included is a live website someone has published as a reminder to start your server.
Use this address http://localhost:3000 but you can still edit your url, follow this article: Edit localhost

“rails generate controller” is not creating a controller

I am following the Rails guide http://guides.rubyonrails.org/getting_started.html and when I ran this command: rails generate controller Welcome index I couldn't find the generated files. So I ran the rails server and noticed that it says it's loading the new generated files in /Users/joseph/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/templates/rails/welcome/index.html.erb
Weird? What's going on?
~/RubymineProjects/blog
% rails server
=> Booting Puma
=> Rails 5.0.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.5.0 (ruby 2.3.0-p0), codename: Amateur Raccoon Rocketry
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
Started GET "/" for ::1 at 2016-07-19 20:38:04 -0700
Processing by Rails::WelcomeController#index as HTML
Parameters: {"internal"=>true}
Rendering /Users/joseph/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/templates/rails/welcome/index.html.erb
Rendered /Users/joseph/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/templates/rails/welcome/index.html.erb (5.3ms)
Completed 200 OK in 23ms (Views: 11.6ms | ActiveRecord: 0.0ms)

Resources