Blog Post: Self provisioning Ecto based Application

Uplink, our cluster management tool does a few things:

  • Manage deployments
  • Updating load balancing configurations
  • Provides load balancing (via caddy)
  • Provision resources requested by applications

The Uplink module runs inside the customer’s cluster and has 2 modes a lite mode and pro mode. In lite mode it uses a local postgresql that it sets up by itself when it detects that postgresql isn’t installed, in pro mode it expects a DATABASE_URL to be set in the environment variable and simply uses the config passed in via the variable.

While the pro mode is quite straight forward and works like any other typical elixir app, the interesting part was developing the lite mode. One of the challenge I faced was getting a skeleton version of the application to boot without the need for a database, and in that skeleton mode provision itself a postgresql database and then boot up the rest of the application.

Also to provider further context, this application is currently designed to run in an alpine linux environment, running inside an LXC container. In the solutions below you’ll see references to alpine linux. However the concept should be applicable everywhere else.

Read more:

Self provisioning Ecto based Application