Skip to content

Ruby on Rails

Serv00.com hosting for running applications in Ruby on Rails (and Ruby in general) uses the Phusion Passenger server (minimum Ruby on Rails version required is 2.3). It allows you to set up a separate interpreter for each domain. For Ruby on Rails prepare your own environment with RVM.

Initial configuration

To run a website written in Ruby on Rails, first take care of RVM installation and proper configuration of the domain itself. Before proceeding to the next steps make sure that:

  • The domain is properly added and configured in our DNS system.
  • Website has been added with an indication of the type Ruby.
  • Install Ruby on Rails framework with commands:
gem install nokogiri -- --use-system-libraries --with-iconv-lib=/usr/local/lib --with-iconv-include=/usr/local/include --with-xml2-lib=/usr/local/lib --with-xml2-include=/usr/local/include/libxml2/libxml --with-xslt-lib=/usr/local/lib --with-xslt-include=/usr/local/include/libxslt
gem install rails

Ruby on Rails project

The main directory of the Ruby on Rails project (i.e. the directory where the config.ru file is located) must be /usr/home/LOGIN/domains/DOMAIN/public_ruby. The Ruby on Rails project name does not matter as long as the above directory name is retained. You should also delete /usr/home/LOGIN/domains/DOMAIN/public_ruby/public/index.html file.

New Ruby on Rails project

A new Ruby on Rails project should be created in the directory /usr/home/LOGIN/domains/DOMAIN/public_ruby - the easiest way to create an appropriate project is to issue the following commands:

cd /usr/home/LOGIN/domains/DOMAIN/
rm -rf public_ruby
gem install sqlite3 -- --build-flags --with-sqlite3-include=/usr/local/include --with-sqlite3-lib=/usr/local/lib --with-sqlite3-dir=/usr/local
rails new public_ruby

Existing Ruby on Rails project

Existing project should be placed as directory /usr/home/LOGIN/domains/DOMAIN/public_ruby/. If the project is not named public_ruby its name should be changed. The Phusion Passenger server will automatically detect the new application.

Restart the application

Ruby on Rails application can be restarted using our service management panel in the WWW tab or by using Devil account management system command: devil www restart DOMAIN.

Process limit for Phusion Passenger

Ability to set the number of processes for ruby pages. Command syntax: devil www options DOMAIN processes <QUANTITY>

Where: - DOMAIN - represents a ruby-type web domain - QUANTITY - number of processes in the range from 1 to 80% of system processes of the hosting account

The option is also available in the DevilWEB panel: WWW webpagesManage (with a selected domain) ➡ DetailsNumber of processes ➡ enter a new value and save the changes with the 💾 Save changes button.

Static files

All files located in /usr/home/LOGIN/domains/DOMAIN/public_ruby/public are handled as static files. It is best to put all pictures, scripts, styles, etc. in this directory. Requests to files in this directory will not be processed by Ruby processes and will not burden the interpreter. For example, the file /usr/home/LOGIN/domains/DOMAIN/public_ruby/public/robots.txt will be available at http://DOMAIN/robots.txt.

Logs

Warning

Do not delete the logs directory, it may cause problems with Node.js, Ruby, Python pages.

The error logs are saved to the error.log file in the /usr/home/LOGIN/domains/DOMAIN/logs/ directory.

App lifetime

If there are no requests to the site for 24 hours, the application is automatically shut down and started again automatically on the first next visit. In the event of a change in the website configuration, the application is also automatically shut down and launched the next time the website is accessed for the first time.

External references