Skip to content

Hello Elixir

A minimal Plug/Bandit application in Elixir. Multi-stage Docker build with OTP release. One container, one service, no database, no cache.

Overview

Repository git@gitlab.com:appmecca-sample-apps/hello-elixir.git
Tech Stack Elixir 1.16 / Plug / Bandit
Services web (port 4000)
Database None
Cache None
URL Pattern https://hello-elixir-web.{env}.appmecca.net

What This App Demonstrates

  • Deploying an Elixir application on AppMecca
  • Multi-stage Docker build (Elixir compiler + Debian runtime)
  • OTP release for production deployment
  • Health check endpoint pattern

appmecca.yaml

containers:
  - name: hello-elixir
    dockerfile: Dockerfile
    context: .

deploy:
  - name: web
    container: hello-elixir
    port: 4000
    health_check:
      path: /health

The configuration is identical in structure to any other single-container app. The Elixir app listens on port 4000.

Step-by-Step Deployment

1. Register the app

mecca register git@gitlab.com:appmecca-sample-apps/hello-elixir.git -e dev

2. Build the container

mecca build trigger -e dev -g git@gitlab.com:appmecca-sample-apps/hello-elixir.git
Expected output
Build started: build-xxxxxxxx
Cloning repository...
Building container: hello-elixir
Pushing image to the private registry: hello-elixir/web
Build complete. Duration: 55s

3. Deploy

mecca app deploy -e dev hello-elixir
Expected output
Deploying hello-elixir to dev...
Deployment queued: deploy-xxxxxxxx
Waiting for agents...
Container started: hello-elixir-web
Health check passed: /health -> 200 OK
Deployment complete.

Services:
  web: https://hello-elixir-web.dev.appmecca.net

4. Verify

mecca app show hello-elixir -e dev

Test the endpoint:

curl https://hello-elixir-web.dev.appmecca.net/health
{"status": "healthy"}

Key Concepts

OTP releases

Elixir applications are packaged as OTP releases -- self-contained bundles that include the BEAM virtual machine, all compiled modules, and the application's dependency tree. This means the runtime image does not need Elixir or Erlang installed, just the BEAM's minimal system dependencies.

Plug and Bandit

Plug is Elixir's HTTP middleware specification (similar to Rack in Ruby or WSGI in Python). Bandit is a modern HTTP server for Plug that runs on the BEAM. Together they provide a lightweight, concurrent web server with Elixir's trademark fault tolerance.

Any language, same workflow

AppMecca does not care what language your application is written in. As long as your container listens on the declared port and responds to health checks, the deployment workflow is identical.

What's Next?