run rails server and open http://localhost:3000 just have blank - ruby-on-rails

I am a new guy with Rails, and I read Ruby on Rails Tutorial and made a sample_app. I use the Cloud9 before today. But I want to run this app in my Mac. So I push all file to Bitbucket and clone this repo in my Mac.
Then, I run bundle installand rails db:migrate, and don't get any errors. Also, rails test passes.
When I run rails s, I got this output:
> Booting Puma
=> Rails 5.0.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
(called from block (2 levels) in <class:Railtie> at /Users/Shu/.rvm/gems/ruby-2.3.0/gems/sass-rails-5.0.5/lib/sass/rails/railtie.rb:57)
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
(called from block (2 levels) in <class:Railtie> at /Users/Shu/.rvm/gems/ruby-2.3.0/gems/sass-rails-5.0.5/lib/sass/rails/railtie.rb:58)
Puma starting in single mode...
* Version 3.4.0 (ruby 2.3.0-p0), codename: Owl Bowl Brawl
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
But when I open http://localhost:3000, it is blank,and the server doesn't have any change. These warnings also exist in Cloud9, but Cloud9 could open this site.
I try to rails new a new App, it works successfully. What should I do?

Related

Ruby rails, local server dont start with rails s

im working on linux, on a project with ruby on rails.
I have a probléme when i use rails s.
Normaly when i do rails s i can see that :
Booting Puma
=> Rails 6.0.0 application starting in development
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 4.3.5 (ruby 2.6.3-p62), codename: Mysterious Traveller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://127.0.0.1:3000
* Listening on tcp://[::1]:3000
and i can see my project on localhost 3000
But now, on my current project, its juste do :
=> Booting Puma
=> Rails 6.0.0 application starting in development
=> Run `rails server --help` for more startup options
Nothing more, no error message and i just cant acces to my project on localhost3000.
I tryed to specify a port with rails s -p 3000 or a PID with rails -P ... but its didnt changed nothing
i tryed rake rails:update:bin but it didnt changed anything also
Do you have any idea of what i could do for solve my problem and work agan localy on my projet?
Thank's
I guess your errors (std::err) are hidden from console.
You must be having this error
=> A server is already running. Check /YourProjectPath/tmp/pids/server.pid.
go to tmp/pids/server.pid, You will find a server ID there. Run the following command on your terminal with your server ID.
i.e:
$ kill 13455
//where 13455 is server ID for my project.
if it doest not work. Restart your PC.
You can use webrick server instead of puma server using rails s webrick

Problem starting localhost server since Mac Os Catalina update

I haven't been coding for some time. I updated my Mac Os X version to Catalina (10.15.5) and upgraded my Ruby on Rails version.
It is now impossible for me to launch my local host and try and test my code. I tried several solutions explained here https://dba.stackexchange.com/questions/75214/postgresql-not-running-on-mac but none of them worked.
Here are the steps I do:
rails s
/Users/maximeroberti/.rvm/gems/ruby-2.4.3/gems/bootstrap-4.2.1/lib/bootstrap/version.rb:4: warning: previous definition of VERSION was here
/Users/maximeroberti/.rvm/gems/ruby-2.4.3/gems/bootstrap-sass-3.4.1/lib/bootstrap-sass/version.rb:3: warning: already initialized constant Bootstrap::BOOTSTRAP_SHA
/Users/maximeroberti/.rvm/gems/ruby-2.4.3/gems/bootstrap-4.2.1/lib/bootstrap/version.rb:5: warning: previous definition of BOOTSTRAP_SHA was here
=> Booting Puma
=> Rails 5.1.6 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.0 (ruby 2.4.3-p205), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
Going to localhost:3000/
The error I am facing is the following one when trying to connect to localhost:3000/
could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Thanks for your help!

Rails 6 and action mailbox setup

I've recently upgraded to ruby 2.6.0p0 and rails 6.0.2.1. And previously I had ruby 2.3 and rails 5.2.
When I open up existing apps and just bundle update and then rails s everything is working just fine:
=> Booting Puma
=> Rails 6.0.2.1 application starting in development
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 3.12.0 (ruby 2.6.0-p0), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
But when I try to implement the new action mailbox feature by entering this initially rails action_mailbox:install it returns the following error, this same error occurs if I enter this rails action_text:install.
rails aborted!
Don't know how to build task 'action_mailbox:install' (See the list of available tasks with `rails --tasks`)
Any ideas why this is happening?
If that task can't be found, then it's generally one of two things:
Your terminal is using a different version of rails when you run the script (maybe try bundle exec rails action_mailbox:install?)
Some pieces were missed during the Upgrade Task that aren't requiring the new action mailbox tasks.
I had the same issue.
Be sure, you require action_mailbox/engine in application.rb
require 'action_mailbox/engine'

Running Standard Notes on self-hosted Standard File Server with Ruby Implementation

I'm trying to have Standard Notes to run on my self-hosted Ubuntu 16.04 server. I've followed the basic instructions given here on Github, which is to say, install Ruby 2.2+, Rails 5, MySQL 5.6+ database. All done, and running.
After that, in a subdirectory, I pulled the the Standard File Server git clone, set up the .env file with this content:
RAILS_ENV=production
SECRET_KEY_BASE=use "bundle exec rake secret"
RAILS_SERVE_STATIC_FILES=true
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=db_name
DB_USERNAME=db_user
DB_PASSWORD="db_password"
SALT_PSEUDO_NONCE=use "bundle exec rake secret"
Initialized the project with:
bundle install
bower install
rails db:create db:migrate
Again, all fine. When I start the server with rails s, this is the output:
/usr/local/rvm/gems/ruby-2.4.1/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:51: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:52: warning: constant ::Bignum is deprecated
=> Booting Puma
=> Rails 5.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
/usr/local/rvm/gems/ruby-2.4.1/gems/activesupport-5.0.1/lib/active_support/core_ext/numeric/conversions.rb:138: warning: constant ::Fixnum is deprecated
Puma starting in single mode...
* Version 3.10.0 (ruby 2.4.1-p111), codename: Russell's Teapot
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
I think the two warnings can safely be ignored. The thing that doesn't make sense is that the .env file is not read as it's running in dev instead of prod, and on port 3000 instead of 3306. Any idea why?
typo at:
AILS_ENV=production
should be:
RAILS_ENV=production

Why is rails server listing on tcp

I am working on a project which is an updated version of a new project. Using vagrant to load virtual environment and when i run
RAILS_ENV=development bundle exec rails s
The following is returned:
=> Booting Puma
=> Rails 5.0.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.6.0 (ruby 2.3.3-p222), codename: Sleepy Sunday Serenity
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
When i visit the browser I have tried localhost:3000 and 127.0.0.1:3000 but keep getting:
ERR_CONNECTION_REFUSED
On the previous version of this project on a different repository loaded it was accessible via these URL's. This project has been updated to Rails 5 but dont know why it is listening on TCP rather than HTTP. Any suggestions?
As it has been already suggested, make sure that the server is bounden to 0.0.0.0 so that all interfaces can access it.
You might try:
RAILS_ENV=development bundle exec rails s -b 0.0.0.0

Resources