Developing Ruby on Rails Apps in a Cloud Sandbox

Oct 25, 2023 by Sameer Kulkarni
icon link to Twittericon link to Linkedinicon link to Facebookicon link to Youtube
Developing Ruby on Rails Apps in a Cloud Sandbox

Ruby on Rails, is a web application framework that has revolutionized the way we build modern web applications. It's known for its "convention over configuration" philosophy, which simplifies development tasks and allows programmers to focus on building exceptional features.

Acorn is a cloud computing platform with a big free sandbox that anyone can use by registering with a GitHub account. It is designed to simplify running modern cloud-native apps on the public cloud. You use familiar development and deployment workflows based on mainstream container tools without having to deal with provisioning or configuring any underlying cloud resources. Basically it provides all the power of Kubernetes and Terraform, without any of the complexity.

To deploy an application on Acorn we need to define our application as an Acornfile, which will produce the Acorn Image that we can deploy on the platform. In this tutorial, we will explore how to provision a sample Ruby on Rails Application on Acorn.

If you’re the kind of person who likes to skip to the end, you can deploy the sample application in your sandbox now and just start poking around in it. Sandbox deployments in Acorn are restricted by size, and run for two hours, so it should provide plenty of time for you to evaluate and test anything. You can start them over as often as you like, or you can upgrade to a paid Pro account if you want to run something in production.

If you want to follow along, I’ll walk through the steps to deploy the sample Articles App using Acorn, described in the Ruby on Rails official documentation.

Note: Everything shown in this tutorial can be found in this repository.


  • Acorn CLI
  • Github account to sign up for the Acorn Platform.

Acorn Login

Login to the Acorn Platform using the Github Sign-In option with your Github user.


After the installation of Acorn CLI for your OS, you can login to the Acorn platform.


Create the RoR Application

In this post we will create a simple RoR Articles app from the official documentation. It is a simple Articles application that provides standard CRUD features to manage your blog posts.

In the Acorn platform, there are two ways you can try this sample application.

  1. Using Acorn platform dashboard.
  2. Using CLI

The First way is the easiest one where, in just a few clicks you can deploy the Articles application on the platform and start using it. However, if you want to customize the application or want to understand how you can run your own RoR applications using Acorn, use the second option.

Running the application using Dashboard

In this option you use the published Acorn application image to deploy the articles sample application in just a few clicks. It allows you to deploy your applications faster without any additional configurations. Let us see below how you can deploy the articles app to the Acorn platform dashboard.

  1. Login to the Acorn Platform using the Github Sign-In option with your Github user.

  2. Select the “Create Acorn” option.

  3. Choose the source for deploying your Acorns 3.1 Select “From Acorn Image” to deploy the sample Application. create-acorn-options-screen 3.2 Provide a name “Ruby on Rails Sample Acorn”, use the default Region and provide the URL for the Acorn image and click Create.

    RoR-App-Deployment-Preview Note: The App will be deployed in the Acorn Sandbox Environment. As the App is provisioned on AcornPlatform in the sandbox environment it will only be available for 2 hrs and after that it will be shutdown. Upgrade to a pro account to keep it running longer.

  4. Once the Acorn is running, you can access it by clicking the Endpoint or the redirect link. 4.1 Running Application on Acorn RoR-App-Deployed 4.2 Running Articles app running-articles-app

Running the Application using acorn CLI

As mentioned previously, running the acorn application using CLI lets you understand the Acornfile. With the CLI option, you can customize the sample app to your requirement or use your Acorn knowledge to run your own Ruby on Rails application.

To run the application using CLI you first need to clone the source code repository on your machine.
Once cloned here’s how the directory structure will look.

<p align="center"><img src="" alt="ror-source-tree" width="300" /></p>

Understanding the Acornfile

We have the sample Rails Application ready. Now to run the application we need an Acornfile which describes the whole application without all of the boilerplate of Kubernetes YAML files. The Acorn CLI is used to build, deploy, and operate Acorn on the Acorn cloud platform. It also can work on any Kubernetes cluster running the open source Acorn Runtime.

Below is the Acornfile for deploying the Articles app that we created earlier.

<p align="center"><img src="" alt="ror-acornfile" width="400" /></p>

There are 2 requirements for running Ruby on Rails Application

  • Application Itself
  • DB

The above Acornfile has the following elements:

  • Services: Here we're using the MariaDB service that is built into Acorn as an Acorn Service.
  • Containers: We define a single container named web and define the following configurations:
    • build: details required to build the Rails Application
    • ports: port number the application is listening on and we are also specifying publish field which will give the url to access the application.
    • env: In the env section we are providing all the env variables which the application will be using . And this env variable will override all the values that you have specified inside the config/database.yaml file.

Running the Application

We have already logged in using Acorn CLI now you can directly deploy applications on your sandbox on the Acorn platform. Run the following command from the root of the directory.

<p align="center"><img src="" alt="acorn_run_ror_cli" width="450" /></p>

Below is what the output would look like.

<p align="center"><img src="" alt="ror-articles-app-dev-mode-run" width="800" /></p>

The Articles Application

As it is a simple Article application it provides CRUD features. Here you can add your Articles.You need to click on New Article and provide Title and Body of Article. Once the article is created it can be edited and if you want to delete it you can use the destroy button.

Once completed you can move it to complete status and If you want to delete it you can delete it using delete button.

<p align="center"><img src="" alt="ror_articles_app_with_article" width="400" /></p>

Running the app in dev mode

If you are developing your application and don't want to start and stop the application everytime you make the changes you can use the incredibly helpful Acorn Dev Mode. Running in dev mode allows you to do continous development of the application, and have your running instance reflect the changes as soon as you save your changes. Run the following command.

<p align="center"><img src="" alt="ror-run-dev-mode" width="450" /></p>

Push an artifact to a registry

Using the Dev mode you can easily modify the application as per your requirement and once the application is working as expected and is ready to be built and packaged, push it to a registry. You can push it to any OCI registry. We will use Github Container Registry in this example. Once published, you can use the acorn image to deploy it directly in the Acorn platform using the dashboard or CLI, as described previously.

Log in to the registry

Log in to the registry with the command below and follow the prompts.

<p align="center"><img src="" alt="acorn_cli_login_ghcr" width="450" /></p>

Build and push the image

Build and push the image with the below command.

<p align="center"><img src="" alt="ror-push-to-ghcr" width="650" /></p>

Once the application is built and pushed you can use those images to run your application on Acorn Platform.

What's Next?

The App is provisioned on Acorn Platform and is available for two hours. Upgrade to Pro account for anything you want to keep running longer. After deploying you can edit the Acorn Application or remove it if no longer needed. Click the Edit option to edit your Acorn's Image. Toggle the Advanced Options switch for additional edit options. Remove the Acorn by selecting the Remove option from your Acorn dashboard.


In this tutorial we show how we can use the Acornfile and get our Rails application up and running and it’s very easy to make changes to the Application file when you are developing it without the need of restarting your application. And If you are looking to run the application directly you can run it on Acorn Platform by providing the image name.

icon link to Twittericon link to Linkedinicon link to Facebookicon link to Youtube