Scaleway Documentationtutorials
ruby on rails instant app

Jump toUpdate content

Getting started with the Ruby on Rails InstantApp

Reviewed on 06 December 2021Published on 28 July 2015
  • compute
  • Ruby
  • Rails
  • apps
  • InstantApp
  • Instance

Ruby on Rails InstantApp - Overview

The intended audience of this image are Rails developers who want to bootstrap or test a Rails application easily, in seconds.

Common packages have been installed into the Ruby InstantApp:

  • Nginx
  • Ruby
  • RVM
  • Rails
  • Unicorn
  • Node.js
Requirements:

Create and start a new instance using the Ruby on Rails InstantApp

  1. Click Instances in the Compute section of the Scaleway console.

  2. Click ”+ Create an Instance”. The instance creation wizard displays.

  3. Enter your Instance details and select the Ruby on Rails image in the InstantApps tab.

  4. Click Create an Instance at the bottom of the page. This action starts your Instance.

Run a Ruby on Rails web application

  1. Log into your Instance with the following command:
$> ssh -i /path/to/key root@<your_server_ip>
  1. Once connected to the Instance, log-in as rails user:
$> su rails
$> source /etc/profile

In the home directory of rails user /home/rails, you will find the default directory containing a fresh rails application. You can use it to bootstrap your rails project.

Tip:

Unicorn is configured to serve the default Rails application in /home/rails/default.

You can access the Rails application via your browser at http://your_Instance_ip to view the default app website.

Create a new Rail application

If you want to create a new Rails application, you will have to use the following commands to get it running with unicorn:

  1. Create the new application by running the following command:

    $> rails new yourapplicationname
  2. Generate the SECRET_KEY_BASE with the following command:

    $> rake -f /home/rails/yourapplicationame/Rakefile secret
  3. Open the file /etc/default/unicorn to change the working directory and SECRET_KEY_BASE.

  4. Set application working directory to APP_ROOT=/home/rails/yourapplicationame and SECRET_KEY_BASE value to the key generated previously.

  5. Open the file /etc/unicorn.conf and change the working_directory value to /home/rails/yourapplicationame.

  6. Restart Unicorn as root user, open your browser and visit your IP to view your new application.

    $> service unicorn restart

Conclusion

Useful links:

This image does not contain databases, allowing you instead to install the database of your choice.

To install MySQL, run:

$> apt-get install mysql-server

And/or PostgreSQL:

$> apt-get install postgresql

Suggestions

If you think something is missing in this image, or if it would have been easier if you had this or that tool, or if this <whatever> should be configured. that way instead of how it currently is, we’d love to hear from you!