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
Updateconfig/puma.rb to use port 80:
config/puma.rb
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
Prepare Your Files
Ensure you have:
- All source files (
app/,config/,db/,lib/,public/) bin/folder (contains Rails executables)Gemfile.shardcloud
Upload to Shard Cloud
Go to Shard Cloud Dashboard and upload.
Database Configuration
If your Rails app uses a database, configure it inconfig/database.yml:
config/database.yml
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
Permission denied for bin/rails
Permission denied for bin/rails
The
chmod +x bin/rails in CUSTOM_COMMAND should fix this. Make sure the bin/ folder is included in your ZIP.Dependencies not found
Dependencies not found
- Make sure
Gemfileincludes all required gems - Remove
vendor/bundle/folder before uploading (Shard Cloud will install gems)
Assets not loading
Assets not loading
- 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
Database connection errors
Database connection errors
- Verify
DATABASE_URLenvironment variable is set in dashboard - Ensure
config/database.ymlreads from environment variables
Server not accessible
Server not accessible
- Ensure
-b 0.0.0.0is included to bind to all interfaces - Check that port 80 is configured in
config/puma.rb
