How to Deploy Ruby On Rails Applications To Cloud VPS Servers

If you’ve outgrown Heroku’s “free” rate, it’s likely that you’ll Free trial vps 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 Marine, Linode, etc) who have now started 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. It’s actually very easy.

99% Software…

The most important thing to remember with this is that to set up an HTTP (“web”) server, you 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.

Every time you “ping” a system, or perform any sort 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 a few ways : firewall software (which is now constructed into 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 on-line : delivered through port 80 (or 443 if using SSL). ANY “HTTP” empowered computer system essentially “opens” a certain folder to the Internet, making it accessible via port 80 of the TCP/IP protocol. This is completed “HTTP” (“Web”) server software.

To run a “web server”, you basically desire a computer that’s linked with the “Internet”, has a publicly accessible IP address and is able to accept inward bound desires via the HTTP protocol on either port 80 or 443.

This is the starts 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 desire a website address : just use your public IP. Urls are provided by ICANN as a way to make it much easier to access web servers : what most don’t know is that a “domain” name simply channels 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 facilities required to keep a server running & operational. “Shared” hosting is simply 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 those 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” website online, if you want something more exotic, you’re at a loss. Specifically, Rails and the likes of NodeJS or other “new” technologies (which require deeper OPERATING-SYSTEM integration for their dependencies).

The answer to this (for now) is to set up your own VPS servers. These allow you maximum control over the greatest the server works, and also gives you direct access to the underlying computer (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 and 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 in the first place. You also need to use an computer which is widely supported and not going to add unnecessary expense. Use Linux. You’re never going to look at the server once you have set it up, so a costly Windows permission won’t matter anyway. Ubuntu is currently the most popular Linux variant. Whilst make use of others, we just recommend Ubuntu in the interests of compatibility.

Install NGinx/Apache
Next, you need to install the web server software. This is exactly what will open port 80 (or 443) to the world, and let visitors to get connected to the server with their browser. It must be noted you will also need to install the “application server” with the web server, which typically comes included together 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 been 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 should allow you to push to it.

Push The Request & Get Any Extras Set up
Next, you need to ensure that you are able to push the request 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 many “hosting” providers out there.

Leave a Reply

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