Skip to main content

Deploy Ruby on Rails on Hostim.dev

This guide shows how to deploy a Ruby on Rails app on Hostim.dev from a Git repository.

Quick start: Use the "Ruby on Rails Demo" template to skip the setup.

πŸ‘‰ Open the Console Click "+ New Project", pick Ruby on Rails Demo, and you're good to go.

Want to customize or start fresh? This guide walks you through the manual setup.


0. Create a Project​

Before deploying, create a new project:

  1. Go to your Hostim.dev dashboard
  2. Click Create Project
  3. Choose from:
    • Scratch: start empty
    • Template: use a prebuilt stack like Ruby on Rails Demo
    • Docker Compose: paste your own Compose file
  4. For this guide, choose Scratch
  5. Name your project (e.g. rails-demo) and click Create Project

1. Use the Example Rails App​

We'll deploy a real Rails app from our public repository:

πŸ”— https://github.com/hostimdev/demo-rails

You only need to clone the code if you want to run it locally or check out how it works. In that case, follow the instructions in the project's README:

🐳 This project already includes a working Dockerfile and is ready to deploy out of the box.


2. Deploy on Hostim.dev​

⚠️ Order Matters: To ensure the app works correctly, create services in this order: Volume β†’ Database β†’ Redis β†’ App.


2.1. Create a Volume for File Uploads​

  1. From your project dashboard, click Create Service β†’ New Volume
  2. Name your volume (e.g., uploads)
  3. Choose a plan
  4. Click Create Volume

2.2. Add a MySQL Database​

  1. From your project dashboard, click Create Service β†’ New MySQL
  2. Name your database (e.g., db)
  3. Choose a plan
  4. Click Create MySQL

2.3. Add a Redis Instance​

  1. From your project dashboard, click Create Service β†’ New Redis
  2. Name your Redis instance (e.g., redis)
  3. Choose a plan
  4. Click Create Redis

2.4. Create the Rails App​

  1. From your project dashboard, click Create Service β†’ New App
  2. Choose Git as the deployment type
  3. Use the GitHub URL: https://github.com/hostimdev/demo-rails
  4. Set the branch to main
  5. Leave Dockerfile path as Dockerfile
  6. Choose a plan and number of replicas
  7. Under Volume Mounts, click Attach Volume
    • Select the volume you created (e.g., uploads)
    • Set mount path to /rails/public/uploads
  8. Check "Does this app have HTTP Service?"
  9. Set the HTTP Port to 3000
  10. Check "Is this app public?" (or leave unchecked for private access)
  11. Click Create App

2.5. Configure Environment Variables​

  1. Open your app in the dashboard
  2. Go to the Envs tab
  3. Add the following environment variables:
RAILS_ENV=development
DATABASE_HOST=$(DB_MYSQL_HOST)
DATABASE_USERNAME=$(DB_MYSQL_USER)
DATABASE_PASSWORD=$(DB_MYSQL_PASSWORD)
DATABASE_NAME=$(DB_MYSQL_DATABASE)
REDIS_URL=redis://$(REDIS_REDIS_HOST):$(REDIS_REDIS_PORT)

These pull in values automatically from the other services you set up.

VariableDescription
DATABASE_*Populated from the MySQL service
REDIS_URLPopulated from the Redis service
RAILS_ENVSet manually to development

Click Save Changes when done.


βœ… Next Steps​