In this guide we explain how to create and deploy a Ruby on Rails 4.1 application.
1 - Define the app from the Hosting Panel
1 - Access your Hosting Panel
Just follow instruccions of How to access your Hosting Panel.
2 - Click on Ruby Applications
Look for and click on Ruby Applications icon.
3 - Define the app
Fill in the form and make sure you choose Ruby Hai or Ruby Kon stack:
Once you submit the form you we'll see the app creation result. Remember the application directory as it's important in the next steps.
2 - Install Rails and Bundler gems
Install the 4.1 version on Ruby on Rails:
gem install rails -v 4.1
When installing Rails 4.1 Bundler should have been installed, but if for some reason tBundler has not been installed, run:
gem install bundler
3 - Create the application
In the first step you have defined the application, therefore you should known the it's named and directory.
Suppose that the application's name is myapp and the directory is /home/username/ruby/myapp, run the following to create the application:
cd ruby rm -fr myapp rails new myapp
4 - Edit the Gemfile
Open the default Gemfile:
cd ruby/myapp nano Gemfile
And replace the following line:
#gem 'therubyracer', platforms: :ruby
With this one:
gem 'therubyracer', platforms: :ruby
Note: Yes, we have just uncommented the line.
5 - Install dependencies
Now it's time to install the application dependecies:
cd ruby/myapp bundler install
6 - Restart application
cd ruby/myapp touch tmp/restart.txt
7 - Verify installation
Access your website to verify that previous steps are correct. You should see a Rails error message such as:
8 - Create a Welcome page
rails generate controller welcome index
9 - Customize the Welcome message
Open the view file created in the previous step:
Delete all it's content and add:
10 - Configure routes
We want to show the previous message in the root of the domain. In order to do that, open the config/routes.rb file:
And replace this line:
11 - Restart application