Skip to content

Ruby on Rails

Tested with: Rails 8.0 · pg 1.5 · mysql2 0.5 · redis-rb 5.3 · Ruby 3.3

config/database.yml
production:
adapter: postgresql
host: pg-7f3k.us-east.databasezy.com
port: 5432
database: app
username: app
password: <%= ENV["ZB_PASSWORD"] %>
sslmode: verify-full
sslrootcert: <%= ENV.fetch("ZB_CA", "databasezy-ca.pem") %>
pool: <%= ENV.fetch("RAILS_MAX_THREADS", 5) %>
connect_timeout: 10
prepared_statements: <%= ENV["ZB_POOLED"] ? false : true %> # false on the pooled endpoint
config/environments/production.rb
config.cache_store = :redis_cache_store, {
url: ENV.fetch("VALKEY_URL"), # rediss://app:[email protected]:6379/0
ssl_params: { ca_file: ENV.fetch("ZB_CA", "databasezy-ca.pem") },
reconnect_attempts: 3
}

Action Cable and Sidekiq take the same url and ssl_params.

  • bin/rails db:migrate in the release step, against the direct endpoint.
  • Connections per replica = pool × processes (Puma workers). Keep the total under the size’s max_connections.
  • db:prepare on first deploy creates the schema; db:create is not needed, the database app already exists.