aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorgramanas <grm@eyesin.space>2026-09-12 11:24:17 +0300
committergramanas <grm@eyesin.space>2026-09-12 11:24:17 +0300
commit3eb04b1a2bdf9e53231fe862cfd76327371a9741 (patch)
treeb38b2d82a47233fd8e0bb18c59e4a8f3dd2412d7 /Makefile
downloadblogspace-3eb04b1a2bdf9e53231fe862cfd76327371a9741.tar.gz
blogspace-3eb04b1a2bdf9e53231fe862cfd76327371a9741.tar.bz2
blogspace-3eb04b1a2bdf9e53231fe862cfd76327371a9741.zip
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile45
1 files changed, 45 insertions, 0 deletions
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