Ruby on Rails
Ruby on Rails
by DigitalOcean

VERSION 4.2.10

OS Ubuntu 18.04

Create Ruby on Rails Droplet

Description

A web-application framework that includes everything needed to create a database-backed web application according to the Model-View-Controller (MVC) pattern.

Software Included

PackageVersionLicense
Ruby2.5.12-clause BSD License
Rails4.2.10MIT
Puma2.2Custom
Postgres10Postgres SQL
Nginx1.14.0Custom
Node.js8.10.0Custom
Postfix3.3.0IBM Public
Certbot0.23.0Apache 2

Getting started after deploying Ruby on Rails

In addition to the package installation, the One-Click also:

  • Enables the UFW firewall to allow only SSH (port 22, rate limited), HTTP (port 80), and HTTPS (port 443) access.

  • Creates a rails system user which deploys the application.

  • Creates a rails database user which the application uses to connect to PostgreSQL.

  • Configures Ruby to use vendored bundles and installs all Gems and processes locally to the rails user.

  • Configures Nginx to forward requests to a local UNIX socket, acting as a reverse proxy for the application server.

After you create a Ruby on Rails One-Click Droplet:

  • You can view the Rails site by visiting the Droplet’s IP address in your web browser. It takes a moment for the installation to complete, so if it doesn’t appear immediately, wait a minute and reload the page.

  • The message of the day (MOTD) will show the system and database user passwords, which are also saved in /root/.digitalocean.passwords.

  • The MOTD will also show you SFTP credentials that you can use to upload files using software like FileZilla, WinSCP, or rsync.

  • The unit file for Rails is /etc/systemd/system/rails/service.

To manage the Rails site, log into the Droplet via SSH as root using either the password emailed to you or with an SSH key, if you added one during creation.

The application server, Puma, is managed by Systemd, so you can use the systemctl command to start, stop, restart, and check the status of Puma. For example, systemctl restart rails.service will restart it.

Because Ruby will be configured to use vendored bundles, use the rails user to interact with the default project via sudo -i -u rails.

API Creation

In addition to creating a Droplet from the Ruby on Rails 1-Click App via the control panel, you can also use the DigitalOcean API.

As an example, to create a 4GB Ruby on Rails Droplet in the SFO2 region, you can use the following curl command. You’ll need to either save your API access token to an environment variable or substitute it into the command below.


  curl -X POST -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer '$TOKEN'' -d \
      '{"name":"choose_a_name","region":"sfo2","size":"s-2vcpu-4gb","image":"rails-18-04"}' \
      "https://api.digitalocean.com/v2/droplets"
      

Support Details

Supported By:DigitalOceanDigitalOcean

Learn More

Product Docs

Technical overviews, how-tos, release notes, and support material

Tutorials

DevOps and development guidelines

API Docs

Run your resources programmatically

Ask a question

Connect, share and learn