Skip to main content

Introduction

This guide covers deploying Ruby on Rails applications on Shard Cloud. Rails is a full-stack web framework for Ruby that emphasizes convention over configuration and rapid development.

Creating Your Project

Ensure you have Ruby and Rails installed.

Creating a New Rails Project

Basic Application Structure

Your Rails application should have this structure:

Configuring Port 80

Update config/puma.rb to use port 80:
config/puma.rb
Or bind to all interfaces:
config/puma.rb

Shard Cloud Configuration

Create a .shardcloud file:
.shardcloud
The CUSTOM_COMMAND makes the Rails binary executable and starts the server bound to all interfaces.

Deploying

1

Verify Locally

Run bin/rails server to verify your application works locally.
2

Prepare Your Files

Ensure you have:
  • All source files (app/, config/, db/, lib/, public/)
  • bin/ folder (contains Rails executables)
  • Gemfile
  • .shardcloud
3

Exclude Unnecessary Files

Remove:
  • vendor/bundle/
  • .bundle/
  • tmp/
  • log/
  • node_modules/ (if present)
4

Create ZIP Archive

Zip the entire Rails application folder.
5

Upload to Shard Cloud

Go to Shard Cloud Dashboard and upload.

Database Configuration

If your Rails app uses a database, configure it in config/database.yml:
config/database.yml
Set the DATABASE_URL environment variable in your Shard Cloud dashboard.

Running Migrations

You can run migrations by updating your custom command:
.shardcloud

Additional Resources

Visit the official Rails documentation for more information.

Troubleshooting

The chmod +x bin/rails in CUSTOM_COMMAND should fix this. Make sure the bin/ folder is included in your ZIP.
  • Make sure Gemfile includes all required gems
  • Remove vendor/bundle/ folder before uploading (Shard Cloud will install gems)
  • Precompile assets before uploading: bin/rails assets:precompile
  • Or add to CUSTOM_COMMAND: bin/rails assets:precompile && bin/rails server -b 0.0.0.0
  • Verify DATABASE_URL environment variable is set in dashboard
  • Ensure config/database.yml reads from environment variables
  • Ensure -b 0.0.0.0 is included to bind to all interfaces
  • Check that port 80 is configured in config/puma.rb