Containerize a Rails 7 App and Run it on Vultr with Cloud 66

Cloud 66
8 min readApr 28, 2023


To celebrate a 3-year integration anniversary between Cloud 66 and Vultr we’re showcasing some of the changes and improvements that we have implemented in both of our platforms. To show how well our platforms work together, we’re taking a Rails 7 application sample and walking you through how to containerize and deploy that application on Vultr with Cloud 66.

Introducing Vultr and Cloud 66

Vultr is a cloud hosting provider that offers fast and scalable cloud infrastructure to businesses and developers worldwide. With 30 data centers located around the globe, their cloud servers are powered by the latest generation Intel CPUs and SSDs, ensuring high I/O performance. Vultr provides flexible pricing options, customizable server configurations, and a variety of operating systems to meet different needs.

Cloud 66 simplifies DevOps by giving developers everything they need to build, deploy, and maintain applications on any cloud or server, without worrying about the “server stuff.” The platform offers full support for databases, custom traffic rules, zero-downtime deployments, blue/green and canary releases, and a web application firewall (WAF), among other features

Both Cloud 66 and Vultr believe in empowering developers and businesses by simplifying the deployment of infrastructure. Vultr, by offering its advanced cloud platform, and Cloud 66, by offering a reliable and flexible application deployment and management platform. In a nutshell, we are developers who are building tools for fellow developers to make running applications easier.

What’s new at Vultr and Cloud 66

  • Cloud 66 now natively supports the latest Vultr API, and correspondingly has additional regions and sizes (plans) available!
  • Vultr has expanded its reach to new regions, which are fully supported on Cloud 66 e.g. India, Japan, Africa, and Latin America — with more locations on the way.
  • Vultr recently earned certification from the prestigious MACH Alliance, a global consortium of companies and organizations dedicated to promoting open standards, interoperability, and vendor choice in the technology industry.
  • Deploying new production code to Kubernetes clusters is a hands-off experience. Cloud 66 is pre-configuring to deploy and manage clusters on Vultr, which saves developers time and effort when managing and scaling their applications.
  • Cloud 66 introduced easy deployments for static site builders (Jamstack) with automated SSL certificates, a powerful traffic routing engine, multiple domains with apex support, and unlimited team members.
  • Cloud 66 added new database features, supporting multiple logical databases on the same server (or cluster) and custom database users.
  • Deploy on Vultr with Cloud 66, and take advantage of zero-downtime deployments, serial or parallel deployments, Blue/Green or Canary releases. Plus deploy multiple apps simultaneously, for even greater efficiency.

Before you get started

To follow this guide you’ll need:

  • Docker and Docker Compose installed on your development machine
  • MySQL and Redis installed locally
  • A Rails application (or you can use our sample)
  • A Vultr account
  • A Cloud 66 account

Our Existing Rails 7 Application:

For purpose of this blog post, we will use a Cloud 66 Rails sample.

Tickerizer is an open-source project maintained by Cloud 66, that can be used as a stock price dashboard and hosted anywhere. It shows stock prices and updates them in real time. By default, it uses fake data, but you can connect it to a free Vantage Alpha account for real data.

Tickerizer uses Rails 7 with ES Build, Hotwire, View Components, TailwindCSS, with Redis and MySQL databases, and Lunr. The latest branch has a Dockerfile and Docker Compose configs. Other versions of Tickerizer, can be found under the versions/xxx branches. You can learn how this sample was built here.

Rails 7 Containerization

We’re going to use Tickerizer as an example of how to containerize a Rails application. If you want to see how quick and easy is to deploy on Vultr with Cloud 66, you can skip the ‘Rails 7 Containerization’ part and go to the ‘Deploy on Vultr with Cloud 66" section of this post.

Install Docker and create a Dockerfil

The steps to install Docker depend on the operating system you are using. Check out the documentation for Docker installation:

Once Docker is installed on your machine, create a file named Dockerfile in the root folder of the repo. This file will define the instructions for building the Docker container.

This Dockerfile uses the official Ruby 3.0.6 Docker image on the Bullseye Debian release. We then run the apt-get update and apt-get install commands to install build-essential, Node.js, and npm. We change the working directory to /app and install Bundler version 2.2.6.

We copy the Gemfile, Gemfile.lock, package.json, and yarn.lock files into the image. We install yarn globally and run yarn install to install the packages specified in package.json. We also run bundle lock --add-platform x86_64-linux to ensure that the bundle is locked to the specified platform. Finally, we copy the rest of the files in the current directory into the image and run bundle exec rake assets:precompile to precompile the assets.

FROM ruby:3.0.6-bullseye 

RUN apt-get update -qq && \
apt-get install -y build-essential nodejs npm && \
npm install -g yarn


RUN gem install bundler --version=2.2.6

COPY Gemfile Gemfile.lock ./
COPY package.json yarn.lock ./

RUN yarn install --check-files
RUN bundle lock --add-platform x86_64-linux && bundle install

