Documentation menu

Deploy Ruby on Rails on Light Cloud - a Ruby container on port 3000, with DATABASE_URL wiring, startup migrations, and precompiled assets.

Deploy Ruby on Rails

Rails is detected from your Gemfile and runs as a Ruby container on port 3000. No Dockerfile needed - one is generated unless the repo has its own (modern Rails ships one; it is used as written).

Serve it#

Puma binds the routed port via PORT, which is set for you - the stock config/puma.rb already reads it. Bind 0.0.0.0 (Puma's default in production).

Configuration#

Containers receive environment variables at runtime:

  • RAILS_ENV=production and SECRET_KEY_BASE belong in the environment's variables.
  • RAILS_LOG_TO_STDOUT=1 sends logs where runtime logs can see them.

Database#

Rails reads DATABASE_URL natively - set it from the database's Credentials tab and config/database.yml needs no per-environment blocks. Point previews at a Shared-tier database by overriding the variable per environment.

Migrations run where the database is reachable - the startup command works:

bundle exec rails db:migrate && bundle exec puma -C config/puma.rb

Assets#

Precompile during the build so the image ships ready:

bundle exec rails assets:precompile

Set it as part of the build command if your setup doesn't already run it.