Skip to main content
ClaudeWave
Skill1.4k repo starsupdated 27d ago

elixir-deploy

The elixir-deploy skill automates building and deploying Elixir and Phoenix applications by detecting project configuration, resolving Elixir and Erlang versions, executing the appropriate build pipeline including dependency compilation and asset processing, and generating optimized multi-stage Dockerfiles. Use this skill when deploying an Elixir or Phoenix project or when a mix.exs file is detected in the repository root.

Install in Claude Code
Copy
git clone --depth 1 https://github.com/nixopus/nixopus /tmp/elixir-deploy && cp -r /tmp/elixir-deploy/api/skills/elixir-deploy ~/.claude/skills/elixir-deploy
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# Elixir Deployment

## Detection

Project is Elixir if `mix.exs` exists in the root.

## Versions

### Elixir

1. `.elixir-version` file
2. `mix.exs` → detected from project
3. `mise.toml` or `.tool-versions`
4. Defaults to **1.18**

### Erlang (OTP)

1. `.erlang-version` file
2. Resolved automatically from Elixir version
3. `mise.toml` or `.tool-versions`
4. Defaults to **27.3**

## Build

### Build Process

1. Install Elixir and Erlang
2. Get and compile deps: `mix deps.get --only prod` and `mix deps.compile`
3. If defined: `mix assets.setup`
4. If defined: `mix assets.deploy` and `mix ecto.deploy`
5. Compile and release: `mix compile` and `mix release`

### Start Command

```
/app/_build/prod/rel/<app_name>/bin/<app_name> start
```

## Framework Detection

| Signal | Framework |
|---|---|
| `mix.exs` + `phoenix` dep | Phoenix |
| `config/config.exs` | Standard Elixir app |
| `config/runtime.exs` | Runtime config (prod) |

### Phoenix-Specific

- Asset pipeline: Node.js or esbuild; run `mix assets.setup` and `mix assets.deploy`
- Ecto: `mix ecto.setup` (dev) / `mix ecto.deploy` (prod)
- Release: `mix release` produces standalone tarball/binary

## Install Stage Optimization

Copy in order:
- `mix.exs`, `mix.lock`
- `config/` (full config directory)
- `lib/`, `test/`, `assets/` (Phoenix)

## Base Images

| Stage | Image |
|---|---|
| Build | `hexpm/elixir:1.18-erlang-27.3` or `elixir:1.18` |
| Runtime | `debian:bookworm-slim` + extracted release, or `elixir:1.18-slim` |

## Dockerfile Patterns

### Phoenix Release

```dockerfile
FROM hexpm/elixir:1.18-erlang-27.3 AS build
WORKDIR /app
RUN mix local.hex --force && mix local.rebar --force
COPY mix.exs mix.lock ./
RUN mix deps.get --only prod && mix deps.compile
COPY config config
COPY lib lib
COPY priv priv
COPY assets assets
RUN mix assets.deploy
RUN mix compile
RUN mix release

FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y libssl3 ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build /app/_build/prod/rel/my_app ./
EXPOSE 4000
CMD ["./bin/my_app", "start"]
```

### Plain Elixir (no Phoenix)

```dockerfile
FROM hexpm/elixir:1.18-erlang-27.3 AS build
WORKDIR /app
COPY mix.exs mix.lock ./
RUN mix deps.get --only prod && mix deps.compile
COPY config config
COPY lib lib
RUN mix compile && mix release

FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y libssl3 ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build /app/_build/prod/rel/my_app ./
CMD ["./bin/my_app", "start"]
```
api-catalogSkill

Reference for all Nixopus API operations callable via nixopus_api(method, path, body)

caddyfile-generationSkill

Generate Caddyfile configurations for static sites and reverse proxies — SPA fallback routing, cache headers, compression, redirects, and error pages. Use when deploying a static site that needs custom Caddy configuration, or when the user needs SPA routing, caching, or redirect rules.

compose-setupSkill

Generate docker-compose.yml for multi-service setups including databases, caches, and service dependencies. Use when the app needs a database, cache, message broker, or has multiple independently deployable services.

container-resource-tuningSkill

Size container memory and CPU limits, diagnose OOM kills and CPU throttling, and recommend resource adjustments by ecosystem. Use when containers are being OOM-killed, running slowly, or when setting initial resource limits for a deployment.

cpp-deploySkill

Build and deploy C/C++ applications — CMake, Meson, Ninja, and Dockerfile patterns. Use when deploying a C or C++ project, or when CMakeLists.txt or meson.build is detected.

database-migrationSkill

Run database migrations safely during deployment — framework-specific commands, pre-deploy vs post-deploy timing, health gates, and rollback strategies. Use when the app has a database migration system and needs migrations run during deployment.

deno-deploySkill

Build and deploy Deno applications — version detection, dependency caching, and Dockerfile patterns. Use when deploying a Deno project, or when deno.json or deno.jsonc is detected.

deploy-delegationSkill

Sub-agent routing table — which agent handles diagnostics, machine health, infrastructure, GitHub, billing, and notifications. Load when the current task is not a direct deployment.