Files
libnovel/justfile
Admin 2f74b2b229
Some checks failed
Release / Test backend (push) Successful in 1m8s
Release / Check ui (push) Successful in 1m59s
Release / Docker (push) Failing after 1m37s
Release / Deploy to prod (push) Has been skipped
Release / Gitea Release (push) Has been skipped
fix: only pull app images during deploy, not infra images
docker compose pull without arguments pulls ALL services including
getmeili/meilisearch:latest — a recent Meilisearch version bump broke
compatibility with existing data on the server, causing meilisearch to
crash immediately on restart.

CI deploy now only pulls the 5 custom app images (backend, runner, ui,
caddy, pocketbase). Infrastructure images (meilisearch, valkey, minio,
redis, crowdsec) are updated deliberately via `just pull-infra`.

Also add pocketbase to `just pull-images` now that it's a custom image.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 19:19:31 +05:00

137 lines
5.7 KiB
Makefile

# ── LibNovel v3 — justfile ────────────────────────────────────────────────────
# All commands that touch docker-compose are wrapped with `doppler run` so that
# secrets are injected into the environment at runtime — no .env files needed.
#
# Prerequisites:
# brew install doppler just
# doppler setup (run once; selects project=libnovel config=prd)
#
# Usage:
# just up # start all services (detached)
# just down # stop all services
# just logs # tail all service logs
# just ps # show running containers
# just build # rebuild backend + ui images
# just restart # full stop + start cycle
# just secrets # print all injected secrets (debug)
set dotenv-load := false # Doppler handles all env; never load a .env file
# ── Helpers ───────────────────────────────────────────────────────────────────
# Inject secrets from Doppler, then run the given command
doppler := "doppler run --"
# ── Core compose commands ─────────────────────────────────────────────────────
# Start all services in the background
up:
{{doppler}} docker compose up -d
# Start and stream logs (foreground)
up-fg:
{{doppler}} docker compose up
# Stop all running services
down:
{{doppler}} docker compose down
# Stop and remove volumes (full reset — destructive!)
down-volumes:
{{doppler}} docker compose down -v
# Show service status
ps:
{{doppler}} docker compose ps
# ── Build & publish ───────────────────────────────────────────────────────────
# Build (or rebuild) all custom images locally
build:
{{doppler}} docker compose build
# Build a specific service, e.g.: just build-svc backend
build-svc svc:
{{doppler}} docker compose build {{svc}}
# Push all custom images to Docker Hub (requires docker login)
push:
{{doppler}} docker compose push backend runner ui caddy pocketbase
# Build then push all custom images
build-push: build push
# Pull all images from Docker Hub (uses GIT_TAG from Doppler)
pull-images:
{{doppler}} docker compose pull backend runner ui caddy pocketbase
# Pull all third-party base images (minio, pocketbase, etc.)
pull-infra:
{{doppler}} docker compose pull minio pocketbase meilisearch valkey postgres crowdsec watchtower
# ── Logs ─────────────────────────────────────────────────────────────────────
# Tail all service logs (last 50 lines + follow)
logs:
{{doppler}} docker compose logs -f --tail=50
# Tail a specific service, e.g.: just log backend
log svc:
{{doppler}} docker compose logs -f --tail=50 {{svc}}
# ── Lifecycle ─────────────────────────────────────────────────────────────────
# Full restart: stop then start
restart: down up
# Restart a single service, e.g.: just restart-svc backend
restart-svc svc:
{{doppler}} docker compose restart {{svc}}
# Pull → build → recreate (rolling update without clearing volumes)
update:
{{doppler}} docker compose pull
{{doppler}} docker compose build
{{doppler}} docker compose up -d
# ── Initialisation ────────────────────────────────────────────────────────────
# Run one-shot init containers (minio-init, pb-init, postgres-init)
init:
{{doppler}} docker compose run --rm minio-init
{{doppler}} docker compose run --rm pb-init
{{doppler}} docker compose run --rm postgres-init
# ── Shell access ──────────────────────────────────────────────────────────────
# Open a shell in a running service, e.g.: just shell backend
shell svc:
{{doppler}} docker compose exec {{svc}} sh
# ── Secrets ───────────────────────────────────────────────────────────────────
# Print all secrets Doppler will inject (never redirected to a file)
secrets:
doppler secrets --project libnovel --config prd
# Print secrets as a .env-formatted list (useful for debugging)
secrets-env:
doppler secrets download --project libnovel --config prd --format env --no-file
# Open Doppler dashboard in browser
secrets-dashboard:
doppler open dashboard
# ── Developer setup ───────────────────────────────────────────────────────────
# One-time dev setup: configure git to use committed hooks in .githooks/
setup:
git config core.hooksPath .githooks
@echo "Git hooks configured (.githooks/pre-commit active)."
# ── Gitea CI ──────────────────────────────────────────────────────────────────
# Validate workflow files
ci-lint:
actionlint .gitea/workflows/*.yaml