Skip to content

A simple gem for bootstrapping DBs for things

License

Notifications You must be signed in to change notification settings

dgolombek/openbanana

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Banana

Build Status

Openbanana is a gem that, currently, provides a db:grant rake task for Rails projects.

What this db:grant task does is creates the database and sets up the initial grants for the database configured in the config/database.yml file

To use Openbanana, include it in your Rakefile:

require 'openbanana/tasks'

And in your Gemfile:

gem "openbanana"

Environment variables

  • DB_USER overrides the default user (root) to grant privileges
  • DB_PASSWORD overrides the default password (empty) to grant privileges
  • DB_HOST overrides the hostname for the database server (defaults to localhost)

For sharded configurations using a shards.yml file (such as using the octopus gem, see https://github.com/tchandy/octopus) or with extra sharded entries in database.yml (named production or development, etc.; such as using the data_fabric gem, see https://github.com/bpot/data_fabric), adds a db:grant_shards task to create and grant for a set of shard databases.

An example shard.yml looks like:

octopus:
  ...
  production:
    ungrouped_shard:
      adapter: mysql2
      database: foo
      .... also specify username, password, host, etc.
    shard_group:
      shard1:
        database: bar_1
        ....
      shard2:
        database: bar_2
        ....
   ...

or entries in database.yml that look like:

...
shard_1_production:
  adapter: mysql2
  database: foo_prod_s1
  .. etc.
shard_2_production:
  ...

About

A simple gem for bootstrapping DBs for things

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%