Load a rails page after foreman start - ruby-on-rails

I'm new to web development. I'm trying to follow the instructions here to set up a local instance of the sharetribe.com website: https://github.com/sharetribe/sharetribe
I've followed all the steps under "Setting up the development environment" without any issues, but when I get to the end, I'm supposed to "Open a browser and go to the server URL (e.g. http://lvh.me:3000)"
At that URL, I get "This site can’t be reached." Is my URL supposed to be at a different port on localhost? How do I figure out where my site is at?

Foreman starts the server on 'http://0.0.0.0:5000' by default.
Instead of Foreman, you can also start the rails server with following command:
rails s -b 0.0.0.0 -p 5000

Figured it out! The IP address prints out in the terminal where you did the "foreman start" command after the line "Rails 5.1.1 application starting in development on"
Mine was http://0.0.0.0:5000 (not that it's 5000 not 3000), then after filling in the information, I was redirected to http://[my marketplace name].lvh.me:3000/ and I had to change that to 5000 to see the marketplace. Huzzah!

Related

Unable to access preview site in cloud9 IDE

Whenever I try to visit my preview site ("[application_name]-[my_username].c9users.io"), I get the timeout error as shown in picture below:
Time Out Error
I successfully used the preview site earlier, but suddenly it stopped working. This happens regardless of whether I run webrick server or not. I am trying to run tutorial site detailed in "https://www.railstutorial.org/book/sign_up".
Did you try to restart the server? Just ctrl + C and then run bundle exec rail server -b $IP -p $PORT
And maybe restart the workspace

How can you see your rails server running on heroku, so you can see full output while sending REST requests?

Typically if you use your localhost, you can just run
rails s
from terminal and then when you hit your webserver, you can see the output.
However, when I run
heroku run rails s
and then I hit my webserver up on heroku, I don't get any output like I do when I "rails s" with localhost.
Is there anyway to achieve this?
If you want to see the live server logs, use this command
heroku logs -t
There are many more options available, look at this answer heroku - how to see all the logs
You can use heroku logs command in terminal to see the log just like you see using rails s command.

Heroku Port 5000 not connecting

I am doing a Saas course from edx.org,using ruby on rails.
The course needs to deploy my app running in virtual box to heroku.
My host and guest machine are Ubutu 12.04
The problem is , this command does not work .
heroku run rails db:migrate
Even tried with troubleshooting on Heroku site ,which points the same above issue
https://devcenter.heroku.com/articles/oneoff-admin-ps#troubleshooting
But even this command did not work
telnet rendezvous.runtime.heroku.com 5000
It is clear port issue , I am unable to breakthrough.
Any help ?
If this is the error message:
$ heroku run console
Running `console` attached to terminal... up, run.2077
!
! Error connecting to process
$
Try this: heroku run:detached ls
If it says:
Running `ls` detached... up, run.8825
Use `heroku logs -p run.8825` to view the output.
$ heroku logs -p run.8825 2013-04-11T21:30:50.137946+00:00 heroku[run.8825]: Starting process with command `ls`
2013-04-11T21:30:50.805694+00:00 app[run.8825]: app
2013-04-11T21:30:50.805694+00:00 app[run.8825]: bin
2013-04-11T21:30:50.805694+00:00 app[run.8825]: config
.
.
.
Then it's firewall-related but only because Heroku points the finger elsewhere.
https://devcenter.heroku.com/articles/one-off-dynos
This is a Heroku issue for many users because they are demanding a connection to port 5000. In many enterprise environments where only ports 443/80/22 are usable, this leaves a large fraction of customers with lots of money out in the cold. Heroku should take ownership and just help users make it work. There is no technical reason they can't, and any argument as such would be to justify laziness.
Hackarounds like https://github.com/nzoschke/SSHeroku and charging for Proximo are non-starters, requiring more even more work diffused upon users and aren't scalable.
Heroku development servers appear to be down right now for me. Type the following code in the command line to output your log:
heroku logs
Right now I am getting error code h99 which they say on their website:
This indicates an internal error in the Heroku platform. Unlike all of the other errors which will require action from you to correct, this one does not require action from you. Try again in a minute, or check the status site.
The status site (status.heroku.com) says everything is okay... but my logs indicate there is something wrong on their end.
What does heroku logs output for you?

how to map a Rails app to a certain URL path?

Hey, Guys
I'm now learning starting up the Rails on my VPS server, Now I can visit my app rails my thin server by a 3000 port number, something like this http://mydomain:3000,
But I want to map this app to the url like http://mydomain/railsapp1, so when I add a railsapp2 for testing purpose, it won't mess up my railsapp1.
Should I add something in the thin configuration file? or I should use nginx?
Are you open to using Passenger (ModRails)? You could then use Nginx and setup your Rails apps under different subdirectories.
General information for installing Passenger in Nginx can be found here: http://www.modrails.com/install.html
You can see more information here on setting up Rails in subdirectories: http://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_rails_to_sub_uri
You could just start railsapp2 on port 3001 if you want to have both running at the same time
Rails 2
script/server -p 3001
Rails 3
rails server -p 3001

Why would running a Rails app as a WEBrick server work, but installing it as a Mongrel service would not?

Yet another newbie RoR question from me.
I started banging my head against a wall last night when I simply could not get my Rails app to display in my browser after installing it as a Mongrel service.
I installed it using a command like this (from the app's root directory):
mongrel_rails service::install -N MyAppName -e development -p 3000
This set up the Windows service and everything seemed to be just fine. I could start/stop the service and saw no errors in the logs. Then navigating to localhost:3000 in my browser, I was greeted with a variety of errors, none Rails-specific (all along the lines of "Could not connect to server" or the like). Consulting the log at this point revealed no obvious problems.
I could not for the life of me figure out how to get this to work. So, out of exasperation, I tried simply running the app on WEBrick instead:
ruby script/server webrick -p 3000
When I did this, my app ran perfectly! Opening my browser to localhost:3000 now displayed my front page as expected.
I should note that I have used Mongrel successfully for other apps on my local machine.
So what app-specific characteristics could be responsible for WEBrick working where Mongrel doesn't?
Just some ideas to try:
Add -c param with full path to application:
-c "C:\xxx\yyy\zzz"
Check if system-wide PATH environment variable contains ruby bin directory - maybe just user's PATH is set.
Switch service to run as your user.

Resources