KamuiDash KamuiDash Docs
EN JA ZH

Deploy Ruby on Rails with PostgreSQL

Deployment settings for a Ruby on Rails app with PostgreSQL, asset compilation, and database migrations.

Assumed Structure

  • Gemfile / Gemfile.lock: dependencies, including Rails, Puma, and pg in the production bundle
  • config/database.yml: connect to PostgreSQL using DATABASE_URL
  • Install gems and compile assets in Setup → run migrations in Pre-start → start the server in Start

Deploy Commands

Field Value (example)
Setup Command bundle config set --local without development:test && bundle install && SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile
Pre-start Command bundle exec rails db:migrate
Start Command bundle exec rails server -b 0.0.0.0 -p $PORT

Commands run from the repository root (or the selected root directory). Select Ruby as the runtime language and check its version against Gemfile and .ruby-version.

These commands match the starter app below. For other apps, review the suggested commands against the repository; omit asset compilation or migrations when unnecessary. SECRET_KEY_BASE_DUMMY=1 is for asset compilation only and does not replace a runtime secret.

Set the Health Check Endpoint to a working route. The starter app uses /up; for other apps, check config/routes.rb.

Environment Variables

The PORT environment variable is set by default. Your app should use this value as the listen port.

When a database is selected during app creation, the following variables are also automatically set:

  • DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
  • DATABASE_URL — full connection string

For the starter app, generate SECRET_KEY_BASE with bin/rails secret and set it in the dashboard’s environment settings. For other apps, also set RAILS_MASTER_KEY if required. Keep secrets out of repositories and chat.

Starter App

See the starter app for reference: kamui-project/ruby-starter

Next Steps