Artboard
Classic Docs
Docs Navigation

Custom database.yml

If you select PostgreSQL or MySQL as database for a project, Semaphore will generate database.yml file for the project, with working credentials. In some cases you might want to use your own database.yml. This includes projects that depend on more than one database.

You can create a custom database.yml using configuration files and environment variables.

An example configuration file at project_name/config/database.yml path might look like this:

development:
  adapter: postgresql
  database: <%= ENV['DATABASE_NAME_DEVELOPMENT'] %>
  encoding: utf8
  username: <%= ENV['DATABASE_USERNAME'] %>
  password: <%= ENV['DATABASE_PASSWORD'] %>

test: &test
  adapter: postgresql
  database: <%= ENV['DATABASE_NAME_TEST'] %>
  encoding: utf8
  username: <%= ENV['DATABASE_USERNAME'] %>
  password: <%= ENV['DATABASE_PASSWORD'] %>

api_test: &api_test
  adapter: postgresql
  database: api_<%= ENV['DATABASE_NAME_TEST'] %>
  encoding: utf8
  username: <%= ENV['DATABASE_USERNAME'] %>
  password: <%= ENV['DATABASE_PASSWORD'] %>

Note that Semaphore won't create databases automatically. You need to add build commands to create the database.

Semaphore Docs are open source — Edit on GitHub

Newsletter

Occasional lightweight product and blog updates. Unsubscribe at any time.

2009-2020 © Rendered Text. All rights reserved. Terms of Service, Privacy policy, Security.