COPY . .

RUN bundle exec rake assets:precompile

You can find more information on how to write a custom Dockerfile for Rails on our help page.

Create a Docker Compose File

To make the Tickerizer application work locally, we also need MySQL and Redis instances running on our machine. Ideally, we want a Docker Compose file in the repo to start databases alongside the main project so everything works without external dependencies.

version: "3" 
build: .
RAILS_ENV: development
MYSQL_PASSWORD: tickerizer
MYSQL_DATABASE: tickerizer_development
REDIS_URL: redis://redis:6379/1
command: bundle exec rails s -b -p 3000
- "3000:3000"
- db
- redis
- db
- redis
image: redis:alpine
- "6379:6379"
- tickerizer
image: mysql:8.0
- mysql_data:/var/lib/mysql
MYSQL_DATABASE: tickerizer_development
- "3306:3306"
- tickerizer
mysql_data: {}
name: tickerizer_network

In this Docker Compose file, we define three services: web, redis, and db. The web service is built using the build context, and its environment variables are defined with the necessary configuration for the application. We also define a command to start the Rails server with the specified port and bind address, and we expose the port to the host machine.

The redis service uses the redis:alpine image and exposes port 6379. The db service uses the mysql:8.0 image, and we specify a volume to persist the MySQL data. We also define the necessary environment variables for MySQL, and we expose port 3306.

We also define a mysql_data volume and a tickerizer network to allow communication between the services. Finally, we specify that the redis and db services should be started before the web service using the depends_on option.

Build and Run Docker Image

Open a terminal in the project directory and ensure you are in the root of the project (where all the Docker config files should exist). Run the following command to build a Docker image for your application:

docker build -t tickerizer .

This command tells Docker to build an image using the instructions in the Dockerfile in the current directory. The -t flag specifies a name for the image (in our case, tickerizer).

Once the image has been created, you can run the following command to start the Docker container:

docker-compose up

This will start the tickerizer application in development mode with MySQL and Redis services. You should now be able to access the application by visiting http://localhost:3000 in your web browser.

Deploy on Vultr with Cloud 66

Now that our Rails sample is containerized, we can move to the next stage — deployment to Vultr with Cloud 66. Log in to Cloud 66 dashboard, and follow the steps below.

Connect your code repository and Vultr with Cloud 66

  1. Click on the ‘Deploy from GitHub’ button and follow the steps to grant Cloud 66 read-only access to your code.
  2. Select the application repo, Tickerizer, from your Git account.
  3. Choose a branch (rails7-containerized), an environment (production), and give the application a name (My-Containerized-Rails7-App)
  4. Click the ‘Analyze’ button.

Once the analysis is complete, you will see a dashboard with three steps that allow you to configure how your application will be deployed.

If you need to add more images to an application, you can do so under the Images step. You can add pre-built images from an image registry or build new images from code. You can also upload an environment variable file.

Under ‘services’ you can configure networking, storage, and the number of containers you want to run.

Under “servers, databases” — you can configure server sizes and regions and add databases to your application. For the deployment, destination select Vultr from the drop-down and add your Vultr API Key to confirm access. Additionally, you can use a Manifest file to configure advanced deployment options.

Now all you need to do is to click on the ‘Start Deployment’ button. During the build and deployment process, you can view the log to see what’s happening behind the scenes. Or you can close the window and come back later. We will email you once the application is deployed.

Manage your Containerized App

Once your containerized Rails 7 application is shared with the world, you can explore the Cloud 66 dashboard and take advantage of its features:

Additionally, we suggest a few tips on how you can improve the resilience of your application.

  • Application — manage your application services, images, servers, SSL Certificates, Load Balancers, and Traffic rules.
  • Data Source — add and manage a wide selection of popular databases and data stores including Elasticsearch, GlusterFS, InfluxDB, Memcached, MongoDB, MySQL, PostgresSQL, RabbitMQ and Redis. You can also configure and manage automated backups for your databases.
  • Jobs — configure and manage cron-style jobs on your servers and containers. Jobs can be scheduled or run on demand.
  • Live Logs — collects and displays real-time logs that can help you find and eliminate bugs in your Rails app.
  • Networking — set up Firewalls, and App Private Networks.
  • Notification — configure which notifications would you like to receive and via which channels.
  • Settings — contains important application-wide settings like server deletion, server snapshot, and application protection as well as the ability to clone, archive, or transfer the ownership of the application. Additionally, you can manage deployments, environment variables, Application Health Checks, ConfigStore, Application Updates, and Manifest files.

To sum up, building on 3 years of Vultr and Cloud 66 customer success, our partnership provides a reliable and flexible platform for deploying, managing, and hosting any applications, with the greatest global reach and lowest cost-to-performance.

Originally published at



Cloud 66

DevOps-as-a-Service to help developers build, deploy and maintain apps on any Cloud. Sign-up for a free trial by visting: