Skip to main content

Ruby On Rails

Installing Ruby

Edgegap offers you a very intuitive platform to deploy a serverless web application wherever you need it. For this tutorial, we will go over the steps to deploy a Ruby on Rails. Before checking for anything else, make sure you have Ruby installed.

If you’re running on a Linux/UNIX machine, you can use the pre-installed package manager on your machine and install Ruby through your terminal. You can refer to Ruby’s official documentation to find the precise command that corresponds to your Linux/UNIX distribution.

On Windows machines, you will have to download RubyInstaller to get Ruby.

At the end of the installation, you can check Ruby is installed properly with the following command:

ruby -v

Now with Ruby installed, you will obviously have to install Rails. This is rather straightforward and can be done with this single command:

gem install rails

You can easily confirm that Rails was installed correctly in a similar way as what we used to verify Ruby’s installation.

rails -v


To follow this tutorial, you will need to have the following besides Ruby and Ruby on Rails:

Getting Started with Ruby on Rails

To get started with ruby on rails, you will have to create a folder for your new project and run the following command on it:

rails new edgegap-ruby-rails-demo 

Once the process finishes installing, you will have to modify your routes.rb file, which you will find in the config folder. Your routes file should contain the following:

Rails.application.routes.draw do
root 'hello_world#index'

You may notice there is no ‘hello_world’ page in your project in the ‘views’ folder. You can easily generate it with its corresponding controller. First, make sure you’re in the folder Rails generated for you when you ran the rails new command.

If you’re using a Linux distribution, use the following command to create the HelloWorld controller:

rails generate controller HelloWorld index --skip-routes

The skip-routes option ensures this command won’t generate a new route to this controller, which is what we want since we already created one manually.

For windows, you will have to add some keywords to your command as follows:

ruby bin/rails generate controller HelloWorld index –skip-routes

Once the command executes successfully, you will see the HelloWorld page in the ‘views’ folder. You may have to correct the HTML syntax to get a proper section before you deploy it. The file should look like this: hello-world-page

The only step left to do to finish your project is deploying your Ruby on Rails app locally. Once again, the command to do so varies between Linux and Windows as follows:


rails server


ruby bin/rails server

Containerize your application

Containerizing most applications is straightforward. You must create a Dockerfile and then run that file on Docker to create the image. Visual Studio Code is a good platform to create your Dockerfile since, by default, it does not put an extension to every new file that we create. That is exactly what we need. Simply create a new file and name it Dockerfile. You will see the little docker logo appear next to it. Now, you can copy and paste this script into it to get the main dependencies. The image this dockerfile will create is around 700 MB. Of course, you can optimize it, but a container this size will run very smoothly on Edgegap:

FROM ruby:3-alpine
COPY . .
RUN apk add --no-cache build-base tzdata nodejs yarn sqlite-dev postgresql-dev mysql-dev
RUN gem install bundler
RUN bundle install
ENV RAILS_ENV=production
RUN bundle exec rails assets:precompile
CMD ["rails", "server", "-b", ""]

After saving your Dockerfile, it is time to create the image. You can easily do so by running the following command:


For ARM CPU (Mac M1, M2, etc.) user, see the dedicated page : ARM CPU

docker build . -t <YOUR_DOCKER_USERNAME>/ruby-rails-demo:<YOUR_VERSION_NUMBER> 

It is preferable you put a version number following semantic versioning, but if you don’t plan on updating your build on Edgegap after your first deployment, you can omit the version number entirely. But before that, you need to push your newly created docker image to the image repository of your choice. Remember that we offer private repositories through Harbor that offer you a series of security advantages you would not necessarily have by using the default Docker repository. To push your image to our repository, you will have to first log in with your credentials by using this command:


Now, the only thing left is to push your image like this:


Great! Now, you are only one step away from deploying your Nuxt app on Edgegap’s platform.

Deploy your application on Edgegap

There are two ways of deploying an application on Arbitrium. For both, you will need to have an account with us, which you can create for free by clicking the link right here. First, let’s go over on how to deploy our containerized application through our website.

Deploying an application through Arbitrium’s dashboard

You will have to head over to the Edgegap Platform website and enter your credentials. Once you do so, you will be automatically redirected to your dashboard. If you have just created your account, you will see an option to launch your first application right away. If not, simply head to the “Applications & Games” tab on the menu on the left of your screen. You will see an option to create a new application on the right corner:

app creation buton

Once you click on it, the following form should appear: app creation form

You should fill all the required fields and, once you’re done, there is a few things you will need to modify from the defaults:

  • Port number: This application needs to have port 3000 open, so please add it in the “ports” section of the creation form. Uncheck the option to verify the port.

Once you’ve finished filling out the form with the adequate information, you simply must submit it, and you will be ready for deployment. Simply select the region and the number of players you wish to emulate.

Once you’ve finished filling out the form with the adequate information, you simply must submit it, and you will be ready for deployment. Simply select the region and the number of players you wish to emulate.

deployment form

Once you confirm your choices, your application will be online shortly. Here’s what you will see once it’s been deployed. You can access it yourself by clicking on the icon we’ve circled in this image.

deployment dashboard

This will open a new tab where you will find the default landing page of your Nuxt application.

Deploying an application through Arbitrium’s API

While our web dashboard is the most user-friendly way of deploying an application, you can also do so through a very simple API request. For this, you can either use postman or download our custom CLI interface through our dashboard. Even without our CLI environment, it is important you visit the dashboard to create an API token through the options on your profile.

Once you have the API token in your hands, the only thing left to do is formulate a deployment request with your application name, its version, the IP addresses, the region you want to make your deployment in and, of course, your token as part of the authorization parameters. You can see what a full request looks like on our documentation here.

Once you send the request, you should see a response on your command line or on Postman should look like this:

api response

That is all you must do to deploy an application through a CLI. To confirm your app was deployed, you can head over to the dashboard again and see your active deployment at work by clicking on the “Active deployments” tab.