Ruby On Rails Tutorial
Ruby And Rails Vps Deployment Tutorial
Ruby on Rails is best run on a VPS server (if you do not need to use the likes of Heroku) - usually hosted on one amongst the varied "cloud" suppliers. while this can be pretty normal (and comparatively straightforward to line up), what is not straightforward is that the approach during which you've got to line up the software package running on the varied VPS boxes you'll have.
The truth is that the bulk of putting in place a VPS server for the likes of Rails is software package central - that means that the underlying "VPS" continues to be identical notwithstanding that setup you finish up mistreatment.
This is why it's known as a "stack" - you are primarily putting in varied "layers" of the system, from the OS to the underlying libraries to the online server etc.
If you are inquisitive about obtaining your Ruby on Rails application uploaded and running on a "cloud" VPS, you will be best placed to seem at the varied items of *software* you will need to induce it running. this could be exhausted variety of various ways in which, however the underlying necessities area unit still identical. This tutorial goes to clarify a way to copulate...
What's needed to induce A Rails-Powered VPS Running
The most vital factor is to understand that this "stack" exists on *ALL* systems - in spite of the OS or no matter.
The specific software package stack you need is as follows:
Operating System (Linux or Windows)
System Libraries (OpenSSL, GIT, etc)
Language Interpreters (Ruby/PHP etc)
Software Packages (Web Server etc)
GIT Repo's + Server Config
The point here is that the on top of represents the everyday "stack" needed to induce any net server on-line. net servers area unit ALL identical - they're standardized systems designed to supply users with the flexibility to "publish" hypertext mark-up language pages on the online.
The only distinction - and this can be particularly pertinent with Rails - is that you just want what is called "application" server software package - that represents the "processing" of dynamic requests. For Rails, this can be usually "Passenger" however catamount is additionally applicable.
To understand however this works, i will in short make a case for the steps needed to induce it all operating...
Installing the varied software package Packages
As mentioned, ninety nine of the duty is putting in the various packages.
To do this, you primarily let the host started the server either through their net primarily based interface, or through the API. The API is just extremely for third party apps, therefore it's in all probability not reaching to be one thing you will be involved with.
The point is that everything then is up to you. Here's however you are doing it...
SSH Access
The first factor you would like to is gain SSH access to the box. this can be done usually through the provider's net service (Digital Ocean features a "console" application program as an example.This will provide you with direct access to the server, and you must be able to log in mistreatment the "root" username (delivered via email).
Create "deploy" User
After you gain initial SSH access, you are best removing access for the "root" user (to stop hackers) and alter the port to one thing apart from twenty two. This usually means that you've got to recollect the port - however you would like to form positive that you just area unit able to primarily "block" most of the hacking tries you will get. On prime of this, it's suggested you produce some style of "deploy" user. This primarily permits you to exchange the "root" user and take away reliance on the default settings for the preparation.
Install OS-Level Libraries
After putting in place a "deploy" user, you will then ought to install the varied OS-level libraries which is able to be needed to run the varied applications. These can vary counting on which sort of application you would like to use - however can usually embrace most of identical packages.
Install Programming Languages
Next, you would like to put in the varied programming languages needed by your application. If you are mistreatment Ruby on Rails, this may be Ruby. you'll additionally need NodeJS to assist the system execute the varied Javascript parts of your apps.
Install net Server software package
This will either be Apache or NGinx. each area unit supported on all flavours of UNIX operating system - and you must be able to get them acting on Windows too.
Install "Application" Server software package
After the online server, you'll have to put in the "application" server. this can be the program that turns HTTP requests over to the Ruby interpreter - letting your Rails app to deliver hypertext mark-up language responses. For Rails, this may either be Phusion traveler, or Puma. putting in place either is comparatively difficult, therefore you'll have to seem up a way to copulate.
Set Up the varied Domains within the Server Config Files
Both NGinx & Apache operate a "virtual host" system - whereby you are able to "split" the server amongst totally different domains / apps. By setting them within the config files, you are able to work out specifically that apps you are hosting on your servers.
Set up dirty dog Repo's
Finally, you would like to line up {the varied|the varied|the assorted} dirty dog repo's that you just might need for your various apps. while you may use a "File Manager" system - or maybe FTP - to transfer files directly, dirty dog is much simpler at handling versioned uploads.
By doing all of the on top of, you will be able to get your applications deployed to your own VPS servers. while not complete, the on top of is pretty-much what you would like to induce it all operating.
No comments