Setup server for ruby on rails - ruby-on-rails

working under linux server Centos remotly in local network, my rails server working there too. How can I enable remote web access? And if so how can I enable only couple of ip addresses for web access?

You should check on which addresses the server applications binds. If it has no external IP-Address then it wont be possible to access it directly from the internet. Then it is possible to use port forwarding to forward your application over your router. If you havent any access to the router you should ask the administrator of your network to forward it for you.
Another possibility is to plug a VLAN to a secound interface but you should think about security when you have a server that is connected to your NATed network and the internet directly!

if its only rails production server setup then you can try with this:
http://www.leonardteo.com/2012/11/install-ruby-on-rails-on-ubuntu-server/
it uses https://github.com/ballistiq/ruby-passenger-nginx-installer and they are maintaining the installer. I found its very helpful. it works like no-pain

Related

How to access rails server in a remote VM

I set up a Virtual Machine (VM) on OpenStack remotely. The VM is running Red Hat Enterprise Linux (RHEL) 7.
I ssh into the above VM using ssh vm-url, and then I setup a rails server during that ssh session and get it running using rails server -b vm-url
Now, I try to access the rails website above from my local Chrome browser by typing the URL vm-url:3000 into Chrome's address bar (the Omnibox), but I get:
This site can’t be reached
10.150.8.101 took too long to respond.
Why Can't I access the rails website, what have I done wrong?
Please correct me if any terminologies I used are incorrect.
Thank you.
Two things to check,
The ip attached to the VM is public and accessible
Http port is enabled to be accessed from outside
The port accessed is handled in security groups which is generally configured while creating the instance. Either add new security group with enough privileges or update the same with new added ports.

Connect to rails server remotely from raspberry pi

I have ssh'd into my rasberry pi and built a rails application.
Now how do I load the rails app from another machine?
I have tried IP:port in a web browser, but this fails.
Can I use ssh from a web browser to load the rails server process?
Are there gems I need to install to do this?
Is there any good documentation that I have missed?
SOLUTION
use ngrok to tunnel https://medium.com/#karimbutt/using-ngrok-to-create-a-publicly-accessible-web-facing-raspberry-pi-server-35deef8c816a#.sraso7zar
Maybe the problem is with the IP address you're trying to use. Servers don't necessarily forward their public IP traffic to localhost automatically.
Perhaps you could configure the IP address somehow, I don't know (others might?). Alternatively, you have a use a "local tunnel" service like ngrok or localtunnel. What these do is create a public URL for your localhost (i.e. your "loopback" address), so anyone can access it.
I spoke with a Ngrok author via email. He ensured me that I shouldn't need to expect any downtime from the service or to have to manually restart it. Although keep in mind that if you're on the free plan, whenever you restart Ngrok you're going to get a different URL. He also described it as kind of like a "souped up SSH -R"

Jenkins Server - Issues with setting URL

I am trying to set up an internal Jenkins server for our QA team and facing some issues with the server URL. This is inside a corporate network and all sort of firewall and proxy settings are in place, however we need to access the server only with in our internal network. This server runs from a Mac Mini. I was able to install and access the server without any issues using localhost:8080.
I tried to set a custom URL (something like testjenkins.local:8080)under the Manage Jenkins option and never was able to access the server. The only option worked for me is with the IP address (IP:8080). I was able to access the server from other machines in the network using this URL.
The real problem with the above setup is that the machine IP changes(I am not able to make it static), and hence wont be able to get an always working URL.
Highly appreciate if any one guide me in the wright direction.
Given you have a dynamic IP on your server, a good alternative would be using ngrok. Ngrok can expose the port 8080 of that server to the internet via secure tunnels, and you can access it via an URL, so changes in the IP won't affect it.
However, ngrok exposes the server to the whole Internet. To make it accessible only for your team you can add authentication in both ngrok tunnel and Jenkins server (would it work for you?).

Remotely viewing web pages served by pow.cx

Using WEBrick you could navigate to an app you were serving from another device/virtual machine by navigating to your.ip.address.here:port
Is it possible to do something similar with pow.cx?
The latest version of Pow (0.4.0) now includes xip.io support. You can read about the release here.
Here's a quick explanation of how this helps Pow serve your Rails apps across your entire local network, from their post:
Say your development computer’s LAN IP address is 10.0.0.1. With the
new version of Pow, you can now access your app at
http://myapp.10.0.0.1.xip.io/. And xip.io supports wildcard DNS, so
any and all subdomains of 10.0.0.1.xip.io resolve too.
Here's a description of xip.io, from their site:
xip.io runs a custom DNS server on the public Internet. When your
computer looks up a xip.io domain, the xip.io DNS server extracts the
IP address from the domain and sends it back in the response.
There are basically two options:
Don't use pow: run your applications on localhost as usual and access them as usual
Edit the hosts file (or local DNS) to point your server machine ip
Example accessing from a virtual windows machine:
Suppose you are running two rails applications in pow: store.dev and auth.dev, and you want to access them from a windows xp virtual machine to test them with IE, you only need to edit your hosts file to add the lines:
C:\WINDOWS\system32\drivers\etc\hosts
# Allow to access applications in pow.
# The ip address points to the host machine localhost, that usually is the default gateway
10.0.2.2 store.dev
10.0.2.2 auth.dev
And then open the IE browser to access your applications in http://store.dev and http://auth.dev respectivelly.
Specifically, no, because Pow uses the Host header of the request to determine which app you need to access. To get that working remotely, you would have to have the remote machine map the required domain name to your IP address - either with a local DNS server or by editing the HOSTS file. Both of which are possible but annoying.
The simplest thing to do in that case is to start up a standalone Rails server as you mentioned (using ./script/server or rails s depending on the version), and then you can address http://[ip address]:3000 as before.
In other words, Pow works because it intercepts your local domain resolution, something that isn't affected by (or available to) remote machines.

How do I access my web application from a non-local machine?

I have a Ruby on Rails application that I'm developing on my computer, which runs Ubuntu 10.04 LTS. I'd like to be able to access it from a remote computer for testing purposes. I've no idea how to proceed. Do I need to set up port forwarding? Virtual hosts? Can anyone point me to an article/tutorial/whatever that has information about how to do this?
Thanks!
If you want to run it using the server script, you can have it listen to a specific IP address like:
script/server -b 192.168.1.5
Substitute your machine's IP address that is accessible over your network. Then other hosts can get to the Rails app via e.g. http://192.168.1.5:3000.
If you mean you're behind a firewall or NAT gateway, then the question of how people outside of your firewall/NAT can get to your machine is another question entirely... something that probably belongs on superuser.com.
The best way I've found is to use http://www.tunnlr.com.

Resources