anvilsign in

collin/anvil

1#!/usr/bin/env bash
2# Build and (re)start the anvil container on hagrid.
3#
4# Run from the repo root, on the hagrid host (or anywhere with the `hagrid`
5# Docker network). See DEPLOY.md for the full procedure (Caddy + DNS + admin).
6set -euo pipefail
7
8IMAGE="${ANVIL_IMAGE:-anvil:latest}"
9NETWORK="${ANVIL_NETWORK:-hagrid}"
10SSH_PORT="${ANVIL_SSH_PORT:-2222}"
11
12cd "$(dirname "$0")/.."
13
14echo "==> building $IMAGE"
15docker build -t "$IMAGE" .
16
17echo "==> (re)starting anvil container"
18docker rm -f anvil 2>/dev/null || true
19docker run -d \
20 --name anvil \
21 --network "$NETWORK" \
22 --restart unless-stopped \
23 -p "${SSH_PORT}:2222" \
24 -v anvil-data:/data \
25 "$IMAGE"
26
27echo "==> anvil is running (web: anvil:3000 via Caddy, ssh: host :${SSH_PORT})"
28echo " Next: add the Caddy block + DNS, then create your admin user — see DEPLOY.md."