From 3eb04b1a2bdf9e53231fe862cfd76327371a9741 Mon Sep 17 00:00:00 2001 From: gramanas Date: Sat, 12 Sep 2026 11:24:17 +0300 Subject: Initial multi-tenant blog host Go + Postgres application serving a management dashboard on the base domain and one public blog per subdomain. Markdown posts organised in pages, form-based theme customisation, image uploads stored in Postgres, JWT cookie sessions with CSRF, superadmin user management, RSS feeds. Docker/compose deployment and a Makefile-driven dev environment with seed data. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A --- Makefile | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9eb6b2d --- /dev/null +++ b/Makefile @@ -0,0 +1,45 @@ +# Local development helpers. Requires Go and Docker. +export DEV ?= 1 +export BASE_DOMAIN ?= blogspace.localhost +export PUBLIC_PORT ?= 8080 +export ADDR ?= :8080 +export DATABASE_URL ?= postgres://blogspace:blogspace@localhost:5432/blogspace?sslmode=disable +export TEST_DATABASE_URL ?= $(DATABASE_URL) + +.PHONY: dev run db-up db-down db-reset seed test build docker-build up down fmt + +dev: db-up run ## start postgres and run the app with live template reload + +run: ## run the app (assumes postgres is up) + go run ./cmd/blogspace serve + +db-up: ## start dev postgres and wait until it accepts connections + docker compose -f compose.dev.yml up -d --wait + +db-down: + docker compose -f compose.dev.yml down + +db-reset: ## drop all dev data and start fresh + docker compose -f compose.dev.yml down -v + $(MAKE) db-up + +seed: db-up ## insert demo superadmin (admin/admin) and blogger (alice/alicealice) + go run ./cmd/blogspace seed + +test: + go test ./... + +build: + CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o bin/blogspace ./cmd/blogspace + +fmt: + gofmt -w . + +docker-build: + docker build -t blogspace . + +up: ## production-style: app + db in docker (needs .env) + docker compose up --build -d + +down: + docker compose down -- cgit v1.2.3