- Documentation
- Technologies
- Elixir
Elixir
Guara Cloud fully supports Elixir applications, including frameworks like Phoenix, Ecto, and any other Elixir-based project. Elixir’s BEAM runtime provides fault-tolerant, highly concurrent applications ideal for real-time workloads.
Supported versions
The following Elixir versions are auto-detected by Buildpack:
- Elixir 1.15
- Elixir 1.16
- Elixir 1.17
The version is determined from the elixir field in your mix.exs file. If no version is specified, the latest stable version is used.
# mix.exs
defmodule MyApp.MixProject do
use Mix.Project
def project do
[
app: :my_app,
version: "0.1.0",
elixir: "~> 1.17"
]
end
end
Deploy with Dockerfile
A multi-stage build is the recommended approach for Elixir applications. It compiles your release in a full Elixir environment, then copies only the release into a minimal runtime image.
Deploy with Buildpack
If your repository does not contain a Dockerfile, Guara Cloud automatically detects your Elixir project by the presence of a mix.exs file in the root directory.
The Buildpack will:
- Detect the Elixir and OTP version from
mix.exs - Install dependencies with
mix deps.get - Compile assets if a Phoenix project with assets is detected
- Build a Mix release with
mix release - Start the release binary
Port configuration
Your application must listen on the port configured in your service settings. For Phoenix applications, the default is 4000, but you can change it at any time in your service settings.
# config/runtime.exs
config :my_app, MyAppWeb.Endpoint,
http: [port: String.to_integer(System.get_env("PORT") || "4000")],
server: true
Example project structure
my-elixir-app/
mix.exs
mix.lock
config/
config.exs
runtime.exs
lib/
my_app/
my_app_web/
priv/
Dockerfile # optional — omit to use Buildpack
Environment variables
These environment variables are commonly used with Elixir deployments:
| Variable | Recommended value | Description |
|---|---|---|
PORT | Set by platform | The port your application must listen on |
MIX_ENV | prod | Ensures the application compiles in production mode |
SECRET_KEY_BASE | Random 64+ chars | Secret used for signing sessions and tokens in Phoenix |
DATABASE_URL | Connection string | PostgreSQL connection URL for Ecto |
PHX_HOST | Your domain | The hostname used for URL generation in Phoenix |