All templates

Deploy Phoenix on Rebasable

Elixir Phoenix 1.8 release built from the Dockerfile that phx.gen.release generates.

Runtime: docker Free instance elixirdocker

How it works

The Dockerfile compiles the app, builds assets with esbuild and Tailwind, and packages a release that runs bin/server. config/runtime.exs reads PORT, takes the public host from REBASABLE_EXTERNAL_URL (or PHX_HOST) and stretches the generated SECRET_KEY_BASE to the 64 bytes Phoenix requires. /healthz answers the health check and is excluded from force_ssl.

Run it locally

mix setup
mix phx.server   # http://localhost:4000

Use it as your own repository

Copy the phoenix folder of the templates repository into a new repo (the files at the root, rebasable.yaml included) and push it. Then add a Deploy button to its README, or create it from Blueprints, New blueprint in the dashboard. From then on, every push deploys, and pull requests get preview environments.

Good to know

  • Ecto and Postgres: generate with mix phx.new without --no-ecto, add a databases: entry and pass DATABASE_URL; run migrations with preDeployCommand: /app/bin/migrate.
  • LiveView websockets work through the Rebasable edge with no extra setup.