Unable to access preview site in cloud9 IDE - ruby-on-rails

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

Related

Load a rails page after foreman start

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!

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.

EC2 : Rails deployment gives blank pages

I have deployed my rails application on EC2. It runs on two servers. One for rails application and second for DB.
When I start application using "rails s -e production&" and if I stay connected using SSH,
I can see the webpages.
As soon as I disconnect SSH I can not see the pages.
There are no errors thrown. One weird thing is "Production.log" file does not have anything.
everything is spit out on console.
You are running rails in the current ssh session. Any programs you have running during that session will stop if you disconnect. You need to set up your rails app to run as a daemon using something like Phusion Passenger.
You are basically running the built in WEBrick server that is not really meant for production so it's likely that the process is getting killed after the parent process (your ssh process) gets terminated.
You can probably tweak the configuration to make WEBrick not quit, or you can simply run your session using screen or tmux
Screen:
$ screen
$ rails s -e production &
$ screen -d
When you want to reattach:
$ screen -r
Tmux:
$ tmux
$ rails s -e production &
$ # Hit <ctrl-b><ctrl-d> to detach
When you want to reattach:
$ screen attach -t 0
Or like #datasage mentioned you can run your Rails with an actual production web server like Passenger Phusion or Unicorn.

Run thin as webservice Ruby 1.9.3, Windows Server 2003

I'm trying to run a ruby app (redmine) as thin webservice on Windows Server 2003. I've already read and done everything said here and here, but it still won't work. At the moment I've set:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\[my_service_name]\Parameters]
Application=c:\ruby\bin\ruby.exe
AppDirectory="c:\Program Files\redmine-1.4-test"
AppParameters=c:\ruby\bin\thin start -p 3001 -e development
Running thin from command line via:
C:\Program Files\redmine-1.4-test>thin start -p 3001 -e development
works fine.
I already tested moving Redmine to a path with no spaces, which doesn't change anything.
Any idea what can be wrong? Any hints how I could track the problem down?
Make sure that you are running the new service in the account where Ruby is installed - where you can run thin normally from the command line. Edit the service from the Control Panel (services.msc) and set up the Logon tab accordingly.

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