May 30, 2021

How to Deploy Ruby On Rails Applications To Cloud VPS Servers

If you’ve outgrown Heroku’s “free” collection, it’s likely that Free trial vps you’ll want to examine the various ways you’re able to create a private VPS to run any Rails apps you may have.

In order to do this, you should really be looking at the various “cloud” hosting providers (such as Digital Sea, Linode, etc) who have now begun to offer inexpensive VPS hosting onto which you’re able to deploy custom web based applications.

Since Rails is one of the cornerstones of modern web development, it’s important to consider how to set up a private server to run it. That it is fairly simple.

99% Software…

The most important thing to remember with this is that to set up an HTTP (“web”) server, you merely require SOFTWARE to get it working.

The “web” works off the back of TCP/IP (the underlying “protocol” for the “Internet”) — which basically says that if you know the “public” IP address of a computer system, TCP/IP gives you the ability to attempt to “connect” to it.

Any time you “ping” a system, or perform any type of “handshaking”, it’s done through TCP/IP. This works in both a LAN (Local Area Network) and WAN (Wide Area Network) capacity, providing users with the ability to “connect” to other devices that are “connected” to the Internet.

The problem with TCP/IP is that whilst every system that’s “online” can be “pinged”, it cannot be accessed. TCP/IP uses “ports” which basically allow for particular data to be transferred in some ways — firewall software (which is now built in most operating systems) block access to most ports, to prevent hacking.

The part where HTTP (Hyper Text Transfer Protocol) plays here is that it allows for a “public” set of connection — delivered through port 80 (or 443 if using SSL). ANY “HTTP” allowed computer system essentially “opens” a certain folder to the Internet, making it accessible via port 80 of the TCP/IP protocol. This is carried out with “HTTP” (“Web”) server software.

To run a “web server”, you basically require a computer that’s linked to the “Internet”, has a freely accessible IP address and is able to accept newly arriving asks via the HTTP protocol on either port 80 or 443.

This is the inception of how you set up a custom VPS server…

Servers Are a Dime-A-Dozen

Thus, anyone with an Internet connection, computer and HTTP server software (NGinx/Apache) can setup a web server.

You don’t even require a url of your website — just use your public IP. Website names are given by ICANN as a way to make it safer to access web servers — what most don’t know is that a “domain” name simply avenues a request to particular IP address. It’s still incumbent on the domain owner & website developer to make that IP accessible to “web” traffic (port 80/443).

The point is that what you pay for “hosting” is really the structure required to keep a server running & in business. “Shared” hosting is actually the ability to buy a “user account” on a HUGE server (used by 1, 000’s of websites), whereby the “hosting company” will pay for the electricity, maintenance and support to ensure maximum uptime.

The problem for most people is that whilst “shared” hosting is a great way to get a simple “WordPress” web page, if you want some thing exotic, you’re at a loss. Specifically, Rails and the likes of NodeJS or other “new” technologies (which require deeper OS IN THIS HANDSET integration for their dependencies).

The answer to this (for now) is to set up your own VPS servers. These allow you maximum control over just how the server works, and also gives you direct access to the underlying os (which means you’re able to add as many dependencies as you want).

To do this, however, takes some setting up. This is done by firstly understanding the core settings or components required to get the server running & online. The following steps will explain how to do this.

Setting up a Server

VPS Running Ubuntu
The first step is to get a VPS instance. As mentioned, the best providers of these are the new “cloud” systems such as Vultr, DigitalOcean, AWS, etc. Don’t worry about paying huge money for this — $5/mo is perfect to begin with. You also need to use an os which is widely supported and not going to add unnecessary expense. Use Linux. You’re never going to look at the server get ess arrange it, so a costly Windows licence won’t matter anyway. Ubuntu is currently the most popular Linux variant. Whilst you could utilize others, we just recommend Ubuntu for the health of compatibility.

Install NGinx/Apache
Next, you need to install the web server software. It’s this that will open port 80 (or 443) to the world, and invite individuals to hook up to the server with their internet browser. It must be noted that you’re going to also need to install the “application server” with the web server, which typically comes enclosed as you package. Both NGinx & Apache have their respective methods of achieving this, which are available on their websites.

Install Ruby & RubyGems
After you have installed the web server, you need to get Ruby/RubyGems installed. Whilst there are a number of ways to do this, the underlying basis is to build Ruby from source (which requires the build tools) and to install RubyGems on top of it.

Get GIT Set up
The way you get a Rails application onto the server has GIT. To get this set up, you need to first download the GIT application (which is done through apt-get), and then add a custom (“bare”) GIT repository on the server. You then need to set up your local repository to handle the GIT remote repo, which will allow you to push to it.

Push The Iphone app & Get Any Extras Set up
Following this, you need to ensure that you are able to push the iphone app to the server via GIT, and then add any extras (such as a database etc). Obviously, how you do this will be dependent on the “stack” setup that you have.
Ultimately, the process is actually quite mundane, and exactly the same as the numerous “hosting” providers out there.

Leave a Reply

Your email address will not be published. Required fields are marked *