This blog will help you to deploy Ruby on Rails app on VPS. Remember, this is not a free solution, but you can well afford it and can code on Ruby without the paywall drawbacks.
If you are not confident enough to workout these on your own you can always rely on ruby on rails developer India.
It is not necessary to explore the DevOps.
Things you need to do:
- Clone the repository from chef-vps and then follow the instructions from README present there. You need to know the basics of the stand also you need to know how to fire a shell command. If you know these basics, you are good to go!
The goal is to serve multiple applications on a single machine using sub domains. To do this, firstly we need a server and to have a server, you need to buy a VPS. The cheapest VPS according to me is the Digital Ocean. It provides a 5$ per month plan. This should be enough for you to develop a few applications at the start.
When you create your VPS, you can choose an Operating System or OS, which can be a great starting point for your development. If you want your server to run RoR apps, you need to install different tools. You can find all the apps and can install them from chef solo and cook books provided by the chef community.
If you want to run RoR on your server, you need to install many tools:
- Chef solo
- Knife solo
- Librarian chef
Now, Setting up your VPS:
First things first. To begin, the VPS is needed to connect through the ssh.
Suppose we have a VPS. We can connect it through $ ssh vps.com.
The domain name is required as we need to serve applications using sub domains.
To run RoR applications, VPS needs ruby, unicorn etc. Chef solo will help us to install tools.
VPS needs a node under the nodes/directory. The nodes have their own functions and will run accordingly.
- Boot strap(setting up locale, install nodejs, rbenv)
Point to be noted: You need to install gems before you start cooking VPS: $ bundle install.
If you want cook books, you can get it from $ librarian-chef install.
Now the important part. If you want to prepare and cook VPS, run: knife solo bootstrap vps.
Now you have your RoR app ready!
You need to share it now in order to show the world.
To do this, you need to create a role for the application which runs the “rails_app” recipe. The application will be available under the sub domain. You again need to create a node to run the application. To cook this node you need the ssh config.
RAILS Application: You need to add Capistrano and unicorn gems to Gemfile.The next step is to bundle new gems, $ bundle install.
Now create a cap file into the application root folder.
Create config/deploy.rb file and also create a production deployment config file.
You need to add database.yml and secret.ymlto.gitignore as those files are already on VPS.
You are almost done. Deploy your application on VPS finally using $ bundle exec cap production deploy.
These were the solutions for deploying Ruby on the Rails, if you think you are not capable enough of doing the following on your own always go for ruby on rails developer india.