Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgres service name and database.yml file #110

Closed
knzudgt opened this issue Apr 19, 2017 · 3 comments
Closed

postgres service name and database.yml file #110

knzudgt opened this issue Apr 19, 2017 · 3 comments

Comments

@knzudgt
Copy link

knzudgt commented Apr 19, 2017

The database.yml file of my Ruby on Rails application contains the following record:

production:
  <<: *default
  database: derp_app_production

Should the name of the postgres service linked to my application at Dokku match the database name in database.yml, so that I am expected to create the service with the following command:

dokku postgres:create derp_app_production

Or is it possible to use a different name without raising conflicts?

dokku postgres:create derp
@josegonzalez
Copy link
Member

If you create a service:

dokku postgres:create SERVICE_NAME

Then the database name will be

SERVICE_NAME

Please see the documentation for further details.

@knzudgt
Copy link
Author

knzudgt commented Apr 19, 2017

@josegonzalez I understood how to assign a name to a postgres service, thank you.
However, I was mainly concerned about what name to choose and if there is any restriction.

In Ruby on Rails, the database configuration file is config/database.yml where each environment has its own configuration records, included the database name which is inferred by the name of the application: application_name_environment.
So, for the production environment we have application_name_production. There are also other useful records, such as the connection pool.

So I wonder: do I have to stick with the name contained in config/database.yml when I assign a name to the postgres service?

@josegonzalez
Copy link
Member

We don't currently allow you to rename the postgres database that is created when you create a postgres service, so your best bet is to name it application_name_environment and then link appropriately.

IIRC you can just change the name in your config/database.yml to match the loaded service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants