← Back to elixir-lang/elixir

How to Deploy & Use elixir-lang/elixir

Elixir Deployment and Usage Guide

Prerequisites

Before installing Elixir, ensure you have the following:

  • Erlang/OTP: Elixir runs on the Erlang virtual machine. Install Erlang version 24.0 or later from the official Erlang website.
  • Git: Required for cloning the repository.
  • Build tools: Depending on your platform, you may need build tools like make and a C compiler.

Installation

From Source

To compile Elixir from source:

  1. Clone the repository:

    git clone https://github.com/elixir-lang/elixir.git
    cd elixir
    
  2. Compile Elixir:

    make
    
  3. (Optional) Set as system version by adding the bin directory to your PATH environment variable:

    export PATH=$PATH:/path/to/elixir/bin
    

System Installation

For various platform-specific installation methods, refer to the official installation guide.

Note for Windows users: This article includes important notes for compiling Elixir from source on Windows.

Configuration

Environment Variables

  • ERL_COMPILER_OPTIONS=deterministic: Set this for deterministic builds.
  • Update your PATH to include the Elixir binary directory if using a custom installation.

Build Configuration

When updating the repository, run make clean before recompiling to ensure a clean build.

Build & Run

Development

  1. Compile the project:

    make
    
  2. Run the Elixir interactive shell (IEx):

    bin/iex
    

Production

For production deployments, consider using pre-built packages or your system's package manager for stability.

Deployment

Platform Options

Elixir applications can be deployed on various platforms:

  1. Docker: Containerize your Elixir application using official Docker images.
  2. Platform as a Service (PaaS):
    • Heroku with the Elixir buildpack
    • Gigalixir (Elixir-specific PaaS)
  3. Infrastructure as a Service (IaaS):
    • AWS EC2 with Distillery or Mix releases
    • Google Cloud Compute Engine
  4. Kubernetes: Deploy using Kubernetes with Distillery or Mix releases.

Release Management

For production deployments, use Mix releases or Distillery to create self-contained releases of your Elixir applications.

Troubleshooting

Common Issues

  1. Erlang Not Found

    • Ensure Erlang is installed and in your PATH
    • Verify Erlang version is 24.0 or later
  2. Compilation Errors

    • Run make clean before recompiling
    • Check that all build dependencies are installed
  3. PATH Issues

    • Verify the Elixir bin directory is in your PATH
    • Restart your terminal after modifying PATH
  4. Deterministic Build Issues

    • Set ERL_COMPILER_OPTIONS=deterministic environment variable

Getting Help

Community Resources