forge
Explore
Log in

Don't you dare go Hollow

Deploy on a green push to main

Browse files at this commit

f1d5ed2d896ca1852163a6dcd158eb491fbfc37cAhmet Kaan GümüşParent: 970bd82
  • ci
    • deploy on a green push to main
Show full message
ci: deploy on a green push to main

A push whose Validate and Build jobs both succeed now deploys that
run's own release artifact. workflow_dispatch keeps the newest-green
redeploy (tests=force still deploys the artifact that run just built).
The capacity gate is unchanged and still read from compose x-rag-envelope.
Local-Gate: 206369ac9e4deb52af2d99733a2f1d70dfd4c15b (1410 passed, 32s)
.githooks/pre-pushmodified+2 -2
@@ -5,8 +5,8 @@
5 #5 #
6 # git config core.hooksPath .githooks6 # git config core.hooksPath .githooks
7 #7 #
8-# The default path is: push and let GitHub run the suite, build, pack and (on a8+# The default path is: push and let GitHub run the suite, build, pack and
9-# manual dispatch) deploy. An untested push is legitimate, so this hook does NOT9+# deploy this run's artifact. An untested push is legitimate, so this hook does NOT
10 # require a stamp. Its single job is to keep the opt-in fast lane honest.10 # require a stamp. Its single job is to keep the opt-in fast lane honest.
11 #11 #
12 # The fast lane is a commit carrying12 # The fast lane is a commit carrying
.github/workflows/main.ymlmodified+50 -34
@@ -6,29 +6,42 @@
6 # Containerfile'ından imaj (ENV bloğu dağıtım6 # Containerfile'ından imaj (ENV bloğu dağıtım
7 # varsayılanlarının TEK kaynağıdır) ve imaj tarball'ı +7 # varsayılanlarının TEK kaynağıdır) ve imaj tarball'ı +
8 # compose dosyaları koşunun artefaktı olarak yüklenir.8 # compose dosyaları koşunun artefaktı olarak yüklenir.
9-# Deploy — SSH: kapasite ön kontrolü, imajı yükle, deploy sahipli9+# Deploy — push'ta OTOMATIK: SSH ile kapasite ön kontrolü, imajı
10-# stack.env'in HEZARFEN_TAG'ini ona çevir, compose.yaml +10+# yükle, deploy sahipli stack.env'in HEZARFEN_TAG'ini
11-# unit'i kur, stack'i yeniden başlat, `/health` ve11+# BU KOŞUNUN artefaktına çevir, compose.yaml + unit'i
12-# `/ready` kapılarını geçir, olmazsa önceki tag'e dön.12+# kur, stack'i yeniden başlat, `/health` ve `/ready`
13+# kapılarını geçir, olmazsa önceki tag'e dön. Yani yeşil
14+# bir push servisi kendiliğinden günceller.
13 #15 #
14-# ⚠️ DEPLOY SADECE ELLE (workflow_dispatch) KOŞAR — bilinçli:16+# KAPASİTE KAPISI DEĞİŞMEDİ (kullanıcı kararı 2026-09-23: yeşil push artık
15-# Servis, aynı sunucuda koşan backend+postgres+frontend+chatbot'un YANINA17+# kendiliğinden deploy eder; 2026-09-15'teki "yalnız elle" kararı kalktı).
16-# eklenir; kapasite ön kontrolü olmadan otomatik başlatmak canlı stack'i RAM18+# Eşik hâlâ compose.yaml `x-rag-envelope` bloğundan OKUNUR — tek kaynak;
17-# için sıkıştırırdı. Gömme ve rerank artık UZAK API'de (dağıtım varsayılanı19+# sayıyı buraya ikinci kez yazmak, model çağından kalma 12 GB eşiğinin
18-# = api) → yerel modeller (~4,5 GB) indirilmez; ölçülen zarf torch ~0,4 GB +20+# sessizce geri gelmesi demekti. Yetmezse deploy sayılarıyla reddeder,
19-# 0,53 GB/10k chunk = 1,1 GB (tek korpus) … 2,6 GB (3 korpus), bkz.21+# eşiği gevşetmez. Gömme ve rerank UZAK API'de (dağıtım varsayılanı = api)
20-# PROJECT_STATE §11.2. Deploy işi eşiği compose.yaml'daki `x-rag-envelope`22+# → yerel modeller (~4,5 GB) indirilmez; ölçülen zarf torch ~0,4 GB +
21-# bloğundan OKUR — tek kaynak; sayıyı buraya ikinci kez yazmak, model23+# 0,53 GB/10k chunk = 1,1 GB (tek korpus) … 2,6 GB (3 korpus), bkz.
22-# çağından kalma 12 GB eşiğinin sessizce geri gelmesi demekti.24+# PROJECT_STATE §11.2.
23-# Operatör yerel yola (RAG_EMBED_PROVIDER=local) dönerse zarf büyür ve25+# Operatör yerel yola (RAG_EMBED_PROVIDER=local) dönerse zarf büyür ve
24-# GPU'suz makinede rerank 95,9 s sürer: ürün kapısı O-05 p50 <= 6 s GEÇİLMEZ26+# GPU'suz makinede rerank 95,9 s sürer: ürün kapısı O-05 p50 <= 6 s
25-# — o yapılandırma için eşiği sunucuya elle yükseltmek gerekir.27+# GEÇİLMEZ — o yapılandırma için eşiği sunucuya elle yükseltmek gerekir.
28+#
29+# Validate ile Build and test paralel koşar; Deploy ikisi de yeşilse
30+# çalışır ve BU KOŞUNUN artefaktını alır (en yeni yeşil araması değil).
31+# Yeni bir push aynı ref'teki Validate/Build'i iptal eder; uçuştaki
32+# Deploy'u ASLA iptal etmez (iki deploy iç içe girerse stack karışır).
33+#
34+# workflow_dispatch (Actions -> Run workflow, ya da
35+# `gh workflow run main.yml --ref main`) süiti koşmadan en yeni yeşil
36+# build'in artefaktını yeniden deploy eder. `tests: force` önce bu
37+# ref'i derler ve test eder, sonra O KOŞUNUN taze artefaktını alır.
26 #38 #
27 # TWO TEST PATHS — the default is the full one (same shape as hezarfen_backend):39 # TWO TEST PATHS — the default is the full one (same shape as hezarfen_backend):
28 #40 #
29 # DEFAULT Push it and let GitHub do everything: suite, image, bundle,41 # DEFAULT Push it and let GitHub do everything: suite, image, bundle,
30-# artifact. This is also the recovery path when the local machine42+# artifact, and — when Validate and Build are both green —
31-# is unavailable.43+# deploy of THIS run's artifact. This is also the recovery
44+# path when the local machine is unavailable.
32 # SPECIAL Prove the suite on your own machine first (scripts/gate-local.sh45 # SPECIAL Prove the suite on your own machine first (scripts/gate-local.sh
33 # — ~32 s here). The suite currently HANGS on the runner: run46 # — ~32 s here). The suite currently HANGS on the runner: run
34 # 35297989416 sat at 7% for 73 minutes until it was cancelled by47 # 35297989416 sat at 7% for 73 minutes until it was cancelled by
@@ -36,7 +49,8 @@
36 # --amend, appends) a `Local-Gate: <tree> (<n> passed, <t>s)`49 # --amend, appends) a `Local-Gate: <tree> (<n> passed, <t>s)`
37 # trailer; the "Decide test gate" step verifies it against50 # trailer; the "Decide test gate" step verifies it against
38 # HEAD^{tree} and only then skips the runner suite — CI still51 # HEAD^{tree} and only then skips the runner suite — CI still
39-# builds the image, proves it API-only, stages and uploads.52+# builds the image, proves it API-only, stages, uploads and
53+# deploys this run's artifact.
40 # A stale or copy-pasted trailer silently falls back to running54 # A stale or copy-pasted trailer silently falls back to running
41 # the suite, so the fallback costs time, never verification.55 # the suite, so the fallback costs time, never verification.
42 # Opt the pre-push hook in per clone:56 # Opt the pre-push hook in per clone:
@@ -56,10 +70,10 @@ on:
56 push:70 push:
57 branches:71 branches:
58 - main72 - main
59- # Deploy'un TEK kapısı — yukarıdaki başlık yorumuna bakın.73+ # Elle yeniden deploy kapısı — yukarıdaki başlık yorumuna bakın.
60- # `tests` is the escape hatch of the manual door: auto/skip redeploy the74+ # auto/skip: en yeni yeşil artefaktı yeniden deploy eder (süit tekrar
61- # newest green artifact (the suite is not paid again), force builds and75+ # ödenmez). force: bu ref'i önce derler ve test eder, o taze artefaktı
62- # tests the dispatched ref first and deploys that fresh artifact.76+ # deploy eder.
63 workflow_dispatch:77 workflow_dispatch:
64 inputs:78 inputs:
65 tests:79 tests:
@@ -302,20 +316,22 @@ jobs:
302 concurrency:316 concurrency:
303 group: deploy317 group: deploy
304 cancel-in-progress: false318 cancel-in-progress: false
305- # Push'ta iki CI işi koşar ama deploy KOŞMAZ (kapı elle açılır);319+ # Push: yalnız validate VE build yeşilse — ikisi de sunucuyu kapılar;
306- # dispatch'te ikisi de atlanır ve `always()` bu atlamanın kapıyı320+ # artefakt BU KOŞUNUNKİDİR (aşağıda needs.build.result == success).
307- # geçmesini engeller.321+ # Dispatch: mevcut yol. auto/skip iki CI işini atlar ve en yeni yeşil
322+ # build'i alır; tests=force build'i koşar ve bu koşunun artefaktını
323+ # alır. `always()` atlamanın kapıdan geçmesini engeller.
308 if: >-324 if: >-
309 always() &&325 always() &&
310- github.event_name == 'workflow_dispatch' &&326+ ((needs.validate.result == 'success' && needs.build.result == 'success') ||
311- (needs.validate.result == 'skipped' || needs.validate.result == 'success') &&327+ (github.event_name == 'workflow_dispatch' &&
312- (needs.build.result == 'skipped' || needs.build.result == 'success')328+ (needs.validate.result == 'skipped' || needs.validate.result == 'success') &&
329+ (needs.build.result == 'skipped' || needs.build.result == 'success')))
313 runs-on: ubuntu-24.04330 runs-on: ubuntu-24.04
314 steps:331 steps:
315- # Elle deploy, BUILD işi yeşil olan en yeni koşuyu alır — ama yalnız bu332+ # Dispatch ve bu koşuda build YOKSA (auto/skip): BUILD işi yeşil olan
316- # koşuda build YOKSA: `tests: force` ile dispatch edildiğinde bu koşunun333+ # en yeni push koşusunu alır. Push ve tests=force buraya düşmez —
317- # kendi taze artefaktı kullanılır (aşağıdaki adım), yoksa build edilen334+ # onların artefaktı aşağıdaki adımdır.
318- # imaj hiçbir yere gitmezdi.
319 - name: Find the newest green build335 - name: Find the newest green build
320 if: needs.build.result == 'skipped'336 if: needs.build.result == 'skipped'
321 env:337 env:
@@ -345,7 +361,7 @@ jobs:
345 run-id: ${{ env.run_id }}361 run-id: ${{ env.run_id }}
346 github-token: ${{ github.token }}362 github-token: ${{ github.token }}
347 363
348- # tests=force: the artifact this very run built and gated.364+ # Push, ve tests=force: artefakt bu koşunun kendisinin ürettiği sürüm.
349 - name: Fetch this run's release365 - name: Fetch this run's release
350 if: needs.build.result == 'success'366 if: needs.build.result == 'success'
351 uses: actions/download-artifact@v4367 uses: actions/download-artifact@v4
PROJECT_STATE.mdmodified+1 -1
@@ -98,7 +98,7 @@ ham veri + soru/cevap defteri: `outputs/EXP-009-model-karsilastirma/`), maliyet
98 - **Servis girişi (2026-09-17 durumu):** HTTP servisi VAR — `src/service/http_app.py`98 - **Servis girişi (2026-09-17 durumu):** HTTP servisi VAR — `src/service/http_app.py`
99 (FastAPI; `/rag/chat`, `/rag/summarize`, `/rag/questions`, `/health`, `/ready`),99 (FastAPI; `/rag/chat`, `/rag/summarize`, `/rag/questions`, `/health`, `/ready`),
100 `compose.yaml` + `Containerfile` + `deploy/hezarfen_rag_compose.service` +100 `compose.yaml` + `Containerfile` + `deploy/hezarfen_rag_compose.service` +
101- `.github/workflows/main.yml` (elle tetiklenen VPS deploy). Backend bu HTTP'yi101+ `.github/workflows/main.yml` (yeşil push'ta otomatik VPS deploy, 2026-09-23; kapasite kapısı `x-rag-envelope`'dan okunur). Backend bu HTTP'yi
102 ÇAĞIRMAZ; gerçek entegrasyon QUIC `hab/2` köprüsüdür ve **taşıması yazıldı**102 ÇAĞIRMAZ; gerçek entegrasyon QUIC `hab/2` köprüsüdür ve **taşıması yazıldı**
103 (`src/bridge/transport.py`, ¶11.4) → `rag.chat` artık telden servis edilir;103 (`src/bridge/transport.py`, ¶11.4) → `rag.chat` artık telden servis edilir;
104 `rag.index` SUNULUR (2026-09-18): not + ekler indekslenir — ek baytları kendi104 `rag.index` SUNULUR (2026-09-18): not + ekler indekslenir — ek baytları kendi
README.mdmodified+23 -17
@@ -97,25 +97,31 @@ kapısı bu iki sayıyı compose'dan okur (koda ikinci kez yazılmaz).
97 97
98 `.github/workflows/main.yml` kardeş servislerle aynı şekli taşır: `Validate`98 `.github/workflows/main.yml` kardeş servislerle aynı şekli taşır: `Validate`
99 (derleme kontrolü) ∥ `Build and test` (`python -m pytest tests/unit -q` süiti +99 (derleme kontrolü) ∥ `Build and test` (`python -m pytest tests/unit -q` süiti +
100-imaj + `release` artefaktı) → `Deploy` (SSH: imajı yükle, deploy sahipli100+imaj + `release` artefaktı) → `Deploy`. Yeşil bir `main` push'u **bu koşunun**
101-`stack.env`'in101+artefaktını kendiliğinden alır: imajı yükle, deploy sahipli `stack.env`'in
102-`HEZARFEN_TAG`'ini çevir, unit'i kur, `/health` ve `/ready` kapılarını geçir,102+`HEZARFEN_TAG`'ini o artefakta çevir, unit'i kur, `/health` ve `/ready`
103-geçmezse önceki tag'e dön). Unit'in kendisi sürümle birlikte iner:103+kapılarını geçir, geçmezse önceki tag'e dön. Unit'in kendisi sürümle birlikte
104-`deploy/hezarfen_rag_compose.service`.104+iner: `deploy/hezarfen_rag_compose.service`.
105-105+
106-**Deploy yalnız elle koşar** (`workflow_dispatch`) ve kapıda **kapasite ön106+**Yeşil bir push servisi kendiliğinden günceller** (kullanıcı kararı
107-kontrolü** vardır: eşikler `compose.yaml`'daki `x-rag-envelope` bloğundan107+2026-09-23; 2026-09-15'teki "yalnız `workflow_dispatch`" kapısı kalktı). Kapıda
108-okunur — RAM ≥ `mem_limit_mb` (**3072 MB**) ve disk ≥ **8 GB**; yetmezse108+**kapasite ön kontrolü** durur ve değişmedi: eşikler `compose.yaml`'daki
109-nedeniyle birlikte reddeder. Gerekçe ölçülmüş: API gömme + API rerank ile109+`x-rag-envelope` bloğundan okunur — RAM ≥ `mem_limit_mb` (**3072 MB**) ve
110-yerel modeller hiç indirilmez (zarf 1,1–2,6 GB), yani eski 12 GB / 20 GB110+disk ≥ **8 GB**; yetmezse nedeniyle birlikte reddeder, eşik gevşetilmez.
111-eşikleri model çağından kalmaydı. Ölçtüğümüz 7 GB'lık geliştirme sunucusu111+Gerekçe ölçülmüş: API gömme + API rerank ile yerel modeller hiç indirilmez
112-(6 466 MB boşta) bu kapıdan artık **geçer**.112+(zarf 1,1–2,6 GB), yani eski 12 GB / 20 GB eşikleri model çağından kalmaydı.
113-113+Ölçtüğümüz 7 GB'lık geliştirme sunucusu (6 466 MB boşta) bu kapıdan artık
114-Kapıyı açmak için: repo secret'larına `SSH_PRIVATE_KEY`/`SSH_HOST`/`SSH_USER`114+**geçer**.
115+
116+Elle yeniden deploy (`workflow_dispatch`, `tests: auto`/`skip`) süiti tekrar
117+ödemeden en yeni yeşil build'in artefaktını alır. `tests: force` önce bu
118+ref'i derler ve test eder, sonra o taze artefaktı deploy eder.
119+
120+İlk kurulum: repo secret'larına `SSH_PRIVATE_KEY`/`SSH_HOST`/`SSH_USER`
115 ekle, sunucuya `~/hezarfen_rag/hezarfen_rag.env` (0600, şablon:121 ekle, sunucuya `~/hezarfen_rag/hezarfen_rag.env` (0600, şablon:
116 `deploy/hezarfen_rag.env.example`) ve `~/hezarfen_rag/data/`122 `deploy/hezarfen_rag.env.example`) ve `~/hezarfen_rag/data/`
117-(`<okul-uuid>/lise/<sınıf>/<ders>/kitap.pdf`, okul segmenti tireli uuid) korpusunu koy, sonra123+(`<okul-uuid>/lise/<sınıf>/<ders>/kitap.pdf`, okul segmenti tireli uuid)
118-`workflow_dispatch` ile koş.124+korpusunu koy. Sonraki `main` push'u deploy'u kendisi koşar.
119 125
120 ### GPU için tek seferlik ana makine kurulumu126 ### GPU için tek seferlik ana makine kurulumu
121 127
scripts/gate-local.shmodified+1 -1
@@ -8,7 +8,7 @@
8 # way). When you have run this script, commit the `Local-Gate:` trailer it8 # way). When you have run this script, commit the `Local-Gate:` trailer it
9 # prints (`--amend` writes it for you) and the push carries proof: the9 # prints (`--amend` writes it for you) and the push carries proof: the
10 # workflow's "Decide test gate" step verifies the trailer against HEAD^{tree}10 # workflow's "Decide test gate" step verifies the trailer against HEAD^{tree}
11-# and then skips the runner suite, so CI only builds, packs and uploads.11+# and then skips the runner suite, so CI only builds, packs, uploads and deploys this run's artifact.
12 #12 #
13 # Default path (nothing here): push without a trailer and GitHub runs13 # Default path (nothing here): push without a trailer and GitHub runs
14 # everything, suite included. Nothing is mandatory; this is the fast lane.14 # everything, suite included. Nothing is mandatory; this is the fast lane.