From 5676c3e3bb4b85dbff3942aeb071dd52c844a18d Mon Sep 17 00:00:00 2001 From: renovate Date: Sat, 10 Oct 2026 00:30:51 +0000 Subject: [PATCH] chore(infra): update template to v0.6.0, conflicts left --- .copier/infra.yml | 3 ++- .gitignore | 3 +++ Makefile | 21 +++++++++++++-------- README.md | 11 +++++++---- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.copier/infra.yml b/.copier/infra.yml index b6e0e21..cd84462 100644 --- a/.copier/infra.yml +++ b/.copier/infra.yml @@ -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 diff --git a/.gitignore b/.gitignore index 817009b..e9d0980 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ docker-compose.override.yml .DS_Store .idea + +# Local playground +/t/ diff --git a/Makefile b/Makefile index 59a9fb0..07ff450 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 7075f2a..ae7dbd4 100644 --- a/README.md +++ b/README.md @@ -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