Three pieces so kadence.timka.su can be stood up and updated from the repo
rather than from shell history on the box:
* `docker-compose.prod.yml` — publishes the app on loopback only. The base
file's `${APP_PORT}:8000` binds every interface, which on this host both
collides with remnawave (already on 8000) and would serve the API beside
the proxy without TLS. Compose *appends* merged port lists, so the override
needs the `!override` tag or the public binding survives. uvicorn also gets
`--proxy-headers`, without which every request looks like plain HTTP from
127.0.0.1 and the session cookie loses its `Secure` flag.
* `deploy/nginx/kadence.timka.su.conf` — TLS, HSTS, the forwarded headers the
cookie logic reads, and a 120s read timeout because one task refresh fans
out to four third-party APIs.
* `deploy/deploy.sh` — idempotent install-or-update. Generates API_TOKEN and
the database password once and never rotates them afterwards (that would
lock out the phone and the desktop app), treats `.env.example`'s
`change-me` placeholders as unset, and uses `certbot certonly --webroot`
rather than `--nginx` so the vhost in git stays the truth.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
65 lines
2.4 KiB
Makefile
65 lines
2.4 KiB
Makefile
# Kadence — the handful of commands you actually run.
|
|
.DEFAULT_GOAL := help
|
|
SHELL := /bin/bash
|
|
|
|
help: ## Show this help
|
|
@grep -hE '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) \
|
|
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-18s\033[0m %s\n", $$1, $$2}'
|
|
|
|
up: ## Start the backend + web UI (http://localhost:8000)
|
|
docker compose up -d --build
|
|
|
|
down: ## Stop everything
|
|
docker compose down
|
|
|
|
logs: ## Follow the backend log
|
|
docker compose logs -f app
|
|
|
|
dev: ## Backend with reload + Vite dev server (http://localhost:5173)
|
|
docker compose -f docker-compose.yml -f docker-compose.dev.yml up
|
|
|
|
test: ## Run the backend test suite
|
|
cd backend && PYTHONPATH=$$PWD .venv/bin/python -m pytest -q
|
|
|
|
backend-venv: ## Create the backend virtualenv for local work
|
|
cd backend && python3 -m venv .venv && .venv/bin/pip install -e ".[dev]"
|
|
|
|
web-build: ## Build the web UI into frontend/dist
|
|
cd frontend && npm install && npm run build
|
|
|
|
desktop: ## Run the native desktop app against localhost:8000
|
|
cd desktop && python3 -m kadence_desktop
|
|
|
|
desktop-install: ## Install the launcher entry and icon for your user
|
|
./desktop/packaging/install-desktop.sh
|
|
|
|
helper-install: ## Install the privileged blocking helper (asks for sudo)
|
|
sudo ./desktop/helper/install.sh
|
|
|
|
android-test: ## Run every Android test (no device, no backend needed)
|
|
cd android && ./gradlew :core:test :app:testDebugUnitTest
|
|
|
|
android-test-core: ## Run just the pure-logic suite (needs only a JDK)
|
|
cd android && ./gradlew :core:test
|
|
|
|
android-build: ## Build the debug APK (needs the Android SDK)
|
|
cd android && ./gradlew :app:assembleDebug
|
|
|
|
android-install: ## Install the debug APK on the connected phone
|
|
cd android && ./gradlew :app:installDebug
|
|
|
|
report: ## Build and send today's report right now
|
|
cd backend && PYTHONPATH=$$PWD .venv/bin/python -m app.cli report
|
|
|
|
set-password: ## Set/rotate the web login password (asks for a confirm)
|
|
docker compose exec app python -m app.cli set-password
|
|
|
|
deploy: ## Push master and redeploy kadence.timka.su on sw_pl_1
|
|
git push origin master
|
|
ssh sw_pl_1 '/opt/kadence/deploy/deploy.sh'
|
|
|
|
deploy-logs: ## Follow the production app log
|
|
ssh sw_pl_1 'cd /opt/kadence && docker compose -f docker-compose.yml -f docker-compose.prod.yml logs -f --tail 100 app'
|
|
|
|
.PHONY: help up down logs dev test backend-venv web-build desktop desktop-install helper-install android-test android-test-core android-build android-install report set-password deploy deploy-logs
|