Skip to content

withbelay/belay_brokerage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BelayBrokerage

Installation

If available in Hex, the package can be installed by adding belay_brokerage to your list of dependencies in mix.exs:

def deps do
  [
    {:belay_brokerage, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/belay_brokerage.

Setup

All Environments

To setup Belay Brokerage you will need to add the following into your config:

  1. You will need to add the BelayBrokerage Repo config into your config files, this config is akin to a normal Ecto.Repo setup

    config :belay_brokerage, BelayBrokerage.Repo,
      url: "BELAY_BROKERAGE_POSTGRES_URL",
      pool_size: 10
  2. You will need to add BelayBrokerage.Repo to the ecto_repos config in your OTP app:

    config :my_app,
      ecto_repos: [MyApp.Repo, BelayBrokerage.Repo],
  3. You will need to define your tenants that BelayBrokerage will setup

    config :belay_brokerage, tenants: ["tenant_a", "tenant_b"]
  4. You will need to add a rabbit URI to allow BelayBrokerage to connect to a rabbit instance, decide whether it is a consumer or a producer. If it is a consumer you will need to also reference a Transaction handler module

    Producer config:

    config :belay_brokerage,
      transaction_handler_type: :producer,
      rabbit_uri: "amqp://guest:guest@localhost"

    Consumer config:

    config :belay_brokerage,
      transaction_handler_type: :consumer,
      transaction_handler: MyApp.TransactionHandler,
      rabbit_uri: "amqp://guest:guest@localhost"

Prod / Fly Setup

For fly, be sure to remember to set to IPV6 mode (prod.exs or runtime.exs)

config :belay_brokerage, BelayBrokerage.Repo,
  socket_options: [:inet6]

Local Setup

Run: mix belay_brokerage.setup_tenants AFTER you run mix ecto.create (so that the database exists)

About

A dumb brokerage data holder

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages