Compare commits

..

106 Commits

Author SHA1 Message Date
gitea 597cbd40f8 conjurer: deploy bot on its own [deploy]-gated image channel
The production bot now tracks conjurer-bot-deploy instead of conjurer-bot,
so it updates only when the conjurer CI promotes a build (commit message
contains [deploy]). Adds the image-updater 'deploy-bot' alias and the
kustomization images entry for it; DEPLOY-BOT.md documents the channel and
the one-time bootstrap. Test bot + librarian keep tracking every build.

Pairs with conjurer#20 (the CI promotion step).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 21:11:36 +02:00
argocd-image-updater 6983814a5c build: automatic update of conjurer
updates image gitea/conjurer-librarian tag 'f4dea535' to 'fbd1ec9f'
updates image gitea/conjurer-bot tag 'f4dea535' to 'fbd1ec9f'
2026-08-03 18:46:40 +00:00
argocd-image-updater cc3c2b512d build: automatic update of conjurer
updates image gitea/conjurer-librarian tag 'd4c6d78c' to 'f4dea535'
updates image gitea/conjurer-bot tag 'd4c6d78c' to 'f4dea535'
2026-08-03 18:38:32 +00:00
argocd-image-updater 4d8ca6f4fd build: automatic update of conjurer
updates image gitea/conjurer-bot tag 'ac16b77f' to 'd4c6d78c'
2026-08-03 17:50:23 +00:00
argocd-image-updater 311d5ae071 build: automatic update of conjurer
updates image gitea/conjurer-librarian tag 'ac16b77f' to 'd4c6d78c'
2026-08-03 17:48:20 +00:00
gitea 5b6040c60d conjurer: add CONJURER_SELF_CALLBACK to both bots (per-origin librarian answers)
Pairs with conjurer#18: each bot advertises its own callback so the shared
librarian answers results/pongs back to the bot that asked - test bot
http://192.168.1.73:32442, deploy bot :32443. No CONJURER_MAIN_BOT
repointing needed for the librarian anymore; DEPLOY-BOT.md updated (only
the musician stays single-target).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 17:47:32 +00:00
gitea 358356a1b1 conjurer: add production ('deploy') bot + data seeding/backup
A second Conjurer bot alongside the test one, sharing librarian/musician/
radio and the API key, differing only in:
 * Discord token from the deploy-conjurer-netrc secret,
 * distinct names/labels (deploy-bot) and NodePort 32443,
 * /data on an NFS export (RWX) instead of a block PVC - so config/state
   can be uploaded while it runs (copy onto the share) and backed up
   concurrently.

deploy-bot-backup: a daily CronJob that mirrors /data and keeps 30 days of
dated snapshots of the critical small state (both memories, settings,
accident log, transcripts) on NFS. Production only - the test bot's
amnesia is fine. DEPLOY-BOT.md documents seeding, backup/restore, and the
librarian/musician callback routing (they push to one bot; repoint
CONJURER_MAIN_BOT to :32443 to feed this one).

kubectl kustomize builds cleanly (10 objects).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 17:47:32 +00:00
argocd-image-updater 71133be104 build: automatic update of astrololo
updates image gitea/astrololo-presentation tag 'b36b3bee' to 'a9f2a038'
2026-08-03 16:52:05 +00:00
argocd-image-updater 05107b57de build: automatic update of astrololo
updates image gitea/astrololo-data tag 'a0d1135d' to 'b36b3bee'
updates image gitea/astrololo-logic tag 'a0d1135d' to 'b36b3bee'
updates image gitea/astrololo-presentation tag 'a0d1135d' to 'b36b3bee'
2026-08-03 15:47:48 +00:00
argocd-image-updater 630ce61be3 build: automatic update of conjurer
updates image gitea/conjurer-librarian tag 'c5643aa2' to 'ac16b77f'
updates image gitea/conjurer-bot tag 'c5643aa2' to 'ac16b77f'
2026-08-03 15:45:49 +00:00
argocd-image-updater a268cd392c build: automatic update of astrololo
updates image gitea/astrololo-data tag 'a0d1135d' to 'b36b3bee'
updates image gitea/astrololo-logic tag 'a0d1135d' to 'b36b3bee'
2026-08-03 15:45:46 +00:00
argocd-image-updater 056ebce791 build: automatic update of conjurer
updates image gitea/conjurer-librarian tag '40605b95' to 'c5643aa2'
updates image gitea/conjurer-bot tag '8e18071b' to 'c5643aa2'
2026-08-03 15:43:47 +00:00
gitea a7cab0acd7 conjurer: give librarian 60s termination grace for checkpointing
The librarian now checkpoints an in-progress search on SIGTERM and exits
within CONJURER_LIBRARIAN_GRACEFUL_TIMEOUT (default 45s). Raise k8s
terminationGracePeriodSeconds to 60 so that graceful checkpoint isn't cut
short by SIGKILL - otherwise the long DB scan restarts instead of resuming.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 15:42:10 +00:00
argocd-image-updater 87048cdbc4 build: automatic update of astrololo
updates image gitea/astrololo-data tag '8ebce816' to 'a0d1135d'
updates image gitea/astrololo-logic tag '8ebce816' to 'a0d1135d'
updates image gitea/astrololo-presentation tag '8ebce816' to 'a0d1135d'
2026-08-03 11:06:43 +00:00
argocd-image-updater 7a33250d98 build: automatic update of conjurer
updates image gitea/conjurer-librarian tag '8e18071b' to '40605b95'
2026-08-02 17:39:36 +00:00
gitea d94ad4a0dc conjurer: bump librarian memory limit 1Gi -> 2Gi (headroom)
The work-queue OOM is fixed in code (bounded queue), but a deep search
still loads up to 15000 Crossref records and the accumulating result
JSONs into RAM. Give 2Gi of headroom so a big search isn't OOM-killed;
raise the request to 512Mi to match its real baseline.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-02 19:36:14 +02:00
argocd-image-updater 791e745865 build: automatic update of conjurer
updates image gitea/conjurer-librarian tag '44b7298a' to '8e18071b'
updates image gitea/conjurer-bot tag '44b7298a' to '8e18071b'
2026-08-02 17:05:31 +00:00
argocd-image-updater 9fa72af1bf build: automatic update of conjurer
updates image gitea/conjurer-librarian tag '44b7298a' to '8ac68df1'
updates image gitea/conjurer-bot tag '44b7298a' to '8ac68df1'
2026-08-02 17:03:28 +00:00
argocd-image-updater abbba17dd0 build: automatic update of conjurer
updates image gitea/conjurer-librarian tag '5d321f2f' to '44b7298a'
updates image gitea/conjurer-bot tag '5d321f2f' to '44b7298a'
2026-08-02 15:33:09 +00:00
gitea b7f226062c conjurer: napraw drogę powrotną librarian/musician -> bot
Wyniki wyszukań (librarian) i eventy 'now playing' (musician) POST-owane do
bota ginęły, bo droga powrotna do bota była krucha:

* Service 'bot' był NodePort BEZ przypiętego nodePort -> k8s losował port z
  30000-32767 przy każdym (od)tworzeniu Service, a musician/betoniarka z
  Dockera adresują bota na sztywno http://192.168.1.73:32442. Rozjazd = każdy
  POST leci w zamknięty port. Przypinam nodePort: 32442.
* Librarian jest w tym samym klastrze co bot, a mimo to szedł przez nodePort
  węzła. Przełączam na DNS Service'u http://bot:5000 - odporne na
  przetasowania nodePortu (nodePort zostaje tylko dla zewnętrznych z Dockera).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-02 17:04:57 +02:00
gitea d84b982e0f fx 2026-08-01 20:44:00 +02:00
argocd-image-updater 83f928c278 build: automatic update of conjurer
updates image gitea/conjurer-bot tag 'defc482a' to '5d321f2f'
2026-08-01 17:16:14 +00:00
argocd-image-updater a0330b0b77 build: automatic update of conjurer
updates image gitea/conjurer-librarian tag 'defc482a' to '5d321f2f'
2026-08-01 17:14:12 +00:00
gitea e33d59b70c fx 2026-08-01 14:33:17 +02:00
argocd-image-updater 5d1be5398b build: automatic update of conjurer
updates image gitea/conjurer-librarian tag 'latest' to 'defc482a'
updates image gitea/conjurer-bot tag 'e1fca864' to 'defc482a'
2026-08-01 11:54:44 +00:00
gitea 70161cb7bd fx 2026-08-01 13:52:47 +02:00
argocd-image-updater 486e81a817 build: automatic update of conjurer
updates image gitea/conjurer-librarian tag 'latest' to 'defc482a'
2026-08-01 11:52:39 +00:00
argocd-image-updater 3d521a20c8 build: automatic update of conjurer
updates image gitea/conjurer-bot tag '3f4a1d50' to 'e1fca864'
2026-07-31 20:32:28 +00:00
argocd-image-updater 92c1683363 build: automatic update of conjurer
updates image gitea/conjurer-bot tag 'latest' to '3f4a1d50'
2026-07-31 18:15:55 +00:00
argocd-image-updater 627a8b5d7f build: automatic update of conjurer
updates image gitea/conjurer-bot tag 'latest' to 'e9e731e2'
2026-07-31 18:11:52 +00:00
argocd-image-updater 6c0213911d build: automatic update of conjurer
updates image gitea/conjurer-librarian tag '031c1f8a' to 'latest'
2026-07-30 17:43:53 +00:00
argocd-image-updater 814673390f build: automatic update of astrololo
updates image gitea/astrololo-render tag '8ebce816' to 'latest'
2026-07-30 17:31:41 +00:00
argocd-image-updater cab8bda7f8 build: automatic update of conjurer
updates image gitea/conjurer-bot tag '031c1f8a' to 'latest'
2026-07-30 17:11:02 +00:00
gitea aa4f015212 fx 2026-07-30 17:39:22 +02:00
argocd-image-updater 8ec74d1af0 build: automatic update of conjurer
updates image gitea/conjurer-bot tag 'f177dee4' to '031c1f8a'
2026-07-30 15:34:35 +00:00
argocd-image-updater bdb8a0cb0d build: automatic update of conjurer
updates image gitea/conjurer-librarian tag 'f177dee4' to '031c1f8a'
2026-07-30 15:26:22 +00:00
argocd-image-updater 268ea8359f build: automatic update of astrololo
updates image gitea/astrololo-render tag 'latest' to '8ebce816'
2026-07-30 15:17:47 +00:00
argocd-image-updater a88148f7d3 build: automatic update of astrololo
updates image gitea/astrololo-data tag '52b7c20c' to '8ebce816'
updates image gitea/astrololo-logic tag '52b7c20c' to '8ebce816'
updates image gitea/astrololo-presentation tag '52b7c20c' to '8ebce816'
2026-07-30 15:11:39 +00:00
argocd-image-updater 7b61f2e309 build: automatic update of astrololo
updates image gitea/astrololo-logic tag '9b1e4dbb' to '52b7c20c'
updates image gitea/astrololo-presentation tag '9b1e4dbb' to '52b7c20c'
2026-07-30 15:03:35 +00:00
argocd-image-updater 48250c7015 build: automatic update of astrololo
updates image gitea/astrololo-data tag 'f5dec15e' to '52b7c20c'
2026-07-30 15:01:31 +00:00
argocd-image-updater 6524258e1c build: automatic update of astrololo
updates image gitea/astrololo-render tag '998c83b2' to 'latest'
2026-07-30 11:38:30 +00:00
argocd-image-updater 6844dd5b55 build: automatic update of astrololo
updates image gitea/astrololo-render tag 'f5dec15e' to '998c83b2'
2026-07-30 09:42:47 +00:00
argocd-image-updater 311f1b2ce1 build: automatic update of astrololo
updates image gitea/astrololo-logic tag 'f5dec15e' to '9b1e4dbb'
updates image gitea/astrololo-presentation tag '4bdfb673' to '9b1e4dbb'
2026-07-29 00:06:27 +00:00
argocd-image-updater 3bd5ba7a81 build: automatic update of astrololo
updates image gitea/astrololo-presentation tag 'f5dec15e' to '4bdfb673'
2026-07-28 23:36:09 +00:00
argocd-image-updater dda554d98c build: automatic update of astrololo
updates image gitea/astrololo-data tag '998c83b2' to 'f5dec15e'
updates image gitea/astrololo-logic tag '998c83b2' to 'f5dec15e'
updates image gitea/astrololo-presentation tag '495f3734' to 'f5dec15e'
updates image gitea/astrololo-render tag 'latest' to 'f5dec15e'
2026-07-28 19:50:13 +00:00
argocd-image-updater a60dd816e8 build: automatic update of astrololo
updates image gitea/astrololo-render tag 'latest' to 'f5dec15e'
2026-07-28 19:48:08 +00:00
argocd-image-updater 3aba21d062 build: automatic update of astrololo
updates image gitea/astrololo-presentation tag '998c83b2' to '495f3734'
2026-07-28 18:29:32 +00:00
argocd-image-updater 615293b916 build: automatic update of astrololo
updates image gitea/astrololo-data tag '623603b1' to '998c83b2'
updates image gitea/astrololo-logic tag '623603b1' to '998c83b2'
updates image gitea/astrololo-presentation tag '4b17f2dd' to '998c83b2'
2026-07-28 16:27:02 +00:00
argocd-image-updater a2bd1e0202 build: automatic update of astrololo
updates image gitea/astrololo-data tag '623603b1' to '998c83b2'
updates image gitea/astrololo-logic tag '623603b1' to '998c83b2'
2026-07-28 16:24:58 +00:00
argocd-image-updater 073ed904e9 build: automatic update of astrololo
updates image gitea/astrololo-data tag '623603b1' to '998c83b2'
updates image gitea/astrololo-render tag '56131b20' to 'latest'
2026-07-28 16:22:44 +00:00
argocd-image-updater 494b49b9ac build: automatic update of astrololo
updates image gitea/astrololo-render tag '56131b20' to 'latest'
2026-07-28 16:18:33 +00:00
argocd-image-updater 14e62adc94 build: automatic update of conjurer
updates image gitea/conjurer-librarian tag 'e243777e' to 'f177dee4'
updates image gitea/conjurer-bot tag 'e243777e' to 'f177dee4'
2026-07-28 13:51:02 +00:00
argocd-image-updater 3dccbeb27d build: automatic update of conjurer
updates image gitea/conjurer-librarian tag 'e243777e' to 'f177dee4'
2026-07-28 13:48:55 +00:00
gitea 00ce859105 2 2026-07-28 15:37:48 +02:00
gitea d4dda58492 1 2026-07-28 15:34:12 +02:00
gitea 182c579664 Fix updater 2026-07-28 14:21:00 +02:00
argocd-image-updater 2f4e8d1799 build: automatic update of conjurer
updates image gitea/conjurer-bot tag 'c8aae106' to 'e243777e'
2026-07-28 12:17:50 +00:00
gitea 65d1d0c4d8 imageupdater 2026-07-28 14:10:07 +02:00
gitea 8020eb6b05 bot 2026-07-28 13:56:46 +02:00
gitea 327028ce42 bot 2026-07-28 13:40:49 +02:00
gitea 4fa3700f9c Libr 2026-07-28 13:28:38 +02:00
gitea 31a97615a3 Libr 2026-07-28 13:25:04 +02:00
gitea 19ed73cd11 Libr 2026-07-28 11:22:00 +00:00
argocd-image-updater 303be20455 build: automatic update of astrololo
updates image gitea/astrololo-render tag 'latest' to '56131b20'
2026-07-26 19:32:42 +00:00
argocd-image-updater a092350b3b build: automatic update of astrololo
updates image gitea/astrololo-presentation tag '623603b1' to '4b17f2dd'
2026-07-25 23:58:48 +00:00
gitea 3df1170f5d chore(astrololo): manifest CRD image-updater w repo (ślad tego, co śledzimy)
Konfiguracja argocd-image-updater istniała tylko w klastrze (ręczne `kubectl
apply`, brak w git). Skutkiem był PRE-24: `render` zbudował się i zdeployował raz,
ale kolejne buildy nie schodziły — bo nie było go na JAWNEJ liście obserwowanych
obrazów CRD, a nigdzie nie dało się tego podejrzeć ani odtworzyć.

Zrzucam manifest (z `render` już w środku, 4 obrazy: data/logic/presentation/
render) do `astrololo/image-updater.yaml` + opis w README.

Plik CELOWO nie jest w kustomization.yaml: resource stoi w ns `argocd` (poza
namespace docelowym aplikacji), a to konfiguracja kontrolera wdrażającego tę
aplikację — nakładany ręcznie (`kubectl apply -f astrololo/image-updater.yaml`),
w repo dla odtwarzalności i historii. Dodanie nowej usługi = dopisanie wpisu tutaj.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-26 00:02:53 +02:00
argocd-image-updater 39185c128b build: automatic update of astrololo
updates image gitea/astrololo-data tag '171deff2' to '623603b1'
updates image gitea/astrololo-logic tag '171deff2' to '623603b1'
updates image gitea/astrololo-presentation tag '171deff2' to '623603b1'
2026-07-25 19:08:50 +00:00
argocd-image-updater 3fe5c33366 build: automatic update of astrololo
updates image gitea/astrololo-data tag '15964dd0' to '171deff2'
updates image gitea/astrololo-logic tag '15964dd0' to '171deff2'
updates image gitea/astrololo-presentation tag '15964dd0' to '171deff2'
2026-07-25 16:33:55 +00:00
argocd-image-updater a38c6d2fc6 build: automatic update of astrololo
updates image gitea/astrololo-data tag 'f24616d3' to '15964dd0'
updates image gitea/astrololo-logic tag 'f24616d3' to '15964dd0'
updates image gitea/astrololo-presentation tag 'f24616d3' to '15964dd0'
2026-07-25 15:07:14 +00:00
gitea 57d0cca6f9 feat(astrololo): usluga render — raport PDF (PRE-24)
Nowy komponent skladajacy raport PDF. Osobny obraz, bo dzwiga TeX Live (setki MB)
— ta sama zasada co przy izolacji swissepha (LOG-27): obraz produktu zostaje maly,
TeX aktualizuje sie niezaleznie, a awaria renderu nie kladzie aplikacji, tylko
przycisk „Pobierz PDF".

- render.yaml — Deployment + Service. ClusterIP, BEZ NodePortu i Ingressu: nie ma
  powodu, zeby ktokolwiek siegal do tej uslugi z zewnatrz. Rozmawia wylacznie
  z prezentacja.
- Szyfrowanie: wlasny, TRZECI klucz LINK_KEY_PRESENTATION_RENDER z sekretu
  astrololo-link. Osobny, bo tym laczem plynie CALY raport (dane urodzeniowe
  i opisy z baz) — przejecie go nie moze otwierac lacza do logiki ani danych.
  LINK_ENCRYPTION_REQUIRED=true, wiec bez klucza pod NIE wstaje.
- readOnlyRootFilesystem + emptyDir na /tmp: kompilacja pisze tylko do katalogu
  tymczasowego, raport nie zostawia sladu w kontenerze.
- Limity rozjechane celowo (100m/256Mi -> 1500m/1Gi): XeLaTeX na obszernym
  raporcie bierze duzo, ale na krotko.
- presentation: RENDER_URL + trzeci klucz lacza.

Sekret astrololo-link trzeba UZUPELNIC o trzeci klucz PRZED wdrozeniem,
zachowujac dwa dotychczasowe — komenda w instrukcji.

Sprawdzone: kubectl kustomize + apply --dry-run=server na zywym klastrze
(service/render i deployment.apps/render created).

Pelna instrukcja: docs/wdrozenie-render-pdf.md w repo astrololo.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-25 15:09:27 +02:00
argocd-image-updater d137a49e28 build: automatic update of astrololo
updates image gitea/astrololo-data tag 'f34016a4' to 'f24616d3'
updates image gitea/astrololo-logic tag 'f34016a4' to 'f24616d3'
updates image gitea/astrololo-presentation tag '6c9029c4' to 'f24616d3'
2026-07-25 11:27:32 +00:00
argocd-image-updater e26d888c01 build: automatic update of astrololo
updates image gitea/astrololo-presentation tag '8cc329ab' to '6c9029c4'
2026-07-24 19:22:23 +00:00
argocd-image-updater db0c9b16e6 build: automatic update of astrololo
updates image gitea/astrololo-presentation tag '76fbdefe' to '8cc329ab'
2026-07-24 19:08:14 +00:00
argocd-image-updater 71dd1b24c3 build: automatic update of astrololo
updates image gitea/astrololo-presentation tag 'f34016a4' to '76fbdefe'
2026-07-24 18:21:46 +00:00
argocd-image-updater 9ced57af74 build: automatic update of astrololo
updates image gitea/astrololo-data tag 'f1956a08' to 'f34016a4'
updates image gitea/astrololo-logic tag '40c9bf79' to 'f34016a4'
updates image gitea/astrololo-presentation tag '40c9bf79' to 'f34016a4'
2026-07-24 16:28:32 +00:00
argocd-image-updater 385b675e27 build: automatic update of astrololo
updates image gitea/astrololo-logic tag '1d7f3e21' to '40c9bf79'
updates image gitea/astrololo-presentation tag '1d7f3e21' to '40c9bf79'
2026-07-24 14:37:55 +00:00
argocd-image-updater 240d79f8b2 build: automatic update of astrololo
updates image gitea/astrololo-logic tag 'ace76183' to '1d7f3e21'
updates image gitea/astrololo-presentation tag 'ace76183' to '1d7f3e21'
2026-07-24 12:34:55 +00:00
argocd-image-updater 37ea8d6997 build: automatic update of astrololo
updates image gitea/astrololo-logic tag 'f1956a08' to 'ace76183'
updates image gitea/astrololo-presentation tag 'f1956a08' to 'ace76183'
2026-07-24 11:04:20 +00:00
argocd-image-updater 86ea5b6147 build: automatic update of astrololo
updates image gitea/astrololo-data tag 'e8f868e9' to 'f1956a08'
updates image gitea/astrololo-logic tag 'e8f868e9' to 'f1956a08'
updates image gitea/astrololo-presentation tag 'e8f868e9' to 'f1956a08'
2026-07-23 21:01:53 +00:00
argocd-image-updater 9d5f318272 build: automatic update of astrololo
updates image gitea/astrololo-data tag '56fdf01d' to 'e8f868e9'
updates image gitea/astrololo-logic tag '56fdf01d' to 'e8f868e9'
updates image gitea/astrololo-presentation tag '56fdf01d' to 'e8f868e9'
2026-07-23 20:39:41 +00:00
gitea a075f9555f feat(astrololo): klucze szyfrowania lacz miedzy warstwami (PRE-16)
Domyka PRE-16 po stronie manifestow. Kod (astrololo#21) potrafi juz szyfrowac
ruch miedzy warstwami AES-256-GCM; tu dokladamy klucze i wymuszenie.

- astrololo-link: nowy sekret z dwoma kluczami (LINK_KEY_PRESENTATION_LOGIC,
  LINK_KEY_LOGIC_DATA), tworzony POZA repo jak pozostale. Osobny klucz na pare
  rozmowcow: przejecie klucza prezentacji nie otwiera warstwy danych. Logika
  bierze oba, prezentacja i dane wylacznie swoj (secretKeyRef).
- LINK_ENCRYPTION_REQUIRED=true we wszystkich trzech: bez klucza pod NIE wstaje,
  a klient nie wysyla niczego. Fail-closed w obie strony jest celowy — usluga,
  ktora wstala i po cichu nie szyfruje, jest gorsza niz CrashLoop, bo awarii
  nie widac.

README: sekcja o sekrecie astrololo-link (tworzenie, wymiana, restart calej
trojki naraz) oraz uczciwa nota, ze szyfrowane sa ciala, nie naglowki — sciezka
i token jada czytelnie, ale sam token bez klucza nic nie daje.

Sprawdzone: kubectl kustomize + apply --dry-run=server przechodza dla obu
profili. Pelna instrukcja wdrozenia: docs/wdrozenie-pre16.md w repo astrololo.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 16:40:43 +00:00
gitea 2d30d9a84d feat(astrololo): wejscie po https z wlasnym CA (PRE-16)
Do tej pory aplikacja chodzila po zwyklym http, a logowanie szlo przez HTTP
Basic — czyli haslo leciało siecia w postaci trywialnej do podsluchania.

Poza bezpieczenstwem TLS naprawia DWIE funkcje zepsute dzis z tego samego
powodu: geolokalizacja przegladarki („Tu i teraz") i kopiowanie promptu do
schowka dzialaja wylacznie w secure context, wiec po http po prostu odmawialy.

Wlasne CA, nie Let's Encrypt — klaster stoi w LAN (traefik trzyma LoadBalancera
na 192.168.1.x), wiec walidacja HTTP-01 nie ma jak dojsc z internetu, a DNS-01
wymagalby trzymania w klastrze tokena API do domeny.

Co dochodzi:
- tls.yaml — Issuer selfSigned -> korzen CA (10 lat, importowany raz do
  przegladarki) -> Issuer CA -> certyfikat serwera (90 dni, odnawiany sam).
  Krotki termin certyfikatu serwera jest CELOWY: odnawianie sprawdza sie wtedy
  co kwartal, a nie dopiero za dekade.
- ingress.yaml — wejscie po https + naglowki (HSTS rok, nosniff, frameDeny)
  oraz osobny Ingress na porcie 80 robiacy przekierowanie. Rozdzielone
  swiadomie: gdyby redirect wisial na tym samym routerze co wejscie po https,
  odsylalby sam do siebie w kolko.
- presentation: Service NodePort -> ClusterIP. NodePort byl druga,
  nieszyfrowana droga do aplikacji, czyli obejsciem calego PRE-16.

Zmiana wymagajaca uwagi: TRUST_PROXY=true. Za Ingressem bezposrednim rozmowca
jest zawsze pod Traefika, wiec bez tego limit zadan liczylby WSZYSTKICH do
jednego wiadra i pierwsza osoba, ktora go wyklika, odcielaby pozostalych.

Sprawdzone: Ingress i Middleware przechodza `kubectl apply --dry-run=server`
na zywym klastrze (CRD traefik.io/v1alpha1 sa, entrypointy web/websecure sa).
Obiekty cert-managera zwalidowane offline wobec oficjalnego schematu z CRD
v1.21.0 z additionalProperties=false — literowka w nazwie pola zostalaby
zlapana. `kubectl kustomize` przechodzi dla obu profili (bazowego i swisseph).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 16:40:43 +00:00
argocd-image-updater 6c41782b4b build: automatic update of astrololo
updates image gitea/astrololo-logic tag '473d059a' to '56fdf01d'
updates image gitea/astrololo-presentation tag '473d059a' to '56fdf01d'
2026-07-23 15:53:47 +00:00
argocd-image-updater 5096aa98c0 build: automatic update of astrololo
updates image gitea/astrololo-data tag '929b6912' to '56fdf01d'
2026-07-23 15:51:41 +00:00
argocd-image-updater d74e2af355 build: automatic update of astrololo
updates image gitea/astrololo-logic tag '929b6912' to '473d059a'
updates image gitea/astrololo-presentation tag '929b6912' to '473d059a'
2026-07-23 13:36:47 +00:00
argocd-image-updater ffa617e17b build: automatic update of astrololo
updates image gitea/astrololo-data tag '877ec91f' to '929b6912'
updates image gitea/astrololo-logic tag '114b7eeb' to '929b6912'
updates image gitea/astrololo-presentation tag '114b7eeb' to '929b6912'
2026-07-23 13:10:29 +00:00
argocd-image-updater 07a536a315 build: automatic update of astrololo
updates image gitea/astrololo-logic tag '163ace42' to '114b7eeb'
updates image gitea/astrololo-presentation tag '163ace42' to '114b7eeb'
2026-07-23 11:57:48 +00:00
argocd-image-updater affd8b60ff build: automatic update of astrololo
updates image gitea/astrololo-presentation tag '877ec91f' to '163ace42'
2026-07-22 20:31:22 +00:00
argocd-image-updater 584340b82d build: automatic update of astrololo
updates image gitea/astrololo-logic tag '877ec91f' to '163ace42'
2026-07-22 20:29:16 +00:00
argocd-image-updater 570f879c77 build: automatic update of astrololo
updates image gitea/astrololo-data tag '752f477a' to '877ec91f'
updates image gitea/astrololo-logic tag '5203ba9e' to '877ec91f'
updates image gitea/astrololo-presentation tag '64d1afc7' to '877ec91f'
2026-07-22 19:18:28 +00:00
gitea 90bfff18df feat(astrololo): klucze do modeli w chmurze + konfiguracja modelu lokalnego
Domyslnie dziala model LOKALNY i nic nie opuszcza sieci. Zeby dalo sie wybrac
w UI OpenAI albo Anthropic, logika potrzebuje ich kluczy.

- LLM_PROVIDER=local, LOCAL_BASE_URL, LOCAL_MODEL, LLM_TIMEOUT, LLM_MAX_TOKENS
  jawnie (nie sa tajne),
- OPENAI_API_KEY i ANTHROPIC_API_KEY z osobnego sekretu `astrololo-llm`.

Sekret jest OPCJONALNY (optional: true) — inaczej niz `astrololo-auth`. Auth to
zabezpieczenie i ma zatrzymac pody, gdy go brak; klucze do chmury to funkcja,
wiec ich brak nie moze wywracac wdrozenia. Bez nich pody startuja normalnie,
tylko chmura jest niedostepna.

Osobny sekret, a nie doklejenie do astrololo-auth, zeby klucze LLM dalo sie
wymieniac bez dotykania hasla i tokenu miedzywarstwowego.

Zwalidowane kubectl kustomize; w wyniku nadal zadnego `kind: Secret`.
Instrukcja tworzenia i podmiany kluczy w astrololo/README.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 15:34:57 +00:00
argocd-image-updater ef4ba6d83a build: automatic update of astrololo
updates image gitea/astrololo-logic tag '64d1afc7' to '5203ba9e'
2026-07-22 15:18:19 +00:00
argocd-image-updater 8af10ce98a build: automatic update of astrololo
updates image gitea/astrololo-logic tag '4ef90b30' to '64d1afc7'
updates image gitea/astrololo-presentation tag '4ef90b30' to '64d1afc7'
2026-07-21 22:15:54 +00:00
argocd-image-updater 6b98f566eb build: automatic update of astrololo
updates image gitea/astrololo-logic tag '73fd41b9' to '4ef90b30'
updates image gitea/astrololo-presentation tag '752f477a' to '4ef90b30'
2026-07-21 19:40:29 +00:00
argocd-image-updater a386674078 build: automatic update of astrololo
updates image gitea/astrololo-logic tag '04b26afa' to '73fd41b9'
updates image gitea/astrololo-presentation tag '04b26afa' to '752f477a'
2026-07-21 18:35:56 +00:00
argocd-image-updater 2594183c39 build: automatic update of astrololo
updates image gitea/astrololo-logic tag '04b26afa' to '752f477a'
updates image gitea/astrololo-presentation tag '04b26afa' to '752f477a'
2026-07-21 17:29:23 +00:00
argocd-image-updater 32b4387d5c build: automatic update of astrololo
updates image gitea/astrololo-data tag 'de5d5895' to '752f477a'
2026-07-21 17:27:21 +00:00
gitea 66d174703e feat(astrololo): sekrety logowania i tokenu miedzywarstwowego (LOG-32)
Domyka od strony wdrozenia ochrone dodana w aplikacji (PR #10 w repo astrololo).
Bez tych zmiennych aplikacja startuje OTWARTA, a wystawia tresc oryginalnych
baz interpretacyjnych.

- presentation: APP_PASSWORD + INTERNAL_TOKEN z sekretu, APP_USER i
  RATE_LIMIT_PER_MIN jawnie (nie sa tajne).
- logic, data: INTERNAL_TOKEN z sekretu — bez niego da sie ominac logowanie,
  uderzajac wprost w warstwe nizej. Warstwa danych oddaje SUROWE wiersze,
  wiec to najwrazliwszy punkt.

WARTOSCI SEKRETOW CELOWO NIE TRAFIAJA DO REPO — to GitOps, wiec zostalyby
w historii gita na zawsze i przekreslily caly sens tej zmiany. Manifesty
tylko odwoluja sie do sekretu `astrololo-auth`, tworzonego poza repo — ta sama
konwencja co istniejacy `gitea-registry`.

UWAGA: sekret jest WYMAGANY (bez `optional: true`), wiec pody nie wstana,
dopoki go nie utworzysz. To swiadome: lepsza widoczna awaria niz cichy start
bez ochrony. Instrukcja tworzenia i zmiany hasla w astrololo/README.md.

Przy okazji: poprawiony mylacy komentarz przy EXCEL_DIR — pliki baz ida
z NFS, nie z obrazu (montaz je nadpisuje).

Zwalidowane `kubectl kustomize` dla bazy i profilu swisseph: sekrety trafiaja
do wlasciwych uslug, a w wyniku nie ma zadnego `kind: Secret`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 17:06:16 +00:00
argocd-image-updater fec8fae922 build: automatic update of astrololo
updates image gitea/astrololo-logic tag '6f87b2b3' to '04b26afa'
updates image gitea/astrololo-presentation tag '6f87b2b3' to '04b26afa'
2026-07-21 16:52:54 +00:00
argocd-image-updater b686837d19 build: automatic update of astrololo
updates image gitea/astrololo-logic tag 'de5d5895' to '6f87b2b3'
updates image gitea/astrololo-presentation tag 'a2aabd37' to '6f87b2b3'
2026-07-21 14:35:50 +00:00
argocd-image-updater fb332c4e75 build: automatic update of astrololo
updates image gitea/astrololo-logic tag 'de5d5895' to '6f87b2b3'
2026-07-21 14:33:47 +00:00
argocd-image-updater 69ac1aa90b build: automatic update of astrololo
updates image gitea/astrololo-presentation tag 'de5d5895' to 'a2aabd37'
2026-07-21 01:57:20 +00:00
argocd-image-updater 6405a2544c build: automatic update of astrololo
updates image gitea/astrololo-data tag 'c75f8377' to 'de5d5895'
updates image gitea/astrololo-logic tag 'ab6fc072' to 'de5d5895'
updates image gitea/astrololo-presentation tag 'ab6fc072' to 'de5d5895'
2026-07-21 01:18:43 +00:00
gitea d3b518273a feat(astrololo): profil deployu swisseph (silnik B, AGPL)
Drugi, opcjonalny wariant deployu: ten sam stack co produkcja, ale logic
liczy na Swiss Ephemeris zamiast na wlasnym Skyfieldzie.

Overlay Kustomize nad ../astrololo:
- dokłada usluge engine-swisseph (Deployment + Service, ClusterIP — bez
  wejscia z zewnatrz, izolacja AGPL: rozmawia z nia tylko logic),
- patchuje logic: EPHEMERIS_ENGINE=swisseph + ENGINE_SWISSEPH_URL (wlacza
  tez /chart/compare, LOG-25/26),
- tagi data/logic/presentation dziedziczy z bazy (sledzi wersje produkcji).

Aktywacja przez wskazanie GitOps na katalog astrololo-swisseph zamiast
astrololo (profil zastepujacy baze w tym samym ns). Szczegoly w README.
Zwalidowane `kubectl kustomize` (9 obiektow, env logica i ClusterIP OK).

Wymaga obrazu astrololo-engine-swisseph w registry — buduje go osobny
workflow w repo astrololo (PR rownolegly).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 01:02:28 +00:00
argocd-image-updater b8c9d96edf build: automatic update of astrololo
updates image gitea/astrololo-logic tag '6ced2ddd' to 'ab6fc072'
updates image gitea/astrololo-presentation tag '6ced2ddd' to 'ab6fc072'
2026-07-21 00:18:13 +00:00
argocd-image-updater cfeb47020d build: automatic update of astrololo
updates image gitea/astrololo-logic tag 'c75f8377' to '6ced2ddd'
updates image gitea/astrololo-presentation tag 'c75f8377' to '6ced2ddd'
2026-07-20 18:52:05 +00:00
17 changed files with 1019 additions and 5 deletions
+228
View File
@@ -0,0 +1,228 @@
# astrololo — deploy (namespace `astrololo`)
Manifesty k8s składane Kustomize. Obrazy podbija automatycznie image-updater
(`kustomization.yaml``images: newTag`) po każdym buildzie z repo aplikacji.
Warstwy: `presentation` (wejście z przeglądarki przez **Ingress po https**) →
`logic``data` (pliki Excel montowane **z NFS**, nie z obrazu).
Adres aplikacji: **https://astrololo.czernobog.pl** — patrz [TLS](#-tls--wymagane-kroki-przed-wdrożeniem).
## Co śledzi image-updater — [`image-updater.yaml`](image-updater.yaml)
Lista obrazów podbijanych automatycznie jest **jawna** i żyje w CRD `ImageUpdater`
(ns `argocd`). Obraz, którego na niej nie ma, **nigdy się nie podbije**, choćby CI
go budowało — tak przez chwilę wisiał `render` na `:latest`, zanim dopisaliśmy go do
listy. Dodając nową usługę, dopisz jej wpis w `image-updater.yaml` i nałóż:
```bash
kubectl apply -f astrololo/image-updater.yaml
```
Ten plik **celowo nie jest w `kustomization.yaml`**: resource stoi w ns `argocd`
(poza namespace docelowym aplikacji), a to konfiguracja kontrolera, który wdraża tę
aplikację — nakładamy go ręcznie, w repo trzymamy dla odtwarzalności i historii.
## ⚠️ Sekret `astrololo-auth` — utwórz PRZED wdrożeniem
Aplikacja wystawia treść **oryginalnych baz interpretacyjnych**, dlatego wymaga
logowania i tokenu międzywarstwowego (LOG-32). Manifesty odwołują się do sekretu
`astrololo-auth` i **celowo nie zawierają jego wartości** — to repo GitOps, więc
cokolwiek by tu wpadło, zostałoby w historii gita na zawsze.
To ta sama konwencja co `gitea-registry`: sekret tworzymy poza repo.
**Pody nie wstaną bez tego sekretu — i tak ma być.** Wolimy widoczną awarię niż
cichy start aplikacji bez ochrony.
```bash
# hasło wczytane bez zapisu w historii powłoki
read -rs -p "Hasło do aplikacji (APP_PASSWORD): " APP_PASSWORD; echo
kubectl -n astrololo create secret generic astrololo-auth \
--from-literal=APP_PASSWORD="$APP_PASSWORD" \
--from-literal=INTERNAL_TOKEN="$(openssl rand -hex 32)"
unset APP_PASSWORD
```
`INTERNAL_TOKEN` jest losowany i **nikt go nigdy nie musi oglądać** — służy tylko
usługom do rozmowy między sobą. `APP_PASSWORD` wpisujesz w przeglądarce
(użytkownik: `astrololo`, zmienny przez `APP_USER` w `presentation.yaml`).
### Zmiana hasła
```bash
read -rs -p "Nowe hasło: " NEW; echo
kubectl -n astrololo create secret generic astrololo-auth \
--from-literal=APP_PASSWORD="$NEW" \
--from-literal=INTERNAL_TOKEN="$(kubectl -n astrololo get secret astrololo-auth \
-o jsonpath='{.data.INTERNAL_TOKEN}' | base64 -d)" \
--dry-run=client -o yaml | kubectl apply -f -
kubectl -n astrololo rollout restart deploy/presentation
unset NEW
```
(Zachowujemy istniejący `INTERNAL_TOKEN`; jego zmiana wymaga restartu **wszystkich
trzech** usług naraz, inaczej przestaną się dogadywać.)
### Sprawdzenie po wdrożeniu
```bash
kubectl -n astrololo rollout status deploy/presentation deploy/logic deploy/data
curl -s -o /dev/null -w "bez hasła: %{http_code}\n" https://astrololo.czernobog.pl/
curl -s -o /dev/null -w "z hasłem: %{http_code}\n" -u astrololo:'<hasło>' https://astrololo.czernobog.pl/
```
Oczekiwane: **401** bez hasła, **200** z hasłem. `/health` zostaje publiczny (sondy k8s).
## 🔒 TLS — wymagane kroki przed wdrożeniem
Do tej pory Basic Auth szedł siecią po zwykłym http, czyli **hasło dało się
podsłuchać** (base64 to nie szyfrowanie). Poza tym http blokował dwie funkcje,
bo przeglądarki udostępniają je wyłącznie w tzw. *secure context*:
**geolokalizacja** („Tu i teraz") i **kopiowanie do schowka**. Certyfikat załatwia
oba tematy naraz.
Certyfikat wystawia **własne CA** trzymane w klastrze (cert-manager). Let's Encrypt
odpada, bo klaster stoi w LAN — walidacja HTTP-01 nie ma jak do niego dojść z
internetu, a DNS-01 wymagałby trzymania tu tokena API do domeny.
**Kolejność ma znaczenie — oba kroki PRZED synchronizacją ArgoCD.**
### 1. cert-manager (jednorazowo, cały klaster)
```bash
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.21.0/cert-manager.yaml
kubectl -n cert-manager rollout status deploy/cert-manager deploy/cert-manager-webhook
```
Bez tego API odrzuci `Certificate` i `Issuer` jako nieznane rodzaje zasobów,
a ArgoCD pokaże aplikację jako niezsynchronizowaną.
### 2. DNS: `astrololo.czernobog.pl` → adres Traefika
```bash
kubectl -n kube-system get svc traefik -o jsonpath='{.status.loadBalancer.ingress[*].ip}'; echo
```
Wpis w routerze / lokalnym DNS-ie (albo doraźnie `/etc/hosts`). **Service
`presentation` jest teraz `ClusterIP`** — NodePort był drugą, nieszyfrowaną drogą
do aplikacji, więc został zdjęty. Zanim DNS zacznie odpowiadać, jedyne wejście to:
```bash
kubectl -n astrololo port-forward svc/presentation 8000:8000 # awaryjnie, http://localhost:8000
```
### 3. Zaufanie do własnego CA (raz na urządzenie)
Bez tego przeglądarka pokaże ostrzeżenie o certyfikacie. Korzeń ważny 10 lat,
więc import robisz raz:
```bash
kubectl -n astrololo get secret astrololo-ca -o jsonpath='{.data.ca\.crt}' \
| base64 -d > astrololo-ca.crt
# macOS — do systemowego zaufania (poprosi o hasło administratora)
sudo security add-trusted-cert -d -r trustRoot \
-k /Library/Keychains/System.keychain astrololo-ca.crt
# Linux (Debian/Ubuntu)
sudo cp astrololo-ca.crt /usr/local/share/ca-certificates/ && sudo update-ca-certificates
```
Firefox ma własny magazyn — tam import przez *Ustawienia → Prywatność →
Wyświetl certyfikaty → Organy certyfikacji*.
### Sprawdzenie samego TLS
```bash
# certyfikat wystawiony i gotowy
kubectl -n astrololo get certificate
# oczekiwane: astrololo-ca True, astrololo-tls True
# http odsyła na https
curl -sI http://astrololo.czernobog.pl/ | head -2 # 301 + Location: https://...
# HSTS obecny
curl -skI -u astrololo:'<hasło>' https://astrololo.czernobog.pl/ | grep -i strict-transport
```
### Odnawianie
Certyfikat serwera żyje 90 dni i odnawia się sam 30 dni przed końcem. Termin jest
krótki **celowo** — odnawianie sprawdza się wtedy w praktyce co kwartał, a nie
dopiero za dziesięć lat, gdy nikt nie będzie pamiętał, jak to było skonfigurowane.
## ⚠️ Sekret `astrololo-link` — szyfrowanie między warstwami
Token międzywarstwowy mówi **kto** pyta, ale nie ukrywa **czego dotyczy odpowiedź**
— a płyną nią surowe wiersze oryginalnych baz. Kto podsłuchał ruch wewnątrz sieci
(drugi pod, mirror portu na switchu, zrzut z węzła), miał je w całości. Łącza są
więc szyfrowane **AES-256-GCM**, osobnym kluczem na każdą parę rozmówców.
```bash
kubectl -n astrololo create secret generic astrololo-link \
--from-literal=LINK_KEY_PRESENTATION_LOGIC="$(openssl rand -hex 32)" \
--from-literal=LINK_KEY_LOGIC_DATA="$(openssl rand -hex 32)"
```
Kluczy **nikt nigdy nie musi oglądać** — służą tylko usługom. Rozdzielenie jest
celowe: przejęcie klucza prezentacji nie daje dostępu do warstwy danych, gdzie
leżą całe bazy. Logika trzyma oba, bo rozmawia w obie strony; prezentacja i dane
dostają przez `secretKeyRef` wyłącznie swój.
**Pody nie wstaną bez tych kluczy** (`LINK_ENCRYPTION_REQUIRED=true`) — i tak ma
być. Usługa, która wstała i po cichu nie szyfruje, jest gorsza niż pod w CrashLoop,
bo awarii nie widać.
### Wymiana kluczy
```bash
kubectl -n astrololo create secret generic astrololo-link \
--from-literal=LINK_KEY_PRESENTATION_LOGIC="$(openssl rand -hex 32)" \
--from-literal=LINK_KEY_LOGIC_DATA="$(openssl rand -hex 32)" \
--dry-run=client -o yaml | kubectl apply -f -
kubectl -n astrololo rollout restart deploy/presentation deploy/logic deploy/data
```
Restart **wszystkich trzech naraz** — w trakcie wymiany warstwy chwilowo się nie
dogadują (klucze muszą być zgodne po obu stronach łącza).
## Klucze do modeli w chmurze — sekret `astrololo-llm` (opcjonalny)
Domyślnie działa **model lokalny** i nic nie opuszcza sieci. Żeby móc wybrać w UI
OpenAI lub Anthropic, potrzebne są ich klucze. Ten sekret jest **opcjonalny**
(`optional: true`) — bez niego pody startują normalnie, tylko chmura jest niedostępna.
```bash
read -rs -p "OPENAI_API_KEY (Enter = pomiń): " OPENAI_KEY; echo
read -rs -p "ANTHROPIC_API_KEY (Enter = pomiń): " ANTHROPIC_KEY; echo
kubectl -n astrololo create secret generic astrololo-llm \
--from-literal=OPENAI_API_KEY="$OPENAI_KEY" \
--from-literal=ANTHROPIC_API_KEY="$ANTHROPIC_KEY"
unset OPENAI_KEY ANTHROPIC_KEY
kubectl -n astrololo rollout restart deploy/logic # klucze wstrzykują się przy starcie
```
Podmiana pojedynczego klucza (bez kasowania drugiego):
```bash
kubectl -n astrololo create secret generic astrololo-llm \
--from-literal=OPENAI_API_KEY="$(kubectl -n astrololo get secret astrololo-llm \
-o jsonpath='{.data.OPENAI_API_KEY}' | base64 -d)" \
--from-literal=ANTHROPIC_API_KEY='NOWY-KLUCZ' \
--dry-run=client -o yaml | kubectl apply -f -
kubectl -n astrololo rollout restart deploy/logic
```
**Adres modelu lokalnego** ustawia `LOCAL_BASE_URL` w `logic.yaml` — dopasuj do miejsca,
gdzie faktycznie stoi Ollama/vLLM. Konfiguracja jest **per dostawca**
(`LOCAL_*`, `OPENAI_*`, `ANTHROPIC_*`), więc ustawienia lokalnego modelu nie przejmują
żądań do chmury.
> Wybór dostawcy w chmurze oznacza, że **oryginalne opisy z baz opuszczają naszą sieć**.
> Prompt można obejrzeć przed wysłaniem. Warto zawnioskować u dostawcy o Zero Data
> Retention — patrz LOG-32.
## Czego to nie załatwia
- **Własne CA to nie to samo co publiczne zaufanie** — każde nowe urządzenie
wymaga importu korzenia (krok 3 powyżej). Gdyby aplikacja miała kiedyś wyjść
na świat, właściwą drogą jest Let's Encrypt przez DNS-01.
- **Szyfrowane są ciała żądań, nie nagłówki** — ścieżka (`/search`) i token
międzywarstwowy jadą czytelnie. Sam token nikomu nic nie daje: bez klucza łącza
każde żądanie kończy się odmową. Pełne ukrycie metadanych wymagałoby mTLS.
- **NFS `192.168.1.34:/mnt/Tank1/astrololo`** — kto ma dostęp do share'u, bierze
pliki baz **z pominięciem całej aplikacji**. Do zamknięcia po stronie infrastruktury
(eksport tylko dla IP węzłów, `root_squash`, najlepiej read-only).
- **Sekret w etcd** jest tylko zakodowany base64. Docelowo: szyfrowanie etcd at-rest
albo Sealed Secrets / SOPS, jeśli chcecie trzymać sekrety deklaratywnie w repo.
## Profil ze swissephem
Wariant z silnikiem B: [`../astrololo-swisseph/`](../astrololo-swisseph/README.md).
Dziedziczy powyższe zmienne z tej bazy, więc też wymaga sekretu `astrololo-auth`.
+18 -1
View File
@@ -18,11 +18,28 @@ spec:
- name: DATA_PROVIDER - name: DATA_PROVIDER
value: "excel" value: "excel"
- name: EXCEL_DIR - name: EXCEL_DIR
value: "/app/data_files" # pliki są W OBRAZIE (COPY . .) value: "/app/data_files" # montowane z NFS (patrz volumes) — NIE z obrazu
- name: CACHE_DIR - name: CACHE_DIR
value: "/app/.cache" value: "/app/.cache"
- name: INDEXED_KEYS - name: INDEXED_KEYS
value: "name,id,symbol" value: "name,id,symbol"
# Token międzywarstwowy (LOG-32). Ta warstwa oddaje SUROWE wiersze baz —
# najwrażliwszy punkt systemu. Bez tokenu dałoby się ją odpytać
# bezpośrednio, z pominięciem i logiki, i logowania w UI.
- name: INTERNAL_TOKEN
valueFrom:
secretKeyRef: { name: astrololo-auth, key: INTERNAL_TOKEN }
# Szyfrowanie łącza między warstwami (PRE-16). OSOBNY klucz na każdą
# parę rozmówców: przejęcie klucza prezentacji nie otwiera warstwy
# danych, gdzie leżą całe bazy. Sekret tworzony POZA repo — patrz README.
- name: LINK_KEY_LOGIC_DATA
valueFrom:
secretKeyRef: { name: astrololo-link, key: LINK_KEY_LOGIC_DATA }
# Bez klucza usługa ma NIE wstać, a klient ma nie wysłać niczego.
# Sam serwer broni się fail-closed, ale to za mało: klient bez klucza
# zdążyłby wypuścić zapytanie jawnym tekstem, zanim dostanie odmowę.
- name: LINK_ENCRYPTION_REQUIRED
value: "true"
volumeMounts: volumeMounts:
- name: cache - name: cache
mountPath: /app/.cache mountPath: /app/.cache
+44
View File
@@ -0,0 +1,44 @@
# Konfiguracja argocd-image-updater dla astrololo — ŹRÓDŁO PRAWDY tego, CO śledzimy.
#
# Model v1.x: osobny CRD `ImageUpdater` w ns `argocd` (nie adnotacje na Application).
# Lista `images` jest JAWNA — obraz, którego tu NIE MA, nigdy nie zostanie podbity,
# choćby CI go budowało. Tak przez chwilę wisiał `render` na `:latest` (PRE-24):
# usługa istniała i budowała tag SHA, ale updater jej nie znał, więc kustomization
# jej nie ruszał. Dopisanie wpisu = wejście usługi do rotacji.
#
# ⚠️ TEGO PLIKU NIE MA w astrololo/kustomization.yaml i NIE MA GO TAM MIEĆ:
# 1. resource żyje w ns `argocd`, a Application astrololo celuje w ns `astrololo`
# — auto-sync przez kustomize próbowałby zapisać poza swój namespace docelowy;
# 2. to konfiguracja kontrolera, który wdraża tę właśnie aplikację — niech app
# nie zarządza narzędziem, które ją wdraża.
# Plik jest trzymany w repo dla odtwarzalności i historii; nakłada się go RĘCZNIE:
# kubectl apply -f astrololo/image-updater.yaml
#
# Strategia `newest-build`: updater bierze obraz o NAJNOWSZYM znaczniku czasu builda
# i zapisuje jego tag SHA do kustomization (write-back git). Uwaga na reprodukowalne
# buildy — identyczny `created` na kilku tagach potrafi zablokować wybór najnowszego.
apiVersion: argocd-image-updater.argoproj.io/v1alpha1
kind: ImageUpdater
metadata:
name: astrololo
namespace: argocd
spec:
applicationRefs:
- namePattern: astrololo
images:
- alias: data
imageName: gitea.czernobog.pl/gitea/astrololo-data
- alias: logic
imageName: gitea.czernobog.pl/gitea/astrololo-logic
- alias: presentation
imageName: gitea.czernobog.pl/gitea/astrololo-presentation
- alias: render
imageName: gitea.czernobog.pl/gitea/astrololo-render
commonUpdateSettings:
updateStrategy: newest-build
writeBackConfig:
method: git:secret:argocd/git-creds
gitConfig:
repository: https://gitea.czernobog.pl/gitea/deploy.git
branch: master
writeBackTarget: kustomization:/astrololo
+75
View File
@@ -0,0 +1,75 @@
# Wejście do aplikacji po HTTPS (PRE-16).
#
# Poza bezpieczeństwem — Basic Auth po zwykłym http leci siecią czytelny dla
# każdego, kto słucha — TLS naprawia DWIE funkcje zepsute dziś z tego samego
# powodu: geolokalizacja przeglądarki („Tu i teraz") oraz kopiowanie promptu do
# schowka działają wyłącznie w tzw. secure context i po http po prostu odmawiają.
---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: security-headers
namespace: astrololo
spec:
headers:
stsSeconds: 31536000 # HSTS: rok
stsIncludeSubdomains: false # dotyczy tylko tego hosta
stsPreload: false # preload to wpis na listę w przeglądarkach
# — praktycznie nieodwracalny, nie wchodzimy
forceSTSHeader: true # nagłówek także przy odpowiedziach z backendu
contentTypeNosniff: true
frameDeny: true
referrerPolicy: same-origin
---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: redirect-https
namespace: astrololo
spec:
redirectScheme:
scheme: https
permanent: true
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: astrololo
namespace: astrololo
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.middlewares: astrololo-security-headers@kubernetescrd
spec:
tls:
- hosts: [astrololo.czernobog.pl]
secretName: astrololo-tls # wypełnia cert-manager (tls.yaml)
rules:
- host: astrololo.czernobog.pl
http:
paths:
- path: /
pathType: Prefix
backend:
service: { name: presentation, port: { number: 8000 } }
---
# Osobny Ingress wyłącznie na porcie 80 — istnieje po to, żeby odesłać na https.
# Rozdzielone świadomie: gdyby przekierowanie wisiało na tym samym routerze, co
# wejście po https, odsyłałoby samo do siebie w kółko. Backend jest tu formalnością,
# bo żadne żądanie do niego nie dojdzie.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: astrololo-redirect
namespace: astrololo
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
traefik.ingress.kubernetes.io/router.middlewares: astrololo-redirect-https@kubernetescrd
spec:
rules:
- host: astrololo.czernobog.pl
http:
paths:
- path: /
pathType: Prefix
backend:
service: { name: presentation, port: { number: 8000 } }
+8 -3
View File
@@ -5,10 +5,15 @@ resources:
- data.yaml - data.yaml
- logic.yaml - logic.yaml
- presentation.yaml - presentation.yaml
- render.yaml # składanie raportu PDF (PRE-24), osobny obraz z TeX Live
- tls.yaml # certyfikat z własnego CA (wymaga cert-managera)
- ingress.yaml # wejście po https + przekierowanie z http
images: images:
- name: gitea.czernobog.pl/gitea/astrololo-data - name: gitea.czernobog.pl/gitea/astrololo-data
newTag: c75f8377 newTag: b36b3bee
- name: gitea.czernobog.pl/gitea/astrololo-logic - name: gitea.czernobog.pl/gitea/astrololo-logic
newTag: c75f8377 newTag: b36b3bee
- name: gitea.czernobog.pl/gitea/astrololo-render
newTag: latest
- name: gitea.czernobog.pl/gitea/astrololo-presentation - name: gitea.czernobog.pl/gitea/astrololo-presentation
newTag: c75f8377 newTag: a9f2a038
+44
View File
@@ -20,6 +20,50 @@ spec:
- name: EPHEMERIS_ENGINE - name: EPHEMERIS_ENGINE
value: "own" # silnik własny; swisseph pominięty value: "own" # silnik własny; swisseph pominięty
# ENGINE_SWISSEPH_URL celowo NIE ustawiamy — engine-swisseph nie jest wdrażany # ENGINE_SWISSEPH_URL celowo NIE ustawiamy — engine-swisseph nie jest wdrażany
# Token międzywarstwowy (LOG-32): logika oddaje treść baz, więc musi
# odrzucać żądania z pominięciem logowania w prezentacji. Ten sam token
# służy jej do uwierzytelnienia się w warstwie danych.
- name: INTERNAL_TOKEN
valueFrom:
secretKeyRef: { name: astrololo-auth, key: INTERNAL_TOKEN }
# Szyfrowanie łącza między warstwami (PRE-16). OSOBNY klucz na każdą
# parę rozmówców: przejęcie klucza prezentacji nie otwiera warstwy
# danych, gdzie leżą całe bazy. Sekret tworzony POZA repo — patrz README.
- name: LINK_KEY_PRESENTATION_LOGIC
valueFrom:
secretKeyRef: { name: astrololo-link, key: LINK_KEY_PRESENTATION_LOGIC }
- name: LINK_KEY_LOGIC_DATA
valueFrom:
secretKeyRef: { name: astrololo-link, key: LINK_KEY_LOGIC_DATA }
# Bez klucza usługa ma NIE wstać, a klient ma nie wysłać niczego.
# Sam serwer broni się fail-closed, ale to za mało: klient bez klucza
# zdążyłby wypuścić zapytanie jawnym tekstem, zanim dostanie odmowę.
- name: LINK_ENCRYPTION_REQUIRED
value: "true"
# --- Model językowy (LOG-31) ---
# Domyślnie LOKALNY: prompt niesie oryginalne opisy z baz, więc nic nie
# opuszcza sieci. Dostawcę można przełączyć w UI przy pojedynczym żądaniu.
- name: LLM_PROVIDER
value: "local"
- name: LOCAL_BASE_URL
value: "http://ollama.ollama.svc.cluster.local:11434/v1"
- name: LOCAL_MODEL
value: "llama3.1:8b"
- name: LLM_TIMEOUT
value: "180" # dłuższe horoskopy potrafią trwać
- name: LLM_MAX_TOKENS
value: "2000"
# Klucze do chmury — OPCJONALNE (optional: true), bo to funkcja, nie
# zabezpieczenie: bez sekretu pody startują normalnie i działa model
# lokalny. Wybór chmury w UI oznacza, że treść baz OPUSZCZA naszą sieć.
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef: { name: astrololo-llm, key: OPENAI_API_KEY, optional: true }
- name: ANTHROPIC_API_KEY
valueFrom:
secretKeyRef: { name: astrololo-llm, key: ANTHROPIC_API_KEY, optional: true }
resources: resources:
requests: { cpu: "100m", memory: "128Mi" } requests: { cpu: "100m", memory: "128Mi" }
limits: { cpu: "500m", memory: "512Mi" } limits: { cpu: "500m", memory: "512Mi" }
+43 -1
View File
@@ -17,6 +17,45 @@ spec:
env: env:
- name: LOGIC_URL - name: LOGIC_URL
value: "http://logic:8001" value: "http://logic:8001"
# Logowanie do aplikacji (LOG-32). Bez tych sekretów aplikacja stoi
# OTWARTA — a wystawia treść baz interpretacyjnych. Sekret tworzony
# POZA repo (jak gitea-registry) — patrz README.md.
- name: APP_PASSWORD
valueFrom:
secretKeyRef: { name: astrololo-auth, key: APP_PASSWORD }
- name: INTERNAL_TOKEN
valueFrom:
secretKeyRef: { name: astrololo-auth, key: INTERNAL_TOKEN }
- name: APP_USER
value: "astrololo"
- name: RATE_LIMIT_PER_MIN
value: "120" # 0 = bez limitu
# Aplikacja stoi za Ingressem, więc bezpośrednim rozmówcą jest zawsze
# pod Traefika. Bez tego limit żądań liczyłby WSZYSTKICH do jednego
# wiadra i pierwsza osoba, która go wyklika, odcięłaby pozostałych.
# Włączać wyłącznie gdy ruch faktycznie idzie przez proxy — inaczej
# nagłówek staje się furtką do ominięcia limitu.
- name: TRUST_PROXY
value: "true"
# Szyfrowanie łącza między warstwami (PRE-16). OSOBNY klucz na każdą
# parę rozmówców: przejęcie klucza prezentacji nie otwiera warstwy
# danych, gdzie leżą całe bazy. Sekret tworzony POZA repo — patrz README.
- name: LINK_KEY_PRESENTATION_LOGIC
valueFrom:
secretKeyRef: { name: astrololo-link, key: LINK_KEY_PRESENTATION_LOGIC }
# Bez klucza usługa ma NIE wstać, a klient ma nie wysłać niczego.
# Sam serwer broni się fail-closed, ale to za mało: klient bez klucza
# zdążyłby wypuścić zapytanie jawnym tekstem, zanim dostanie odmowę.
# Usługa składająca PDF (PRE-24) — osobny komponent.
- name: RENDER_URL
value: "http://render:8004" # discovery po nazwie Service
# Trzeci klucz łącza: prezentacja ↔ render. Osobny, bo tym łączem
# idzie CAŁY raport (dane urodzeniowe + opisy z baz).
- name: LINK_KEY_PRESENTATION_RENDER
valueFrom:
secretKeyRef: { name: astrololo-link, key: LINK_KEY_PRESENTATION_RENDER }
- name: LINK_ENCRYPTION_REQUIRED
value: "true"
resources: resources:
requests: { cpu: "100m", memory: "128Mi" } requests: { cpu: "100m", memory: "128Mi" }
limits: { cpu: "300m", memory: "256Mi" } limits: { cpu: "300m", memory: "256Mi" }
@@ -27,7 +66,10 @@ metadata:
name: presentation name: presentation
namespace: astrololo namespace: astrololo
spec: spec:
type: NodePort # wejście z przeglądarki # Wejście z przeglądarki idzie teraz WYŁĄCZNIE przez Ingress po https
# (ingress.yaml). NodePort był drugą, nieszyfrowaną drogą do środka — czyli
# obejściem całego PRE-16 — więc znika.
type: ClusterIP
selector: { app: presentation } selector: { app: presentation }
ports: [{ port: 8000, targetPort: 8000 }] ports: [{ port: 8000, targetPort: 8000 }]
+69
View File
@@ -0,0 +1,69 @@
# Usługa render — składanie raportu PDF (PRE-24).
#
# OSOBNY komponent, nie część prezentacji, z tego samego powodu co silnik
# swisseph (LOG-27): obraz dźwiga TeX Live, czyli setki megabajtów. W obrazie
# produktu spowalniałby każdy build i deploy; tak aktualizuje się niezależnie,
# a jego awaria nie kładzie aplikacji — psuje się tylko przycisk „Pobierz PDF".
#
# Rozmawia WYŁĄCZNIE z prezentacją, po szyfrowanym łączu z własnym, trzecim
# kluczem. Wystawiona jako ClusterIP — bez NodePort i bez Ingressu, bo nie ma
# powodu, żeby ktokolwiek sięgał do niej z zewnątrz.
apiVersion: apps/v1
kind: Deployment
metadata:
name: render
namespace: astrololo
spec:
replicas: 1
selector: { matchLabels: { app: render } }
template:
metadata: { labels: { app: render } }
spec:
imagePullSecrets: [{ name: gitea-registry }]
containers:
- name: render
image: gitea.czernobog.pl/gitea/astrololo-render:latest
ports: [{ containerPort: 8004 }]
env:
# Token międzywarstwowy (LOG-32) — ta usługa dostaje CAŁY raport:
# dane urodzeniowe i opisy z baz.
- name: INTERNAL_TOKEN
valueFrom:
secretKeyRef: { name: astrololo-auth, key: INTERNAL_TOKEN }
# Szyfrowanie łącza (PRE-16/PRE-24). OSOBNY klucz na parę rozmówców:
# przejęcie klucza renderu nie może otwierać łącza do logiki ani danych.
- name: LINK_KEY_PRESENTATION_RENDER
valueFrom:
secretKeyRef: { name: astrololo-link, key: LINK_KEY_PRESENTATION_RENDER }
- name: LINK_ENCRYPTION_REQUIRED
value: "true"
# XeLaTeX na obszernym raporcie potrafi zjeść sporo pamięci i CPU,
# ale tylko na chwilę — stąd wyraźna różnica między request a limit.
resources:
requests: { cpu: "100m", memory: "256Mi" }
limits: { cpu: "1500m", memory: "1Gi" }
# Kompilacja pisze wyłącznie do katalogu tymczasowego, który sprząta po
# sobie. Dajemy na to emptyDir i zamykamy resztę systemu plików —
# raport nie ma prawa zostawić śladu w kontenerze.
volumeMounts:
- { name: tmp, mountPath: /tmp }
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
readinessProbe:
httpGet: { path: /health, port: 8004 }
initialDelaySeconds: 5
periodSeconds: 15
volumes:
- name: tmp
emptyDir: { sizeLimit: 512Mi }
---
apiVersion: v1
kind: Service
metadata:
name: render
namespace: astrololo
spec:
type: ClusterIP # tylko dla prezentacji, bez wejścia z zewnątrz
selector: { app: render }
ports: [{ port: 8004, targetPort: 8004 }]
+65
View File
@@ -0,0 +1,65 @@
# Certyfikat dla wejścia do aplikacji (PRE-16).
#
# Dlaczego WŁASNE CA, a nie Let's Encrypt: klaster stoi w LAN (traefik trzyma
# LoadBalancera na 192.168.1.x), więc walidacja HTTP-01 nie ma jak dojść z
# internetu, a DNS-01 wymagałby trzymania w klastrze tokena API do domeny.
# Własne CA nie potrzebuje niczego z zewnątrz, a certyfikaty odnawia samo.
#
# WYMAGANIE WSTĘPNE: cert-manager musi być w klastrze PRZED synchronizacją tego
# katalogu — inaczej API odrzuci poniższe obiekty jako nieznane rodzaje zasobów.
# Instalacja jednorazowa: patrz README.md.
#
# Wszystko jest w namespace `astrololo` (Issuer, nie ClusterIssuer) świadomie:
# ArgoCD ma tu włączone `prune`, a zasoby o zasięgu całego klastra chcemy trzymać
# poza aplikacją, która może zostać skasowana.
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: selfsigned
namespace: astrololo
spec:
selfSigned: {}
---
# Korzeń zaufania. TO JEST certyfikat, który raz importujesz do przeglądarki
# i systemu — patrz README. Stąd długi termin ważności: importu nie chcemy
# powtarzać co kwartał.
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: astrololo-ca
namespace: astrololo
spec:
isCA: true
commonName: astrololo internal CA
secretName: astrololo-ca # tu lądują klucz i certyfikat korzenia
duration: 87600h # 10 lat
renewBefore: 8760h # odnowienie na rok przed końcem
privateKey: { algorithm: ECDSA, size: 256 }
issuerRef: { name: selfsigned, kind: Issuer, group: cert-manager.io }
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: astrololo-ca
namespace: astrololo
spec:
ca: { secretName: astrololo-ca }
---
# Właściwy certyfikat serwera. Krótki termin CELOWO: przy 90 dniach odnawianie
# jest sprawdzane w praktyce co kwartał, więc awaria wyjdzie od razu, a nie za
# dziesięć lat, gdy nikt już nie będzie pamiętał, jak to działa.
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: astrololo-tls
namespace: astrololo
spec:
secretName: astrololo-tls # tego szuka Ingress
commonName: astrololo.czernobog.pl
dnsNames:
- astrololo.czernobog.pl
duration: 2160h # 90 dni
renewBefore: 720h # 30 dni zapasu
privateKey: { algorithm: ECDSA, size: 256, rotationPolicy: Always }
issuerRef: { name: astrololo-ca, kind: Issuer, group: cert-manager.io }
+106
View File
@@ -0,0 +1,106 @@
# Production ("deploy") Conjurer bot
A second Conjurer bot that runs **alongside** the test `bot` in the `conjurer`
namespace, sharing the same librarian / musician / radio and the shared
`CONJURER_API_KEY`. It differs from the test bot only in:
- its Discord token: the **`deploy-conjurer-netrc`** secret (already created),
- distinct names/labels (`deploy-bot`) and NodePort **32443**,
- **`/data` on NFS (RWX)** instead of a block PVC — so you can seed/upload files
while it runs and back it up concurrently.
Files: `deploy-bot.yaml` (Deployment + Service), `deploy-bot-backup.yaml`
(daily backup CronJob). Both are wired into `kustomization.yaml`.
## Update channel — only on `[deploy]`
Unlike the test bot (which tracks every build), the production bot updates **only
when you promote a version**. It runs a **separate image**,
`conjurer-bot-deploy`, which the conjurer CI tags **only when the commit message
contains `[deploy]`** (it re-tags the already-built `conjurer-bot:<sha>` — same
bytes). The image-updater's `deploy-bot` alias then bumps this bot's tag.
So: normal commits update the test bot + librarian; a commit with `[deploy]` in
its message is the one that also rolls the production bot.
**Already bootstrapped:** the channel was seeded by the first `[deploy]` commit
(the merge of conjurer#20), which promoted `conjurer-bot-deploy:fbd1ec9f` — the
tag pinned in `kustomization.yaml`. From here the image-updater keeps it current
on each future `[deploy]` commit. Note the librarian is shared and still tracks
latest, so mind large bot⇄librarian version skews.
If you ever need to seed a tag by hand:
```bash
docker pull gitea.czernobog.pl/gitea/conjurer-bot:<sha>
docker tag gitea.czernobog.pl/gitea/conjurer-bot:<sha> \
gitea.czernobog.pl/gitea/conjurer-bot-deploy:<sha>
docker push gitea.czernobog.pl/gitea/conjurer-bot-deploy:<sha>
```
## One-time setup
1. **Secret** — already exists as `deploy-conjurer-netrc` (a netrc carrying the
deploy Discord token, key `.netrc`). Nothing to do; the Deployment mounts it
at `/secrets/.netrc`.
2. **NFS export** — create the data + backup dirs on the NFS server
(`192.168.1.34`, adjust to your real export):
```
/mnt/Tank1/conjurer_swap/deploy-bot/data
/mnt/Tank1/conjurer_swap/deploy-bot/backups
```
## Seeding / uploading config & state into /data
Because `/data` is a plain NFS export, you upload files by copying them onto the
share — **no `kubectl cp`, no scaling the bot down**. From the PVE box that holds
`/srv/data` (mount the same export there, or rsync over it):
```bash
# on a host that can see the NFS export:
rsync -a /srv/data/ 192.168.1.34:/mnt/Tank1/conjurer_swap/deploy-bot/data/
```
The bot roots everything under `CONJURER_DATA_DIR=/data`, so these land where it
expects them:
```
accident_log.json Conjurer_graphics/ music/ pamiec.json
pamiec_muzyki.json settings.json system_gpt_settings.json transcripts/
```
Upload as much or as little as you like — the bot seeds any missing JSON on
first run. Live-editing `pamiec.json` while the bot writes to it can race; prefer
seeding before first start or during a brief `kubectl -n conjurer scale
deploy/deploy-bot --replicas=0` window.
## Backups (production only)
`deploy-bot-backup` runs daily (04:17) and writes to the `backups` export:
- `current/` — a full rsync mirror of `/data` (incl. music/graphics), always
the latest state,
- `snapshots/deploy-state-<date>.tgz` — dated archives of the critical small
state (both memories, settings, accident log, transcripts), kept
`RETENTION_DAYS` (30) days.
The test bot is deliberately **not** backed up (amnesia there is fine).
Restore example:
```bash
tar xzf snapshots/deploy-state-2026-08-03-0417.tgz -C /mnt/.../deploy-bot/data/
```
## Routing librarian / musician callbacks
**Librarian — handled automatically.** Each bot advertises its own
`CONJURER_SELF_CALLBACK` (test `…:32442`, this bot `…:32443`) on every query and
ping, and the librarian answers each result/pong back to the bot that asked. One
librarian serves both bots — no `CONJURER_MAIN_BOT` repointing needed. (The
librarian keeps `CONJURER_MAIN_BOT: http://bot:5000` only as a fallback for a bot
that doesn't send a callback.)
**Musician — still single-target.** The musician pushes "now playing" events to
its one `CONJURER_MAIN_BOT` (currently the test bot, `192.168.1.73:32442`). Only
one bot gets radio events; repoint the musician's `CONJURER_MAIN_BOT` to
`192.168.1.73:32443` if the production bot should show them instead.
+62
View File
@@ -0,0 +1,62 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: bot
namespace: conjurer
spec:
replicas: 1 # NIGDY więcej — jedna sesja gateway na token
strategy: { type: Recreate } # NIE RollingUpdate — dwa pody = wojna o sesję Discord
selector: { matchLabels: { app: bot } }
template:
metadata: { labels: { app: bot } }
spec:
imagePullSecrets: [{ name: gitea-registry }]
containers:
- name: bot
image: gitea.czernobog.pl/gitea/conjurer-bot:c8aae106
ports: [{ containerPort: 5000 }]
env:
- { name: CONJURER_DATA_DIR, value: "/data" }
- { name: CONJURER_DISCORD_HOST, value: "0.0.0.0" }
- { name: CONJURER_DISCORD_PORT, value: "5000" }
- { name: CONJURER_API_KEY, value: "d97008b3-7a5a-11f1-acd1-000b0e0f00ed" }
- { name: CONJURER_NETRC_FILE, value: "/secrets/.netrc" }
# ↓ NAZWY PODSTAW WG WYNIKU grepa z 0.2 ↓
- { name: CONJURER_LIBRARIAN_SERVICE, value: "http://librarian:5001" }
- { name: CONJURER_MUSICIAN_SERVICE, value: "http://192.168.1.89:5000" }
- { name: CONJURER_RADIO_SERVICE, value: "http://192.168.1.79:5005" }
- { name: CONJURER_FILE_SERVICE, value: "http://192.168.1.89:5000" }
- { name: CONJURER_RADIO_HARBOR, value: "http://192.168.1.79:54321" }
# Where the librarian sends THIS bot's results/pongs back to (its own
# NodePort). Lets one librarian serve both bots - see deploy-bot.yaml.
- { name: CONJURER_SELF_CALLBACK, value: "http://192.168.1.73:32442" }
volumeMounts:
- { name: data, mountPath: /data }
- { name: netrc, mountPath: /secrets, readOnly: true }
resources:
requests: { cpu: "200m", memory: "256Mi" }
limits: { cpu: "2", memory: "1Gi" }
volumes:
- name: data
persistentVolumeClaim: { claimName: bot-data }
- name: netrc
secret: { secretName: conjurer-netrc }
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata: { name: bot-data, namespace: conjurer }
spec:
accessModes: [ReadWriteOnce]
resources: { requests: { storage: 2Gi } }
---
apiVersion: v1
kind: Service
metadata: { name: bot, namespace: conjurer }
spec:
type: NodePort # radio/musician z Dockera muszą go dosięgnąć
selector: { app: bot }
# nodePort PRZYPIĘTY na sztywno. Bez tego k8s losuje port z 30000-32767 przy
# (od)tworzeniu Service, a musician/betoniarka z Dockera adresują bota po
# http://192.168.1.73:32442 na sztywno - rozjazd = wyniki/eventy giną w locie.
ports: [{ port: 5000, targetPort: 5000, nodePort: 32442 }]
+22
View File
@@ -0,0 +1,22 @@
apiVersion: argocd-image-updater.argoproj.io/v1alpha1
kind: ImageUpdater
metadata:
name: conjurer
namespace: argocd
spec:
commonUpdateSettings:
updateStrategy: "newest-build"
writeBackConfig:
method: "git:secret:argocd/git-creds"
gitConfig:
repository: "https://gitea.czernobog.pl/gitea/deploy.git"
branch: "master" # ← gałąź repo deploy
writeBackTarget: "kustomization:/conjurer"
applicationRefs:
- namePattern: "conjurer"
images:
- { alias: "librarian", imageName: "gitea.czernobog.pl/gitea/conjurer-librarian" }
- { alias: "bot", imageName: "gitea.czernobog.pl/gitea/conjurer-bot" }
# Production bot tracks its own image, which only gets new tags on
# [deploy] commits (conjurer CI) - so it updates only on promoted builds.
- { alias: "deploy-bot", imageName: "gitea.czernobog.pl/gitea/conjurer-bot-deploy" }
+65
View File
@@ -0,0 +1,65 @@
# Daily backup of the PRODUCTION ("deploy") bot's /data.
#
# Only production is backed up - the test bot's amnesia is fine, this bot's is
# not (pamiec.json / pamiec_muzyki.json are the conversation & music memory).
# Both volumes are NFS (RWX), so this runs while the bot is live - no RWO clash.
#
# Two-part backup:
# * a full, space-efficient MIRROR (rsync --delete) of everything, incl. music
# and graphics - always the current state,
# * dated SNAPSHOTS of just the small critical state (the memories, settings,
# accident log, transcripts) so you can roll back to a point in time.
# Snapshots older than RETENTION_DAYS are pruned.
apiVersion: batch/v1
kind: CronJob
metadata:
name: deploy-bot-backup
namespace: conjurer
spec:
schedule: "17 4 * * *" # every day at 04:17
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 3
jobTemplate:
spec:
backoffLimit: 2
template:
spec:
restartPolicy: Never
containers:
- name: backup
image: alpine:3.20
command: ["/bin/sh", "-c"]
args:
- |
set -eu
apk add --no-cache rsync >/dev/null
STAMP="$(date +%F-%H%M)"
mkdir -p /backup/current /backup/snapshots
echo "[$STAMP] mirroring /data -> /backup/current"
rsync -a --delete /data/ /backup/current/
echo "[$STAMP] snapshotting critical state"
tar czf "/backup/snapshots/deploy-state-$STAMP.tgz" -C /data \
accident_log.json pamiec.json pamiec_muzyki.json \
settings.json system_gpt_settings.json transcripts \
2>/dev/null || echo " (some files absent - skipped)"
echo "[$STAMP] pruning snapshots older than ${RETENTION_DAYS}d"
find /backup/snapshots -name 'deploy-state-*.tgz' -type f \
-mtime +"${RETENTION_DAYS}" -delete
echo "[$STAMP] backup done"
env:
- { name: RETENTION_DAYS, value: "30" }
volumeMounts:
- { name: data, mountPath: /data, readOnly: true }
- { name: backup, mountPath: /backup }
volumes:
# Same export the bot mounts (read-only here).
- name: data
nfs:
server: 192.168.1.34
path: /mnt/Tank1/conjurer_swap/deploy-bot/data
# Backup target - ADJUST to your export.
- name: backup
nfs:
server: 192.168.1.34
path: /mnt/Tank1/conjurer_swap/deploy-bot/backups
+80
View File
@@ -0,0 +1,80 @@
# Production ("deploy") Conjurer bot.
#
# Same infrastructure as the test `bot` (shares librarian / musician / radio and
# the CONJURER_API_KEY), with three deliberate differences:
# 1. its Discord token comes from the `deploy-conjurer-netrc` secret,
# 2. distinct names/labels so it coexists with the test bot in this namespace,
# 3. /data is an NFS volume (RWX) instead of a block PVC - so config/state can
# be uploaded while the bot runs (just copy onto the share) and backed up
# concurrently (see deploy-bot-backup.yaml). The test bot keeps its RWO PVC.
#
# ┌─ IMPORTANT: librarian & musician call ONE bot back ─────────────────────────┐
# │ The librarian (CONJURER_MAIN_BOT) and musician push search results and │
# │ "now playing" events to a SINGLE bot address - currently the test bot's │
# │ NodePort 192.168.1.73:32442. Only one bot can receive them. To make the │
# │ PRODUCTION bot the one that gets librarian results / radio events, repoint │
# │ those services' CONJURER_MAIN_BOT to this bot's NodePort (…:32443 below). │
# └─────────────────────────────────────────────────────────────────────────────┘
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy-bot
namespace: conjurer
spec:
replicas: 1 # NIGDY więcej — jedna sesja gateway na token
strategy: { type: Recreate } # NIE RollingUpdate — dwa pody = wojna o sesję Discord
selector: { matchLabels: { app: deploy-bot } }
template:
metadata: { labels: { app: deploy-bot } }
spec:
imagePullSecrets: [{ name: gitea-registry }]
containers:
- name: bot
# SEPARATE image from the test bot: conjurer-bot-deploy only gets a new
# tag when a commit message contains [deploy] (see the conjurer CI), so
# this bot updates only on versions you explicitly promote. Tag is
# managed by the image-updater (kustomization images:).
image: gitea.czernobog.pl/gitea/conjurer-bot-deploy:c8aae106
ports: [{ containerPort: 5000 }]
env:
- { name: CONJURER_DATA_DIR, value: "/data" }
- { name: CONJURER_DISCORD_HOST, value: "0.0.0.0" }
- { name: CONJURER_DISCORD_PORT, value: "5000" }
- { name: CONJURER_API_KEY, value: "d97008b3-7a5a-11f1-acd1-000b0e0f00ed" }
- { name: CONJURER_NETRC_FILE, value: "/secrets/.netrc" }
- { name: CONJURER_LIBRARIAN_SERVICE, value: "http://librarian:5001" }
- { name: CONJURER_MUSICIAN_SERVICE, value: "http://192.168.1.89:5000" }
- { name: CONJURER_RADIO_SERVICE, value: "http://192.168.1.79:5005" }
- { name: CONJURER_FILE_SERVICE, value: "http://192.168.1.89:5000" }
- { name: CONJURER_RADIO_HARBOR, value: "http://192.168.1.79:54321" }
# This bot's own callback (its NodePort). The librarian records it per
# query and answers results/pongs HERE - so it serves this bot AND the
# test bot from one instance, no CONJURER_MAIN_BOT repointing needed.
- { name: CONJURER_SELF_CALLBACK, value: "http://192.168.1.73:32443" }
volumeMounts:
- { name: data, mountPath: /data }
- { name: netrc, mountPath: /secrets, readOnly: true }
resources:
requests: { cpu: "200m", memory: "256Mi" }
limits: { cpu: "2", memory: "1Gi" }
volumes:
# /data on NFS (RWX): lets you seed/upload files while the bot runs (copy
# straight onto the export from the PVE box that holds /srv/data) and lets
# the backup CronJob read it concurrently. ADJUST server/path to your
# actual export - mirrors the librarian's 192.168.1.34 Tank1 layout.
- name: data
nfs:
server: 192.168.1.34
path: /mnt/Tank1/conjurer_swap/deploy-bot/data
- name: netrc
secret: { secretName: deploy-conjurer-netrc }
---
apiVersion: v1
kind: Service
metadata: { name: deploy-bot, namespace: conjurer }
spec:
type: NodePort # so librarian/musician COULD reach it if repointed
selector: { app: deploy-bot }
# Distinct pinned nodePort (test bot owns 32442). Point librarian/musician
# CONJURER_MAIN_BOT at 192.168.1.73:32443 to route their callbacks here.
ports: [{ port: 5000, targetPort: 5000, nodePort: 32443 }]
+19
View File
@@ -0,0 +1,19 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
- librarian.yaml
- bot.yaml
- deploy-bot.yaml
- deploy-bot-backup.yaml
images:
- name: gitea.czernobog.pl/gitea/conjurer-librarian
newTag: fbd1ec9f
- name: gitea.czernobog.pl/gitea/conjurer-bot
newTag: fbd1ec9f
# Production bot channel - only bumped when a [deploy]-tagged build appears.
# Bootstrapped to fbd1ec9f: that's the image the first [deploy] build (merge
# of conjurer#20) promoted to conjurer-bot-deploy. From here the image-updater
# keeps it current across future [deploy] commits.
- name: gitea.czernobog.pl/gitea/conjurer-bot-deploy
newTag: fbd1ec9f
+67
View File
@@ -0,0 +1,67 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: librarian
namespace: conjurer
spec:
replicas: 1
selector: { matchLabels: { app: librarian } }
template:
metadata: { labels: { app: librarian } }
spec:
imagePullSecrets: [{ name: gitea-registry }]
# On SIGTERM the librarian checkpoints the running search and exits within
# CONJURER_LIBRARIAN_GRACEFUL_TIMEOUT (default 45s). Give k8s enough grace
# to let that finish before it SIGKILLs - otherwise a long scan's checkpoint
# is cut short and the search restarts from scratch instead of resuming.
terminationGracePeriodSeconds: 60
containers:
- name: librarian
image: gitea.czernobog.pl/gitea/conjurer-librarian:e243777e
ports: [{ containerPort: 5001 }]
env:
- { name: CONJURER_LIBRARIAN_HOST, value: "0.0.0.0" }
- { name: CONJURER_LIBRARIAN_PORT, value: "5001" }
- { name: CONJURER_LIBRARIAN_DB_PATH, value: "/doi/" }
- { name: CONJURER_API_KEY, value: "d97008b3-7a5a-11f1-acd1-000b0e0f00ed" }
- { name: CONJURER_LIBRARIAN_MAXTHREADS, value: "40" }
- { name: CONJURER_CROSSREF_MAILTO, value: "mtuszowski@gmail.com" }
- { name: CONJURER_LIBRARIAN_CHUNK, value: "_chunk.txt" }
# Librarian jest W TYM SAMYM klastrze/namespace co bot - gada z nim
# po DNS Service'u, nie przez nodePort węzła (ten zostaje tylko dla
# zewnętrznych musician/betoniarka z Dockera). Odporne na przetasowania.
- { name: CONJURER_MAIN_BOT, value: "http://bot:5000" }
- { name: CONJURER_LIBRARIAN_STATE_DIR, value: "/lib_temp_files" }
volumeMounts:
- { name: doi, mountPath: /doi, readOnly: true }
- { name: state, mountPath: /lib_temp_files }
resources:
requests: { cpu: "100m", memory: "512Mi" }
# Headroom bump: the work-queue OOM is fixed in code, but a deep
# search still pulls up to 15000 Crossref records into RAM and the
# accumulating result JSONs are loaded whole. 2Gi gives margin so a
# big search isn't OOM-killed. Tune down if the node is tight.
limits: { cpu: "1", memory: "2Gi" }
volumes:
- name: doi
nfs:
server: 192.168.1.34
path: /mnt/Tank1/conjurer_swap/librarian_data/base_it1
- name: state
persistentVolumeClaim: { claimName: librarian-state }
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata: { name: librarian-state, namespace: conjurer }
spec:
accessModes: [ReadWriteOnce]
resources: { requests: { storage: 1Gi } }
---
apiVersion: v1
kind: Service
metadata: { name: librarian, namespace: conjurer }
spec:
selector: { app: librarian }
ports: [{ port: 5001, targetPort: 5001 }]
+4
View File
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: conjurer