Trying to deploy an existing app on Gigalixir and have had a bit of difficulty, but can’t find anything about how to resolve this current issue. It has no front end assets, it’s just an Absinthe GraphQL API.
This error occors:
[error] Postgrex.Protocol (#PID<0.2308.0>) failed to connect: ** (Postgrex.Error) FATAL 53300 (too_many_connections) remaining connection slots are reserved for non-replication superuser connections
Followed by this warning:
[warn] Description: 'Authenticity is not established by certificate path validation'
web.1 | Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
I provisioned the database through the CLI as a Standard tier and set the pool size down to 2 as suggested by the troubleshooting docs for hitting the too_many_connections error.
Using Phoenix 1.6 / Elixir 1.12.3 / Erlang 24.2
config.exs:
import Config
config :evora,
ecto_repos: [Evora.Repo],
generators: [binary_id: true]
# Configures the endpoint
config :evora, EvoraWeb.Endpoint,
url: [host: "localhost"],
render_errors: [view: EvoraWeb.ErrorView, accepts: ~w(json), layout: false],
pubsub_server: Evora.PubSub
prod.exs:
import Config
config :evora, Evora.Endpoint,
load_from_system_env: true,
http: [port: {:system, "PORT"}],
server: true,
secret_key_base: "${SECRET_KEY_BASE}",
url: [host: "${APP_NAME}.gigalixirapp.com", port: 443],
releases.exs:
import Config
config :evora, EvoraWeb.Endpoint,
server: true,
http: [port: {:system, "PORT"}], # Needed for Phoenix 1.2 and 1.4. Doesn't hurt for 1.3.
url: [host: System.get_env("APP_NAME") <> ".gigalixirapp.com", port: 443]
runtime.exs:
import Config
if config_env() == :prod do
config :evora, Evora.Repo,
adapter: Ecto.Adapters.Postgres,
database: "",
ssl: true,
url: System.get_env("DATABASE_URL"),
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
secret_key_base =
System.get_env("SECRET_KEY_BASE") ||
raise """
environment variable SECRET_KEY_BASE is missing.
You can generate one by calling: mix phx.gen.secret
"""
config :evora, EvoraWeb.Endpoint,
http: [
ip: {0, 0, 0, 0, 0, 0, 0, 0},
port: String.to_integer(System.get_env("PORT") || "4000")
],
secret_key_base: secret_key_base
end
elixir_buildpack.config
elixir_version=1.12.3
erlang_version=24.2