Phoenix (Elixir)
Tested with: Phoenix 1.7 · Ecto 3.12 · Postgrex 0.19 · MyXQL 0.7 · Elixir 1.17 / OTP 27
config :my_app, MyApp.Repo, hostname: "pg-7f3k.us-east.databasezy.com", port: 5432, database: "app", username: "app", password: System.fetch_env!("ZB_PASSWORD"), pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"), ssl: [ verify: :verify_peer, cacertfile: System.get_env("ZB_CA") || "databasezy-ca.pem", server_name_indication: ~c"pg-7f3k.us-east.databasezy.com", customize_hostname_check: [match_fun: :public_key.pkix_verify_hostname_match_fun(:https)] ]config :my_app, MyApp.Repo, hostname: "mysql-7f3k.us-east.databasezy.com", port: 3306, database: "app", username: "app", password: System.fetch_env!("ZB_PASSWORD"), pool_size: 10, ssl: [ verify: :verify_peer, cacertfile: System.get_env("ZB_CA") || "databasezy-ca.pem", server_name_indication: ~c"mysql-7f3k.us-east.databasezy.com" ]Migrations in a release
Section titled “Migrations in a release”defmodule MyApp.Release do @app :my_app
def migrate do Application.ensure_all_started(:ssl) for repo <- Application.fetch_env!(@app, :ecto_repos) do {:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true)) end endendbin/my_app eval "MyApp.Release.migrate" in the release step (Fly release_command, a
Kubernetes Job).
- Postgrex supports the pooled endpoint; disable prepared-statement caching with
prepare: :unnamedwhen using it. pool_sizeis per node; keep nodes × pool_size under the size’smax_connections.- Phoenix PubSub and Oban can use Postgres directly; for Valkey-backed PubSub use
phoenix_pubsub_rediswith arediss://URL andssl: true.