This commit is contained in:
2026-09-11 14:11:37 +03:00
parent 3079c4edc2
commit 7eb0472bb6
7 changed files with 51 additions and 2 deletions

View File

@@ -25,4 +25,4 @@ README.md
COOLIFY.md COOLIFY.md
# Нужни за образа (НЕ игнорирай): # Нужни за образа (НЕ игнорирай):
# Dockerfile, requirements-webapp.txt, webapp/, help_processor.py, help_codes.py, Bairaci.png # Dockerfile, requirements-webapp.txt, VERSION, webapp/, help_processor.py, help_codes.py, Bairaci.png

View File

@@ -10,6 +10,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY requirements-webapp.txt /app/ COPY requirements-webapp.txt /app/
RUN pip install --no-cache-dir -r requirements-webapp.txt RUN pip install --no-cache-dir -r requirements-webapp.txt
COPY VERSION /app/VERSION
COPY webapp /app/webapp COPY webapp /app/webapp
COPY help_processor.py /app/help_processor.py COPY help_processor.py /app/help_processor.py
COPY help_codes.py /app/help_codes.py COPY help_codes.py /app/help_codes.py

View File

@@ -205,6 +205,10 @@ Live: [https://rip.inex-project.net/?prefix=RIP](https://rip.inex-project.net/?p
Нови файлове, които още не са в `.sln`, пак се виждат в Git Changes. При нужда ги добави като Solution Items или ползвай Open Folder. Нови файлове, които още не са в `.sln`, пак се виждат в Git Changes. При нужда ги добави като Solution Items или ползвай Open Folder.
### Сравнение с production (`/healthz`)
След Push + Coolify redeploy сравни `git` от [https://rip.inex-project.net/healthz](https://rip.inex-project.net/healthz) с локалното: Solution Explorer → **scripts** → десен клик `show-version.bat` → **Open Containing Folder** → двоен клик (прозорецът чака Enter). Префиксът (`0.3.0`) е във **VERSION** (Solution Explorer → **deploy**). Production вижда SHA едва след commit + push + redeploy.
### Качване на картинки на сървъра ### Качване на картинки на сървъра
Локалният `help_processor.py` пише в `q:\RIP_Help_Source\Output\` (включително `images/` подпапка). За deploy: Локалният `help_processor.py` пише в `q:\RIP_Help_Source\Output\` (включително `images/` подпапка). За deploy:

View File

@@ -29,6 +29,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{E119
RIP_load.bat = RIP_load.bat RIP_load.bat = RIP_load.bat
RIP_load_force.bat = RIP_load_force.bat RIP_load_force.bat = RIP_load_force.bat
RIP_view.bat = RIP_view.bat RIP_view.bat = RIP_view.bat
show-version.bat = show-version.bat
view.bat = view.bat view.bat = view.bat
EndProjectSection EndProjectSection
EndProject EndProject
@@ -42,6 +43,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "deploy", "deploy", "{BC30BA
docker-compose.yml = docker-compose.yml docker-compose.yml = docker-compose.yml
Dockerfile = Dockerfile Dockerfile = Dockerfile
README.md = README.md README.md = README.md
VERSION = VERSION
EndProjectSection EndProjectSection
EndProject EndProject
Global Global

1
VERSION Normal file
View File

@@ -0,0 +1 @@
0.3.0

24
show-version.bat Normal file
View File

@@ -0,0 +1,24 @@
@echo off
setlocal EnableExtensions EnableDelayedExpansion
chcp 65001 > nul
rem Същите ключове като GET /healthz: ok, version, git.
rem Префиксът е от VERSION; SHA е от git (не може да е в commit-натия файл).
set "ROOT=%~dp0"
if "%ROOT:~-1%"=="\" set "ROOT=%ROOT:~0,-1%"
cd /d "%ROOT%"
set "APP_VERSION=0.3.0"
if exist "%ROOT%\VERSION" (
set /p APP_VERSION=<"%ROOT%\VERSION"
)
set "GIT_SHA=dev"
for /f "usebackq delims=" %%I in (`git rev-parse --short=7 HEAD 2^>nul`) do set "GIT_SHA=%%I"
echo {"ok": true, "version": "%APP_VERSION%+!GIT_SHA!", "git": "!GIT_SHA!"}
echo.
echo Сравни "git" с https://rip.inex-project.net/healthz
echo Production вижда SHA едва след commit + push + Coolify redeploy.
echo.
pause

View File

@@ -16,6 +16,8 @@ Env:
OUTPUT_DIR — локален/mounted път към секциите (default: share) OUTPUT_DIR — локален/mounted път към секциите (default: share)
HOME_IMAGE — път към home картинка HOME_IMAGE — път към home картинка
GIT_SHA / SOURCE_COMMIT / COMMIT_SHA — git SHA (Coolify / Docker build-arg) GIT_SHA / SOURCE_COMMIT / COMMIT_SHA — git SHA (Coolify / Docker build-arg)
Версия: префиксът е файлът VERSION в корена на репото (същият като show-version.bat).
""" """
from __future__ import annotations from __future__ import annotations
@@ -58,7 +60,6 @@ HOME_IMAGE = os.getenv("HOME_IMAGE") # absolute path or None
_IMG_PLACEHOLDER_RE = re.compile(r"\[IMG:\s*([^\]]+?)\s*\]") _IMG_PLACEHOLDER_RE = re.compile(r"\[IMG:\s*([^\]]+?)\s*\]")
BASE_DIR = Path(__file__).parent BASE_DIR = Path(__file__).parent
APP_VERSION = "0.3.0"
_NO_CACHE = {"Cache-Control": "no-store, no-cache, max-age=0"} _NO_CACHE = {"Cache-Control": "no-store, no-cache, max-age=0"}
@@ -69,6 +70,22 @@ def _short_id(value: str, n: int = 7) -> str:
return value[:n] if len(value) > n else value return value[:n] if len(value) > n else value
def _resolve_app_version() -> str:
"""Prefix from repo-root VERSION (same file as show-version.bat)."""
for candidate in (BASE_DIR.parent / "VERSION", Path("/app/VERSION")):
try:
if candidate.is_file():
text = candidate.read_text(encoding="utf-8").strip().splitlines()[0].strip()
if text:
return text
except OSError:
pass
return "0.3.0"
APP_VERSION = _resolve_app_version()
def _resolve_git() -> str: def _resolve_git() -> str:
"""Git SHA / build id that changes on each image rebuild. """Git SHA / build id that changes on each image rebuild.