Hex.pm Version

Divo Postgres

A library implementing the Divo Stack behaviour, providing a pre-configured Postgres database via docker-compose for integration testing Elixir apps. The database is a single-node postgres compose stack that can be configured with an arbitrary database and user to create on first start.

Requires inclusion of the Divo library in your mix project.

Installation

The package can be installed by adding divo and divo_postgres_db to your list of dependencies in mix.exs:

def deps do
  [
    {:divo, "~> 2.0.0"},
    {:divo_postgres_db, "~> 1.0.0"}
  ]
end

Use

In your Mix environment exs file (i.e. config/integration.exs), include the following:

config :myapp,
  divo: [
    {DivoPostgres, [user: "bob", database: "bobs_stuff", config_opts: ["shared_buffers=256MB", "max_connections=200"]]}
  ]

In your integration test specify that you want to use Divo:

use Divo
...

The resulting stack will create a single-node Postgres database instance exposing port 5432 to the host.

Configuration

You may omit the configuration arguments to DivoPostgres and still have a working stack. The bare minimum configuration of a user, password, database, and version of postgres all provide default values.

See Divo GitHub or Divo Hex Documentation for more instructions on using and configuring the Divo library. See Postgres Dockerhub for further documentation on using and configuring the features of the container image itself. See Postgres source for the full codebase behind PostgreSQL

License

Released under Apache 2 license.