Ruby on Rails is best run on a VPS server (if you don’t ambition to use the brand of Heroku) – about hosted on one of the assorted “cloud” providers. Whilst this is appealing accepted (and almost simple to set up), what isn’t simple is the way in which you accept to set up the software active on the assorted VPS boxes you may have.
The accuracy is that the majority of ambience up a VPS server for the brand of Rails is software axial – acceptation that the basal “VPS” is still the aforementioned no amount which bureaucracy you end up using.
This is why it’s alleged a “stack” – you’re basically installing assorted “layers” of the system, from the OS to the basal libraries to the web server & GIT etc.
If you’re absorbed in accepting your Ruby on Rails appliance uploaded and active on a “cloud” VPS, you’ll be best placed to attending at the assorted pieces of *software* you’ll crave to get it running. This can be done in a amount of altered ways, but the basal essentials are still the same. This tutorial is traveling to explain how to do it…
What’s Appropriate To Get A Rails-Powered VPS Running
The a lot of important affair is to acknowledge that this “stack” exists on *ALL* systems – behindhand of the operating arrangement or whatever.
The specific software assemblage you crave 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 actuality is that the aloft represents the archetypal “stack” appropriate to get any web server online. Web servers are ALL the aforementioned – they are connected systems brash to accommodate users with the adeptness to “publish” HTML pages on the web.
The alone aberration – and this is abnormally pertinent with Rails – is that you charge what’s accepted as “application” server software – which represents the “processing” of activating requests. For Rails, this is about “Passenger” but Puma is aswell applicable.
To accept how this works, I’ll briefly explain the accomplish appropriate to get it all working…
Installing The Assorted Software Packages
As mentioned, 99% of the job is installing the altered packages.
To do this, you basically let the host set up the server either through their web based interface, or through the API. The API is alone absolutely for third affair apps, so it’s apparently not traveling to be something you’ll be anxious with.
The point is that aggregate after that is up to you. Here’s how you do it…
- SSH Access
The aboriginal affair you charge to is accretion SSH admission to the box. This is done about through the provider’s web account (Digital Ocean has a “console” applet for example.This will accord you absolute admission to the server, and you should be able to log in appliance the “root” username (& countersign delivered via email).
- Create “deploy” User
After you accretion antecedent SSH access, you’re best removing admission for the “root” user (to anticipate hackers) and change the anchorage to something added than 22. This about agency you accept to bethink the anchorage – but you charge to accomplish abiding that you are able to about “block” a lot of of the hacking attempts you’ll get. On top of this, it’s brash you actualize some array of “deploy” user. This basically allows you to alter the “root” user and abolish assurance on the absence settings for the deployment.
- Install OS-Level Libraries
After ambience up a “deploy” user, you’ll again charge to install the assorted OS-level libraries which will be appropriate to run the assorted applications. These will alter depending on which blazon of appliance you ambition to use – but will about cover a lot of of the aforementioned packages.
- Install Programming Languages
- Install Web Server Software
This will either be Apache or NGinx. Both are accurate on all flavours of Linux – and you should be able to get them alive on Windows too.
- Install “Application” Server Software
After the web server, you’ll charge to install the “application” server. This is the affairs which turns HTTP requests over to the Ruby analyst – acceptance for your Rails app to bear HTML responses. For Rails, this will either be Phusion Passenger, or Puma. Ambience up either is almost complicated, so you’ll charge to attending up how to do it.
- Set Up The Assorted Domains In The Server Config Files
Both NGinx & Apache accomplish a “virtual host” arrangement – whereby you’re able to “split” the server amidst altered domains / apps. By ambience them in the config files, you’re able to actuate absolutely which apps you’re hosting on your servers.
- Set up GIT Repo’s
Finally, you charge to set up the assorted GIT repo’s that you may crave for your assorted apps. Whilst you could use a “File Manager” arrangement – or even FTP – to upload files directly, GIT is far added able at administration versioned uploads.
By accomplishing all of the above, you’ll be able to get your applications deployed to your own VPS servers. Whilst not exhaustive, the aloft is pretty-much what you charge to get it all working.
| hosting email