Ruby on Rails
Deploy Ruby on Rails on Galaxy, choose a Ruby version, and configure persistent data.
Galaxy installs your gems, precompiles assets, and starts your Rails app.
Prerequisites
- A Galaxy account
- Your Rails app in a Git repo with a
GemfileandGemfile.lock - A payment method added for identity verification
1. Prepare Your App
- Commit
Gemfile,Gemfile.lock, andbin/railsin the directory Galaxy builds. Includebootsnapin the bundle used for builds so Galaxy can precompile the app. - Galaxy reads a numeric version from
.ruby-versionfirst, then a literal Ruby version inGemfile. If neither supplies one, Galaxy uses Ruby 4.0. A pinned version needs a matching official Ruby slim image tag. - Check that the configured health check path returns a successful response without signing in. For a new Rails app Galaxy defaults to
/up. If your app doesn't define that route, add it or pick an existing health endpoint.
2. Deploy
Choose your app type
In the Galaxy dashboard, click Create New > Deploy App, then select Ruby on Rails.
Configure and deploy
Follow the Git deployment steps. If you use DATABASE_URL, set it in Configure and Deploy.
Galaxy uses the SECRET_KEY_BASE you provide or generates and saves one for the app. At runtime it uses Thruster when bin/thrust is present, or starts the Rails server directly otherwise. Both listen on Galaxy's PORT.
3. Configure (Optional)
Container-local SQLite is temporary
An app configured for SQLite can run without DATABASE_URL, but each container has its own copy. That data is lost when the container is replaced, including on deploy. Use an external database for data you need to keep.
Galaxy doesn't attach a database automatically. If you use PostgreSQL, you can set DATABASE_URL to a connection string from Galaxy PostgreSQL or your own database. If config/database.yml already configures an external connection, you don't need to duplicate it in DATABASE_URL. For MySQL, use the trilogy adapter. The build image doesn't include the client libraries required by mysql2.
Galaxy runs ./bin/rails db:prepare when each container starts. On paid plans, if DATABASE_URL is set and the pre-deploy command is empty, Galaxy also uses ./bin/rails db:prepare before the new containers receive traffic. Setting a custom pre-deploy command doesn't skip the startup step.
When DATABASE_URL names a PostgreSQL database, Galaxy fills in missing CACHE_DATABASE_URL, QUEUE_DATABASE_URL, and CABLE_DATABASE_URL values. It adds _cache, _queue, and _cable to the database name. If your database user can't create databases, create them ahead of time and supply the corresponding URLs.

