Skip to content

How it works

Nathan Pierce edited this page Jun 6, 2018 · 6 revisions

This page is for those that want to learn more about the plugin internals.

Check here for full capistrano deployment flow http://capistranorb.com/documentation/getting-started/flow/.

The following tasks run during the setup task, respectively:

Example execution: cap development postgresql:setup

  • postgresql:remove_app_database_yml_files
    Removes each :app role server's shared/config/database.yml specified in your config/deploy/{environment}.rb files.
  • postgresql:create_database_user
    Creates a postgresql user. Password for the user is automatically generated and used in the next steps.
  • postgresql:create_database
    Creates the database for your app.
  • postgresql:add_extensions
    Creates all extensions you specify in your config/deploy/{environment}.rb files.
  • postgresql:generate_database_yml_archetype
    Creates a database.yml file and copies it to #{deploy_path}/db/database.yml on the primary db server.
  • postgresql:generate_database_yml
    Copies database.yml file from the primary db server to #{shared_path}/config/database.yml on release server(s).

Also, the plugin ensures config/database.yml is symlinked from shared_path. The above tasks are all you need for getting a Rails app to work with PostgreSQL.

Clone this wiki locally