chore: update templates (backend v0.1.0 → v0.3.0, caddy v0.1.2 → v0.1.4, frontend v0.3.1 → v0.6.0, infra v0.4.0 → v0.6.0) #6

Merged
hh merged 6 commits from templates/update into dev 2026-10-10 14:56:54 +00:00
4 changed files with 25 additions and 13 deletions
Showing only changes of commit 5676c3e3bb - Show all commits

No files matched your search

+2 -1
View File
@@ -1,7 +1,8 @@
_commit: v0.4.0
_commit: v0.6.0
_src_path: https://git.kotikot.com/templates/infra.git
init_git: true
layout: parts
mcp_servers: []
parts:
- backend
- frontend
+3
View File
@@ -4,3 +4,6 @@
docker-compose.override.yml
.DS_Store
.idea
# Local playground
/t/
+13 -8
View File
@@ -1,10 +1,19 @@
PARTS := $(patsubst %/Makefile,%,$(wildcard */Makefile))
.PHONY: env recreate rebuild restart logs down deploy fmt check build pre-deploy post-deploy
.PHONY: env recreate rebuild restart logs down fmt check build
env:
@test -f .env || awk 'FNR == 1 && NR > 1 { print "" } 1' .env.example $(addsuffix /.env.example,$(PARTS)) > .env
@for part in $(PARTS); do test -f $$part/docker-compose.override.yml || cp $$part/docker-compose.override.yml.example $$part/docker-compose.override.yml; done
@fresh=; test -f .env || { awk 'FNR == 1 && NR > 1 { print "" } 1' .env.example $(addsuffix /.env.example,$(PARTS)) > .env; fresh=1; }; \
for part in $(PARTS); do \
override=$$part/docker-compose.override.yml; \
test -f $$override && continue; \
cp $$override.example $$override; \
for port in $$(sed -n 's/.*127\.0\.0\.1:\([0-9]*\):.*/\1/p' $$override | sort -u); do \
random=$$((20000 + $$(od -An -N2 -tu2 /dev/urandom) % 40000)); \
sed "s/127\.0\.0\.1:$$port:/127.0.0.1:$$random:/" $$override > $$override.tmp && mv $$override.tmp $$override; \
test -z "$$fresh" || { sed "s|localhost:$$port/|localhost:$$random/|" .env > .env.tmp && mv .env.tmp .env; }; \
done; \
done
recreate:
docker compose up -d --force-recreate
@@ -21,9 +30,5 @@ logs:
down:
docker compose down
deploy: pre-deploy
docker compose up -d
$(MAKE) post-deploy
fmt check build pre-deploy post-deploy:
fmt check build:
@for part in $(PARTS); do $(MAKE) -C $$part $@ || exit 1; done
+7 -4
View File
@@ -2,13 +2,13 @@
sync for files not meant to be in git
Runs in Docker, locally the same way as in production. Each part in `backend/`, `frontend/` brings its own `docker-compose.yml`, included from the root one. `COMPOSE_PROFILES` in `.env` selects the services that run on this machine. `docker-compose.override.yml` in each part holds what differs between machines: published ports and the aliases on the external `caddy` network.
```sh
make env
make recreate
make env # .env and docker-compose.override.yml from the examples
make recreate # the services in COMPOSE_PROFILES
make check
```
<<<<<<< before updating
`make env` creates `.env` from the examples of every part and copies each `docker-compose.override.yml.example`. `make recreate` starts the selected profiles, `make rebuild` builds the images first, `make logs`, `make restart` and `make down` do what they say.
To deploy, `git pull && make deploy`. It runs `make pre-deploy` in every part, which builds images only when their inputs changed and applies migrations, then `docker compose up -d`, then `make post-deploy`, which restarts the services whose mounted code changed. A deploy system with its own `up` step calls the two hooks around it. What was built and started is remembered as `refs/deploy/*` in the clone.
@@ -56,3 +56,6 @@ Where no service manager runs, in a container for example, `lodge install` says
The server serves the admin from `frontend/build`. History is drawn as a borehole log: every revision is a bed, newest on top, hatched by the machine that wrote it and labelled with the branch and commit of the main repository. Dragging along the column, or the arrow keys, shows the notes as they were at that revision, and every depth, file and view is a link. A file can be compared with its previous version and put back on the surface; a repository can be deleted with its history, which leaves the files on the machines alone. Machines are listed with their hatch and can be revoked.
`make -C frontend dev` runs the admin against a server on `localhost:8080`.
=======
Parts: `backend/`, `frontend/`, each with its own Makefile.
>>>>>>> after updating