What the solution for: I can't access an application made in rails in the local network - ruby-on-rails

I use openSUSE and I'm programing in Rails, but even with a "rails s -b 0.0.0.0" I never can access the application in another device in the local network, I've tried different servers 'WebRick", 'Thin', I also tried config my router, and I followed a lot of other guides I found here. But nothing make it works. I've tried at my Home and Work, and different applications I made just for test this issue.

You have two solutions to resolve your problem.
Option 1, you must install webserver such as apache or nginx and install serverapp such as passenger or unicorn. And you must setup Virtual Host to run on your app.
Refer document how to install apache + passenger at: document
Option 2, you can use service which called with name as secure tunnel services online such as ngrok, burrow.io,...
You can refer document how to use it at: document

Related

How to make Rails 4 work with Apache

I have a rails application that I would like to deploy on a Linux-based cloud hosting running on Apache server.
I have been searching for information online, it seems to me like using Phusion Passenger is an option.
However I have no idea how to set it all up locally and in production. The Linux-based cloud hosting has a cpanel interface. Do I ftp the whole rails folder into the file manager?
Could someone please guide me or point me to a useful guide with step 1, 2, etc. Any help is appreciated. Thank you.
In order to install Passenger on a hosting service you will need SSH access.
If it's shared hosting you will most likely not get SSH, I would recommend www.digitalocean.com they give you full access to your private server.
Here is a guide once you have SSH access:
https://library.linode.com/frameworks/ruby-on-rails-apache/ubuntu-10.04-lucid

Setting up Rails on Hostmonster

I'm able to run rails s through ssh successfully and see the app start up just as it does on my own machine but I'm unable to access the app from the web. The app is directly under the home folder and I have a symbolic link pointing from public_html to the public folder of my rails app, just as this tutorial explains. I even tried setting up a subdomain and every other step in the tutorial to no avail. Any help would be highly appreciated.
You need an application server like Phusion Passenger, Unicorn or puma to run a Ruby app in a production environment. Typically, you'll integrate the application server into a web server's (Apache, nginx) environment.
I don't know about your hoster, but if you have root access, then you can probably use any of these application servers.
The built-in server you start by running rails server is only meant for testing purposes on your local machine. It has not been made with security, performance, stability or any other production-environment criteria in mind.

Two Rails apps deployed - How do I change the default App?

I've followed Ryan Bate's guide to deploy two completely different rails apps one one VPS (cost saving, using it for development of small home projects). Link to railscast: http://railscasts.com/episodes/335-deploying-to-a-vps
My issue is: the default application is the one I deployed first, so when I visit the IP address, that is the app which is displayed. How do I configure the server to
Use a subdomain (not sure this is possible using just an IP address)
Change the default app
Had a play around in nginx.conf and read this stack q: NGinx Default public www location?
I can't seem to work it out! Thanks in advance.
I think I understand what you want to do. Your default app term confuses me. Let's throw that out and just say you want to deploy two different rails apps to different domains-- sub or TLD, it doesn't matter. Also, I think you are wanting to deploy them to the same VPS server. Ryan's screencast doesn't include how to do this.
What you are probably looking for is how to host multiple sites (and rails apps) with nginx. Like Ryan's screencast, there are many steps involved to get everything working. I recommend you first focus on domain setup (DNS), then nginx setup. Leaving serving your rails app with unicorn for last.
First
Setup your domain and subdomain to point to the VPS. One way is to create DNS A records point to your VPS IP.
Second
Configure nginx to serve both sites. To get you started in the right direction I recommend you read this: multiple websites on nginx & sites-available. It sounds like you already have nginx serving your app on your domain. So steps might be like:
$ cd /etc/nginx/sites-available/
$ cp default subdomain.example.com
Edit subdomain.example.com accordingly. See nginx docs for details. Also, make sure /sites-available/default and /sites-available/subdomain.example.com are not using _ as server_name directive. Set them to their respective domain names. Also, for now point the root to somewhere that will serve an index.html file (ie. leave rails out of it for now)
$ cd /etc/nginx/sites-enabled/
$ ln -s ../sites-available/eden.jrutherford.com .
$ service nginx restart
If all is well by this point you should be able to visit both domains in a browser and have nginx serve content.
Third
Configure a new unicorn for your subdomain. I'm sorry I don't have specific tips for this step . Follow Ryan's tutorial, search google, unicorn website.
Good Luck.

Mac OS X + Rails 3.1 + Unicorn + HTTPS

Here is my setup:
Mac OS X 10.6
Ruby 1.8.7
Rails 3.1
I have a Rails 3.1 application that starts with Unicorn every time this machine starts up (via a .plist in /Library/LaunchDaemons). The .plist essentially does this:
cd /my_application_directory
sudo unicorn -E production -p 80
And everything's working fine. However, I'd like to be able to set up SSL so that traffic is encrypted. I don't need a real certificate signed by a real CA, because the application is only accessible over a local network.
I've found articles like this one on generating certs, but I'm not sure where to go from there (or even if that's the correct starting place).
For my basic needs, I've found the .plist method to be much easier to work with than something like Phusion Passenger, so I'd like to continue doing it that way if possible.
Any help would be greatly appreciated!
I don't believe Unicorn supports being an SSL endpoint, so you're going to need another process to decrypt/encrypt the traffic for you.
On Mac, it's probably easiest to use apache, because it's already installed.
Sorry to not have detailed steps, but you're looking to do the following:
Change the port unicorn listens on, to prevent conflicts with apache.
Set up Apache to serve SSL, just like your linked reference.
Also set up apache to proxy requests to be handled by Unicorn, on the new port you setup. This involves the ProxyPass (and possibly ProxyPassReverse) directive.
Configure apache to start when the Mac boots.

Deploy Ruby on Rails - Development Environment

I'm developing an small application on RoR and OSX 10.6.4 workstation, and I'm looking for guidance on two things: -
How to share my application locally with others so others in my team can get access to my local webserver (Mongrel?) to view/play with my system before I release it into production. From my default installation I can play with it both others can't seem to access it - not even from say http://:3000, which works from local - so I'm a bit confused.
Advice on how best to deploy it onto a production webserver assuming I deploy onto Linux. What webserver should I use and are there instructions?
Thanks in advance. Networking and webservers are NOT a strong suite :-)
Cheers
B
The development Mongrel is by default only accessible through localhost. In order to be visible from the outside you need to ask it to bind to your external IP address. Assuming your IP address is 10.0.0.5, you need to do this:
script/server -b 10.0.0.5
For deployment on Linux, the easiest way is perhaps using Passenger, and either Apache or nginx for a web server, whichever you're most comfortable with (if you have no preference, go with Apache). Documentation can be found here.
Why can't others access it via http://your.ip:3000/? ./script/server mongrel listens on 0.0.0.0 by default. 0.0.0.0 stands for listening on every interface in Linux.

Resources