Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

312
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda