From 5cee5f99e97db880e419a1fdcfe7689da2e2f9a6 Mon Sep 17 00:00:00 2001 From: h Date: Thu, 8 Oct 2026 21:34:41 +0200 Subject: [PATCH] refactor: drop make deploy and its refs/deploy stamps, the fleet deploys from infra/komodo; short readme --- README.md | 4 +--- template/{{ part_dir }}/Makefile.jinja | 17 +---------------- ...ayout == 'root' %}README.md{% endif %}.jinja | 16 ++++------------ 3 files changed, 6 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index a4002bb..3bb8e8d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # frontend-svelte -Copier template for a SvelteKit frontend, either as a `frontend/` part next to other parts or alone at the root of the project (`layout`): SvelteKit on Bun with Tailwind v4, ultracite (biome) or ESLint + Prettier (`linter`) and optional shadcn-svelte, served by a Bun server with SSR, as a static SPA behind `serve.ts`, or as a static SPA that the backend api serves from `frontend/build`. - -Ships `frontend/docker-compose.yml` with root-relative paths and profiles per service, `docker-compose.override.yml.example` (the `caddy` network aliases, copied by `make env`), a `Makefile` with `fmt`, `check`, `build` and `dev`, `.env.example`, `CLAUDE.md`, `.claude/rules` for Svelte (and ultracite with biome). The image is built in stages: `.env` is in the build context, since `$env/static/*` are inlined at build time, and stays in the builder stage; the runtime image gets `build/` and production dependencies only. The Svelte MCP server comes from `infra`. Applied on top of the `infra` template, `layout: parts` or `layout: single` respectively. +Copier template for a SvelteKit frontend on Bun with Tailwind v4, biome or ESLint + Prettier and optional shadcn-svelte: SSR on Bun, a static SPA behind `serve.ts`, or a static SPA served by the backend api. A `frontend/` part or the whole project (`layout`), on top of `infra`. ```sh copier copy --trust -d project_name="My Thing" -d serve=bun diff --git a/template/{{ part_dir }}/Makefile.jinja b/template/{{ part_dir }}/Makefile.jinja index 8405f28..c5ce2c4 100644 --- a/template/{{ part_dir }}/Makefile.jinja +++ b/template/{{ part_dir }}/Makefile.jinja @@ -1,9 +1,6 @@ COMPOSE := {% if layout == 'part' %}cd .. && {% endif %}docker compose -{% if serve != 'api' %}IMAGE := {{ project_slug | replace('_', '-') }}/frontend -{% endif %}changed = ! git diff --quiet $(1) -- $(2) 2>/dev/null -stamp = { git update-ref $(1) HEAD 2>/dev/null || true; } -.PHONY: {% if layout == 'root' %}env recreate rebuild restart logs down deploy {% endif %}fmt check build pre-deploy post-deploy dev +.PHONY: {% if layout == 'root' %}env recreate rebuild restart logs down {% endif %}fmt check build dev fmt: bun run fix @@ -16,14 +13,6 @@ build: {% if serve == 'api' %} $(COMPOSE) run --rm frontend-dev sh -c "bun install && bun run build" {% else %} $(COMPOSE) build frontend {% endif %} -pre-deploy: - @if $(call changed,refs/deploy/frontend,.) || {% if serve == 'api' %}! test -d build{% else %}! docker image inspect $(IMAGE) >/dev/null 2>&1{% endif %}; then \ - $(MAKE) build && $(call stamp,refs/deploy/frontend); \ - fi - -post-deploy: - @: - dev: bun run dev {% if layout == 'root' %} @@ -52,8 +41,4 @@ logs: down: $(COMPOSE) down - -deploy: pre-deploy - $(COMPOSE) up -d - $(MAKE) post-deploy {% endif %} \ No newline at end of file diff --git a/template/{{ part_dir }}/{% if layout == 'root' %}README.md{% endif %}.jinja b/template/{{ part_dir }}/{% if layout == 'root' %}README.md{% endif %}.jinja index 82b771f..1f62336 100644 --- a/template/{{ part_dir }}/{% if layout == 'root' %}README.md{% endif %}.jinja +++ b/template/{{ part_dir }}/{% if layout == 'root' %}README.md{% endif %}.jinja @@ -1,16 +1,8 @@ # {{ project_name }} -Runs in Docker, locally the same way as in production. `COMPOSE_PROFILES` in `.env` selects the services that run on this machine. `docker-compose.override.yml` 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 dev # vite on the host +make check ``` - -`make env` creates `.env` and `docker-compose.override.yml` from their examples. `make recreate` starts the selected profiles, `make rebuild` builds the image first, `make logs`, `make restart` and `make down` do what they say. - -To deploy, `git pull && make deploy`. It runs `make pre-deploy`, which rebuilds the image only when something in the repository changed, then `docker compose up -d`. A deploy system with its own `up` step calls `make pre-deploy` before it and `make post-deploy` after. What was built is remembered as `refs/deploy/*` in the clone. - -In the fleet, production is deployed from `infra/komodo` instead (git mode of Komodo, see `docs/architecture.md` there): Komodo clones this repo, and a layer plus `deploy.sh` in the stack's directory tag images by the hash of what they bake in and write `.env` from sops. The repo only has to stay a plain recipe: images built from `build:` in compose, `caddy/site.caddy`. `make deploy` and `refs/deploy/*` are for a checkout deployed by hand. - -`make dev` runs the Vite dev server on the host, `make fmt` formats, `make check` runs svelte-check and the linter.