I am trying to setup Prerender.io server locally. I am Rails + AngularJs app.
Already pulled prerender repo and started the server with node.
$ export PORT=3001
$ node server.js
2015-03-13T08:15:48.152Z starting worker thread #0
2015-03-13T08:15:48.159Z starting worker thread #1
2015-03-13T08:15:48.161Z starting worker thread #2
2015-03-13T08:15:48.163Z starting worker thread #3
2015-03-13T08:15:48.506Z starting phantom on port [12301]
2015-03-13T08:15:48.523Z Server running on port 3001
2015-03-13T08:15:48.524Z starting phantom on port [12304]
2015-03-13T08:15:48.526Z starting phantom on port [12303]
2015-03-13T08:15:48.530Z starting phantom on port [12302]
2015-03-13T08:15:48.541Z Server running on port 3001
2015-03-13T08:15:48.548Z Server running on port 3001
2015-03-13T08:15:48.558Z Server running on port 3001
2015-03-13T08:15:51.750Z started phantom
2015-03-13T08:15:51.755Z started phantom
2015-03-13T08:15:51.757Z started phantom
2015-03-13T08:15:51.758Z started phantom
2015-03-13T08:15:56.715Z getting
If I hit below URL , I am getting page rendered properly .
localhost:3001/http://localhost:3000/register
But when using Rails Prerender middleware , Page is not rendering and its show empty page. I am hitting below URL.
http://localhost:3000/register?_escaped_fragment_=
It seems , its correctly hitting server and response with status 200 , but page is not displayed.
Output with escape fragment
Any help will be much appreciable. I can provide more details if need.
USING PUMA SERVER
Response from Prerender.io
Are you using the Thin webserver? You should make sure you're using a multi process server like Puma or Unicorn since the Rails blocks I/O waiting for the Prerender response.
Related
I'm working at getting a very basic ruby/rails environment up and running, and I am presently unable to connect to it.
I'm working on a Macbook (updates current), and I've got an Ubuntu VM running that I'm using as my test server.
I have port-forwarding set up for connecting with the VM (hypervisor = VirtualBox)
8083 to 80 (http)
9307 to 3306 (mysql)
2223 to 22 (ssh)
3010 to 3000 (WEBrick)
VM Port-Forwarding Setup Screen
I have not setup a firewall on the server
Using this, I can ssh in, and I can hit "non-rails" sites just fine via Apache. What I can't do is get a basic "hello-world" screen up for the rails environment. I CAN get there if I cut out the VM and start WEBrick ("rails s") directly from the Mac environment and then go to localhost's port 3000, but when I attempt the same thing on the VM and then try to hit port 3010 the same way, I get back a "no data received" response.
WEBrick appears to be running just fine
myserver$ rails s
=> Booting WEBrick
=> Rails 4.2.5.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2016-02-08 09:01:30] INFO WEBrick 1.3.1
[2016-02-08 09:01:30] INFO ruby 2.1.5 (2014-11-13) [x86_64-linux-gnu]
[2016-02-08 09:01:30] INFO WEBrick::HTTPServer#start: pid=3756 port=3000
Turning Apache on/off does not change anything beyond changing the accessibility of the content served by Apache.
I've tried monitoring "log/development.log" in my rails application, and I've also poked around to see if I noticed any clues in any of the various log files under "/var/log", but nothing's jumping out at me.
I am not doing anything fancy here. I just want to get to the "Welcome Aboard!" screen for rails. I thought that getting started would be as simple as setting up the port-forwarding, creating the rails-application, and hitting it from my browser; it's been a few hours now and I'm getting nowhere with this. Apologies if this has a super easy solution that I'm just not seeing.
Where do you configure the IP addresses that are permitted to connect to a Rails app?
I have a simple rails application which I have inherited that runs in a development environment on Ubuntu 14.04.
It was working OK until recently when some changes were merged in from git. Now when I run rails s the application appears to start thin as the server, as expected.
=> Booting Thin
=> Rails 4.2.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on localhost:3000, CTRL+C to stop
netstat shows that rails is in fact listening as expected
tcp 0 0 localhost:3000 *:* LISTEN
I can access the website ok from a browser on the server box using 127.0.0.1:3000 and all appears to work as it should. I can't access it from any other machine as a Connection Refused status is returned because rails is only allowing localhost on port 3000.
If I start Thin from the command line with thin start it returns with a similar setup
>> Using rack adapter
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
But this time Thin is listening for connections from any IP and I can reach the site from another machine. There is a difference in behaviour between starting Thin on its own and starting Thin from rails although both are version 1.5.1. Something in the Rails config is constraining Thin to listen only for connections from localhost.
I have all up to date gems so far as I can tell. I thought the issue might be something to do with eventmachine, but I can't find anything.
Any advice appreciated.
0.0.0.0:3000 is an alias for binding to all interfaces. Localhost is literally only the localhost 127.0.0.1 which is not reachable from outside.
With rails 4 I believe they changed the deafult behavior of rails s so the server no longer listens on external interfaces. You can use
rails s -b 0.0.0.0
This will bind it to 0.0.0.0 (all interfaces),as if you started thin manually.
When you start the server specify the ip on which your rails application will run by binding rails application to specific IP. This can be done with -b option. For example if your ip is 192.168.1.69
rails server -b 192.168.1.69 -p 3000
You need to allow the incoming traffic for the port 3000 when you try to access your app from other devices only with in the same network. check out the documentation for Allowing Incoming Traffic on Specific Ports on ubuntu
Thanks errata
That explains it clearly, and now that I have the keyword "binding", I can see that this question has been asked before. It would be helpful to set the binding in a config file, but it seems this is not possible. I'll try to set an alias for the rails s command and use that.
FYI the change was made in version 4.2 of rails according to the release notes for that version because of a change in the underlying rack library.
I am using ruby 1.9.3 and rvm. I would like to run a thin server with --ssl option. I read in some answers that running "thin start --ssl" should do the trick.
But in my development environment when I run thin start --ssl the terminal runs:
Using rack adapter
Thin web server (v1.5.1 codename Straight Razor)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop
And in my web-browser in localhost:3000:
No data received
Unable to load the webpage because the server sent no data.
Here are some suggestions:
Reload this webpage later.
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
When I run the same command with "rails s thin" it work though, with a different message:
Booting Thin
Rails 3.2.11 application starting in development on http:// 0. 0. 0 .0 :3000
Call with -d to detach
Ctrl-C to shutdown server
I don't know why this happens (maybe because of rvm) but thin is working propely. I wanted to run the first vertion "thin start --ssl" because I couldn't set this ssl option in the "rails s" command.
I found the reason why I had "No data received". If anyone has the same error:
I ran "thin start --ssl" so my server would only respond to https requets. All the http requests were not answered, so that's why there was no data (stupid). By default http requests goes to port 80 while https requests goes to port 443.
"thin start --ssl" works fine for debugging ssl locally and you can test your whole application by forcing ssl in the application controller (so you don't find yourself in the same situation, with no data received).
A much easier (and more real world) solution is to run a web server (like nginx) in front of your rails app. This web server would listen for both http and https traffic, and then just pass everything over to port 3000 to the Rails (thin) server.
I'm following the first Ruby on Rails 3 tutorial from PeepCode and at around 27-29 minutes in, they have us start the Rails server. To the best of my knowledge, I have Rails (and Ruby) successfully installed.
When I run the command rails server (from Windows 7 Command Prompt per the instructions of the video), I get the message:
=> Booting WEBrick
=> Rails 3.1.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-12-02 18:37:57] INFO WEBrick 1.3.1
[2011-12-02 18:37:57] INFO ruby 1.9.3 (2011-10-30) [i386-mingw32]
[2011-12-02 18:37:57] INFO WEBrick::HTTPServer#start: pid=5584 port=3000
And it doesn't return to the prompt, indicating that it is running. Also, to me (and compared to the video), this looks like a successful message.
However, when I browse to the URL, http://0.0.0.0:3000, as directed by the video, I get an error (while the video opens to the default index page for Ruby). The error I get is:
Error 108 (net::ERR_ADDRESS_INVALID): Unknown error.
Since I'm using Google Chrome, it also says:
The webpage at http://0.0.0.0:3000/ might be temporarily down or it may have moved permanently to a new web address.
So, I was wondering how to fix this?
0.0.0.0 is the ip address that Webrick is binding to. It means 'listen on all interfaces'. In other words, you can connect to this application from the internal address (localhost or 127.0.0.1) as well as the external address on the network (192.168.1.x or 10.0.10.x or a domain name that resolves to an address this machine has on the network). The server doesn't care where the request comes from.
If, however, you started rails server with the '-b' or '--binding' option and told the server to bind to 127.0.0.1, the server would not respond to requests to the external interface. You could still use 127.0.0.1 or localhost but you could not connect to this server using it's external ip address locally or from another machine.
Going to http:// 0.0.0.0:3000 works on my Linux system and most likely the screencast you were watching was using a mac which would also work. My guess is that 0.0.0.0 isn't supported on Windows.
Just use localhost if you are on the box or the ip address of the box if you are accessing it from another machine. That is what I do, even when I'm running a machine that understands 0.0.0.0.
You can start the server with this command:
rails server -b localhost
But as a lazy typist, in my .bash_aliases, I have this alias
alias rs='r s -b localhost'
With the alias, I can start the server with just:
rs
I've just created a new rails application using command:
rails blog
Now I'm following blog/README file. To get started, I'm trying to start backburner server as stated in the README file:
Change directory into myapp and start the web server: script/server (run with --help for options)
Using the server command I started backburner server with default settings:
Manager Port: 3234
Server Port: 3233
255.255.255.0 as subnet mask, with Automatic Search checked
The backburner server window keep posting the following information:
INF Looking for a manager using 10.65.97.255:3234
And after a while:
WRN Manager is not responding
Seems the server never started because I cannot find a page in http://localhost:3000/ address. How to configure and start backburner server?
The messages you've posted appear to relate to Autodesk Backburner and are not being output by Rails. Make sure you are running script/server from the blog directory and not just server.