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 @@
55 #
66 # git config core.hooksPath .githooks
77 #
8-# The default path is: push and let GitHub run the suite, build, pack and (on a
9-# manual dispatch) deploy. An untested push is legitimate, so this hook does NOT
8+# The default path is: push and let GitHub run the suite, build, pack and
9+# deploy this run's artifact. An untested push is legitimate, so this hook does NOT
1010 # require a stamp. Its single job is to keep the opt-in fast lane honest.
1111 #
1212 # The fast lane is a commit carrying
.github/workflows/main.ymlmodified+50 -34
@@ -6,29 +6,42 @@
66 # Containerfile'ından imaj (ENV bloğu dağıtım
77 # varsayılanlarının TEK kaynağıdır) ve imaj tarball'ı +
88 # compose dosyaları koşunun artefaktı olarak yüklenir.
9-# Deploy — SSH: kapasite ön kontrolü, imajı yükle, deploy sahipli
10-# stack.env'in HEZARFEN_TAG'ini ona çevir, compose.yaml +
11-# unit'i kur, stack'i yeniden başlat, `/health` ve
12-# `/ready` kapılarını geçir, olmazsa önceki tag'e dön.
9+# Deploy — push'ta OTOMATIK: SSH ile kapasite ön kontrolü, imajı
10+# yükle, deploy sahipli stack.env'in HEZARFEN_TAG'ini
11+# BU KOŞUNUN artefaktına çevir, compose.yaml + unit'i
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.
1315 #
14-# ⚠️ DEPLOY SADECE ELLE (workflow_dispatch) KOŞAR — bilinçli:
15-# Servis, aynı sunucuda koşan backend+postgres+frontend+chatbot'un YANINA
16-# eklenir; kapasite ön kontrolü olmadan otomatik başlatmak canlı stack'i RAM
17-# için sıkıştırırdı. Gömme ve rerank artık UZAK API'de (dağıtım varsayılanı
18-# = api) → yerel modeller (~4,5 GB) indirilmez; ölçülen zarf torch ~0,4 GB +
19-# 0,53 GB/10k chunk = 1,1 GB (tek korpus) … 2,6 GB (3 korpus), bkz.
20-# PROJECT_STATE §11.2. Deploy işi eşiği compose.yaml'daki `x-rag-envelope`
21-# bloğundan OKUR — tek kaynak; sayıyı buraya ikinci kez yazmak, model
22-# çağından kalma 12 GB eşiğinin sessizce geri gelmesi demekti.
23-# 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ÇİLMEZ
25-# — o yapılandırma için eşiği sunucuya elle yükseltmek gerekir.
16+# KAPASİTE KAPISI DEĞİŞMEDİ (kullanıcı kararı 2026-09-23: yeşil push artık
17+# kendiliğinden deploy eder; 2026-09-15'teki "yalnız elle" kararı kalktı).
18+# Eşik hâlâ compose.yaml `x-rag-envelope` bloğundan OKUNUR — tek kaynak;
19+# sayıyı buraya ikinci kez yazmak, model çağından kalma 12 GB eşiğinin
20+# sessizce geri gelmesi demekti. Yetmezse deploy sayılarıyla reddeder,
21+# eşiği gevşetmez. Gömme ve rerank UZAK API'de (dağıtım varsayılanı = api)
22+# → yerel modeller (~4,5 GB) indirilmez; ölçülen zarf torch ~0,4 GB +
23+# 0,53 GB/10k chunk = 1,1 GB (tek korpus) … 2,6 GB (3 korpus), bkz.
24+# PROJECT_STATE §11.2.
25+# Operatör yerel yola (RAG_EMBED_PROVIDER=local) dönerse zarf büyür ve
26+# GPU'suz makinede rerank 95,9 s sürer: ürün kapısı O-05 p50 <= 6 s
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.
2638 #
2739 # TWO TEST PATHS — the default is the full one (same shape as hezarfen_backend):
2840 #
2941 # DEFAULT Push it and let GitHub do everything: suite, image, bundle,
30-# artifact. This is also the recovery path when the local machine
31-# is unavailable.
42+# artifact, and — when Validate and Build are both green —
43+# deploy of THIS run's artifact. This is also the recovery
44+# path when the local machine is unavailable.
3245 # SPECIAL Prove the suite on your own machine first (scripts/gate-local.sh
3346 # — ~32 s here). The suite currently HANGS on the runner: run
3447 # 35297989416 sat at 7% for 73 minutes until it was cancelled by
@@ -36,7 +49,8 @@
3649 # --amend, appends) a `Local-Gate: <tree> (<n> passed, <t>s)`
3750 # trailer; the "Decide test gate" step verifies it against
3851 # 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.
4054 # A stale or copy-pasted trailer silently falls back to running
4155 # the suite, so the fallback costs time, never verification.
4256 # Opt the pre-push hook in per clone:
@@ -56,10 +70,10 @@ on:
5670 push:
5771 branches:
5872 - main
59- # Deploy'un TEK kapısı — yukarıdaki başlık yorumuna bakın.
60- # `tests` is the escape hatch of the manual door: auto/skip redeploy the
61- # newest green artifact (the suite is not paid again), force builds and
62- # tests the dispatched ref first and deploys that fresh artifact.
73+ # Elle yeniden deploy kapısı — yukarıdaki başlık yorumuna bakın.
74+ # auto/skip: en yeni yeşil artefaktı yeniden deploy eder (süit tekrar
75+ # ödenmez). force: bu ref'i önce derler ve test eder, o taze artefaktı
76+ # deploy eder.
6377 workflow_dispatch:
6478 inputs:
6579 tests:
@@ -302,20 +316,22 @@ jobs:
302316 concurrency:
303317 group: deploy
304318 cancel-in-progress: false
305- # Push'ta iki CI işi koşar ama deploy KOŞMAZ (kapı elle açılır);
306- # dispatch'te ikisi de atlanır ve `always()` bu atlamanın kapıyı
307- # geçmesini engeller.
319+ # Push: yalnız validate VE build yeşilse — ikisi de sunucuyu kapılar;
320+ # artefakt BU KOŞUNUNKİDİR (aşağıda needs.build.result == success).
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.
308324 if: >-
309325 always() &&
310- github.event_name == 'workflow_dispatch' &&
311- (needs.validate.result == 'skipped' || needs.validate.result == 'success') &&
312- (needs.build.result == 'skipped' || needs.build.result == 'success')
326+ ((needs.validate.result == 'success' && needs.build.result == 'success') ||
327+ (github.event_name == 'workflow_dispatch' &&
328+ (needs.validate.result == 'skipped' || needs.validate.result == 'success') &&
329+ (needs.build.result == 'skipped' || needs.build.result == 'success')))
313330 runs-on: ubuntu-24.04
314331 steps:
315- # Elle deploy, BUILD işi yeşil olan en yeni koşuyu alır — ama yalnız bu
316- # koşuda build YOKSA: `tests: force` ile dispatch edildiğinde bu koşunun
317- # kendi taze artefaktı kullanılır (aşağıdaki adım), yoksa build edilen
318- # imaj hiçbir yere gitmezdi.
332+ # Dispatch ve bu koşuda build YOKSA (auto/skip): BUILD işi yeşil olan
333+ # en yeni push koşusunu alır. Push ve tests=force buraya düşmez —
334+ # onların artefaktı aşağıdaki adımdır.
319335 - name: Find the newest green build
320336 if: needs.build.result == 'skipped'
321337 env:
@@ -345,7 +361,7 @@ jobs:
345361 run-id: ${{ env.run_id }}
346362 github-token: ${{ github.token }}
347363
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.
349365 - name: Fetch this run's release
350366 if: needs.build.result == 'success'
351367 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
9898 - **Servis girişi (2026-09-17 durumu):** HTTP servisi VAR — `src/service/http_app.py`
9999 (FastAPI; `/rag/chat`, `/rag/summarize`, `/rag/questions`, `/health`, `/ready`),
100100 `compose.yaml` + `Containerfile` + `deploy/hezarfen_rag_compose.service` +
101- `.github/workflows/main.yml` (elle tetiklenen VPS deploy). Backend bu HTTP'yi
101+ `.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
102102 ÇAĞIRMAZ; gerçek entegrasyon QUIC `hab/2` köprüsüdür ve **taşıması yazıldı**
103103 (`src/bridge/transport.py`, ¶11.4) → `rag.chat` artık telden servis edilir;
104104 `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).
9797
9898 `.github/workflows/main.yml` kardeş servislerle aynı şekli taşır: `Validate`
9999 (derleme kontrolü) ∥ `Build and test` (`python -m pytest tests/unit -q` süiti +
100-imaj + `release` artefaktı) → `Deploy` (SSH: imajı yükle, deploy sahipli
101-`stack.env`'in
102-`HEZARFEN_TAG`'ini çevir, unit'i kur, `/health` ve `/ready` kapılarını geçir,
103-geçmezse önceki tag'e dön). Unit'in kendisi sürümle birlikte iner:
104-`deploy/hezarfen_rag_compose.service`.
105-
106-**Deploy yalnız elle koşar** (`workflow_dispatch`) ve kapıda **kapasite ön
107-kontrolü** vardır: eşikler `compose.yaml`'daki `x-rag-envelope` bloğundan
108-okunur — RAM ≥ `mem_limit_mb` (**3072 MB**) ve disk ≥ **8 GB**; yetmezse
109-nedeniyle birlikte reddeder. Gerekçe ölçülmüş: API gömme + API rerank ile
110-yerel modeller hiç indirilmez (zarf 1,1–2,6 GB), yani eski 12 GB / 20 GB
111-eşikleri model çağından kalmaydı. Ölçtüğümüz 7 GB'lık geliştirme sunucusu
112-(6 466 MB boşta) bu kapıdan artık **geçer**.
113-
114-Kapıyı açmak için: repo secret'larına `SSH_PRIVATE_KEY`/`SSH_HOST`/`SSH_USER`
100+imaj + `release` artefaktı) → `Deploy`. Yeşil bir `main` push'u **bu koşunun**
101+artefaktını kendiliğinden alır: imajı yükle, deploy sahipli `stack.env`'in
102+`HEZARFEN_TAG`'ini o artefakta çevir, unit'i kur, `/health` ve `/ready`
103+kapılarını geçir, geçmezse önceki tag'e dön. Unit'in kendisi sürümle birlikte
104+iner: `deploy/hezarfen_rag_compose.service`.
105+
106+**Yeşil bir push servisi kendiliğinden günceller** (kullanıcı kararı
107+2026-09-23; 2026-09-15'teki "yalnız `workflow_dispatch`" kapısı kalktı). Kapıda
108+**kapasite ön kontrolü** durur ve değişmedi: eşikler `compose.yaml`'daki
109+`x-rag-envelope` bloğundan okunur — RAM ≥ `mem_limit_mb` (**3072 MB**) ve
110+disk ≥ **8 GB**; yetmezse nedeniyle birlikte reddeder, eşik gevşetilmez.
111+Gerekçe ölçülmüş: API gömme + API rerank ile yerel modeller hiç indirilmez
112+(zarf 1,1–2,6 GB), yani eski 12 GB / 20 GB eşikleri model çağından kalmaydı.
113+Ölçtüğümüz 7 GB'lık geliştirme sunucusu (6 466 MB boşta) bu kapıdan artık
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`
115121 ekle, sunucuya `~/hezarfen_rag/hezarfen_rag.env` (0600, şablon:
116122 `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, sonra
118-`workflow_dispatch` ile koş.
123+(`<okul-uuid>/lise/<sınıf>/<ders>/kitap.pdf`, okul segmenti tireli uuid)
124+korpusunu koy. Sonraki `main` push'u deploy'u kendisi koşar.
119125
120126 ### GPU için tek seferlik ana makine kurulumu
121127
scripts/gate-local.shmodified+1 -1
@@ -8,7 +8,7 @@
88 # way). When you have run this script, commit the `Local-Gate:` trailer it
99 # prints (`--amend` writes it for you) and the push carries proof: the
1010 # 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.
1212 #
1313 # Default path (nothing here): push without a trailer and GitHub runs
1414 # everything, suite included. Nothing is mandatory; this is the fast lane.