Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

311
Vistas
How to configure database.yml for production

I would like to deploy my application via Dokku to a VPS.
Putting together the dokku-postgres documentation and the relative, scarce internet documentation on the matter (one at GitHub), it seems necessary to configure database.yml to use the url environment variable url: <%= ENV['DATABASE_URL'] %>

Since I could not find any other sources of information, I wonder how database.yml should be configured, and how Rails will connect to the postgres service created with Dokku.

For instance, taken for granted that linking url to the DATABASE_URL variable is necessary, will this be enough to establish a connection between my Rails application and the postgres service or would it be still necessary to use a username and a password? In the latter case, what username and password am I expected to use?

Below is how at present my database.yml looks like.

default: &default
  adapter: postgresql
  encoding: unicode
  pool: 5
  username: asarluhi

development:
  <<: *default
  database: fireworks_app_development

test:
  <<: *default
  database: fireworks_app_test

production:
  <<: *default
  database: fireworks_app_production
  pool: 25
  username: fireworks_app
  password: <%= ENV['FIREWORKS_APP_DATABASE_PASSWORD'] %>

This file was created as it is (apart from a higher pool size for production) when I created the application. How would you suggest to edit the production section?

The dokku-postgres documentation states that the following (and nothing else) will be set on the linked application by default:

DATABASE_URL=postgres://postgres:SOME_PASSWORD@dokku-postgres-lolipop:5432/lolipop

In place of the lollipop postgres service example, I would use fireworks_app_production to match the name of the database in database.yml
Are username and password still necessary after pointing url to the DATABASE_URL variable? Am I expected to add or remove anything else?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You don't need to worry about the database.yml with dokku, just upload your app to the server, let's use "fireworks" as the name for example on this.

when you upload the first time the app, this is created automatically so you don't need to create it.

then you install the postgres plugin and run

# that will create the container for the database
$ dokku postgres:create fireworks
# and then you link both, the app with the database
$ dokku postgres:link fireworks fireworks

you don't have to worry about anything else, with that dokku will connect this

then you just have to run db:migrate and everything is ready to work!

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda