From c73c110406a951d94770e62d1bef8f829c63e1d9 Mon Sep 17 00:00:00 2001 From: stroblme Date: Mon, 12 Oct 2026 21:39:59 +0200 Subject: [PATCH] Add make init for a standalone setup Co-Authored-By: Claude Opus 5.5 --- Makefile | 18 ++++++++++++++++-- README.md | 10 +++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e46160c..e8b9a77 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # Convenience targets for development, testing, linting, and deployment. # The workspace root delegates to these (see ../Makefile). -.PHONY: dev-utils dev dev-local dev-lan rebuild-frontend up down update install dev-backend dev-frontend \ +.PHONY: init dev-utils dev dev-local dev-lan rebuild-frontend up down update install dev-backend dev-frontend \ generate-client sync-example test test-backend test-checks test-frontend soak bench-startup lint lint-backend \ lint-frontend format-frontend umami build docs docs-serve clean help @@ -39,13 +39,27 @@ help: ## Show available targets # `make dev DOMAIN=fluksio.com` still wins. dev dev-utils dev-local dev-lan rebuild-frontend: export DOMAIN ?= localhost +# First-time bootstrap. Idempotent: only secrets still set to `changethis` are +# generated, so an existing .env keeps its values. +init: ## First-time setup (.env + secrets + docker network) + @[ -f .env ] || { cp .env.example .env && echo " + .env created from .env.example"; } + @for k in SECRET_KEY POSTGRES_PASSWORD FIRST_SUPERUSER_PASSWORD; do \ + if grep -q "^$$k=changethis$$" .env; then \ + sed -i "s/^$$k=changethis$$/$$k=$$(openssl rand -hex 16)/" .env && echo " + $$k generated"; \ + fi; \ + done + @docker network inspect proxy >/dev/null 2>&1 || docker network create proxy >/dev/null + @echo "" + @echo " Admin login: $$(sed -n 's/^FIRST_SUPERUSER=//p' .env) / $$(sed -n 's/^FIRST_SUPERUSER_PASSWORD=//p' .env)" + @echo " Next: 'make dev-local', then open http://app.localhost" + dev-utils: ## Start only the utility containers (proxy, mailcatcher) $(COMPOSE_DEV) up --build proxy mailcatcher dev: ## Start the full dev stack (includes a local Traefik proxy) $(COMPOSE_DEV) up --build -dev-local: ## Start the integrated local stack (called by the root `make dev`) +dev-local: ## Start the local stack at http://app.localhost (also run by the root `make dev`) DOMAIN=$${DOMAIN:-localhost} ENVIRONMENT=$${ENVIRONMENT:-local} \ $(COMPOSE_LOCAL) up --build -d proxy backend frontend docs mailcatcher diff --git a/README.md b/README.md index 60e8c0c..e6ee9b9 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,15 @@ FLUKSIO_WORKER_TOKEN=… fluksio-worker --url wss://api.fluksio.com/api/v1/worke ## Getting started -Normally driven from the workspace root (`make init` once, then `make dev`). Standalone: +Needs Docker, `make` and `openssl`. Port 80 must be free. + +```sh +make init # once: .env with generated secrets, `proxy` network, prints the admin login +make dev-local # full stack at http://app.localhost (API at http://api.localhost) +make down # stop it +``` + +Without Docker: ```sh make install # uv sync + bun install