fix(translate): fix batch sizing — use real available input budget, respect job.batch_size, lazy playwright in docker
- _batch_sizer.py: compute per_batch_budget from actual available_input_budget (context_window - max_output_tokens) instead of sum of first N rows - _batch_sizer.py: cap max_rows_hard_cap with job.batch_size (user config) - _token_budget.py: add available_input_budget and max_output_tokens to return - preview.py: validate required config fields before preview - requirements-docker.txt: add playwright pip package (~5 MB) - backend.entrypoint.sh: lazy playwright install chromium on first start - build.sh: switch tar to tar.xz (-T0 -9), 5.5x smaller bundles - README.md: add offline bundle deployment instructions - playwright.config.js: add testMatch for *.e2e.js files - frontend: preview tab config validation, i18n keys, translationRun store
This commit is contained in:
50
build.sh
50
build.sh
@@ -11,8 +11,8 @@
|
||||
# restart [profile] Rebuild and restart services
|
||||
# logs [profile] Tail logs
|
||||
# status Show running containers for all profiles
|
||||
# bundle <tag> Full release bundle (backend + frontend + postgres .tar's)
|
||||
# bundle:light <tag> Lightweight all-in-one bundle (<200 MB, no Playwright)
|
||||
# bundle <tag> Full release bundle (backend + frontend + postgres .tar.xz's)
|
||||
# bundle:light <tag> Lightweight all-in-one bundle (<200 MB, .tar.xz, no Playwright)
|
||||
# help Show this help
|
||||
#
|
||||
# Profiles: current (default), master
|
||||
@@ -220,15 +220,18 @@ bundle_release() {
|
||||
echo "[bundle] Pulling postgres image ${postgres_image}..."
|
||||
docker pull "${postgres_image}"
|
||||
|
||||
echo "[bundle] Exporting .tar archives..."
|
||||
docker save -o "${DIST_ROOT}/backend.${tag}.tar" "${backend_tag}"
|
||||
docker save -o "${DIST_ROOT}/frontend.${tag}.tar" "${frontend_tag}"
|
||||
docker save -o "${DIST_ROOT}/postgres.${tag}.tar" "${postgres_image}"
|
||||
echo "[bundle] Exporting .tar.xz archives..."
|
||||
echo "[bundle] Compressing backend image..."
|
||||
docker save "${backend_tag}" | xz -T0 -9 > "${DIST_ROOT}/backend.${tag}.tar.xz"
|
||||
echo "[bundle] Compressing frontend image..."
|
||||
docker save "${frontend_tag}" | xz -T0 -9 > "${DIST_ROOT}/frontend.${tag}.tar.xz"
|
||||
echo "[bundle] Compressing postgres image..."
|
||||
docker save "${postgres_image}" | xz -T0 -9 > "${DIST_ROOT}/postgres.${tag}.tar.xz"
|
||||
|
||||
echo "[bundle] Calculating checksums..."
|
||||
(
|
||||
cd "${DIST_ROOT}"
|
||||
sha256sum "backend.${tag}.tar" "frontend.${tag}.tar" "postgres.${tag}.tar" > "sha256sums.${tag}.txt"
|
||||
sha256sum "backend.${tag}.tar.xz" "frontend.${tag}.tar.xz" "postgres.${tag}.tar.xz" > "sha256sums.${tag}.txt"
|
||||
)
|
||||
|
||||
local backend_id frontend_id postgres_id
|
||||
@@ -245,12 +248,15 @@ release_tag=${tag}
|
||||
backend_image=${backend_tag}
|
||||
backend_image_id=${backend_id}
|
||||
backend_repo_digest=${backend_digest}
|
||||
backend_archive=backend.${tag}.tar.xz
|
||||
frontend_image=${frontend_tag}
|
||||
frontend_image_id=${frontend_id}
|
||||
frontend_repo_digest=${frontend_digest}
|
||||
frontend_archive=frontend.${tag}.tar.xz
|
||||
postgres_image=${postgres_image}
|
||||
postgres_image_id=${postgres_id}
|
||||
postgres_repo_digest=${postgres_digest}
|
||||
postgres_archive=postgres.${tag}.tar.xz
|
||||
compose_file=docker-compose.enterprise-clean.yml
|
||||
env_template=.env.enterprise-clean.example
|
||||
env_bootstrap_fields=INITIAL_ADMIN_CREATE,INITIAL_ADMIN_USERNAME,INITIAL_ADMIN_PASSWORD,INITIAL_ADMIN_EMAIL
|
||||
@@ -268,21 +274,21 @@ EOF
|
||||
"image": "${backend_tag}",
|
||||
"image_id": "${backend_id}",
|
||||
"repo_digest": "${backend_digest}",
|
||||
"archive": "backend.${tag}.tar"
|
||||
"archive": "backend.${tag}.tar.xz"
|
||||
},
|
||||
{
|
||||
"role": "frontend",
|
||||
"image": "${frontend_tag}",
|
||||
"image_id": "${frontend_id}",
|
||||
"repo_digest": "${frontend_digest}",
|
||||
"archive": "frontend.${tag}.tar"
|
||||
"archive": "frontend.${tag}.tar.xz"
|
||||
},
|
||||
{
|
||||
"role": "postgres",
|
||||
"image": "${postgres_image}",
|
||||
"image_id": "${postgres_id}",
|
||||
"repo_digest": "${postgres_digest}",
|
||||
"archive": "postgres.${tag}.tar"
|
||||
"archive": "postgres.${tag}.tar.xz"
|
||||
}
|
||||
],
|
||||
"compose_file": "docker-compose.enterprise-clean.yml",
|
||||
@@ -301,9 +307,10 @@ EOF
|
||||
cp "${SCRIPT_DIR}/.env.enterprise-clean.example" "${DIST_ROOT}/.env.enterprise-clean.example"
|
||||
|
||||
echo "[bundle] ✅ Bundle created in ${DIST_ROOT}"
|
||||
echo " docker load -i ${DIST_ROOT}/backend.${tag}.tar"
|
||||
echo " docker load -i ${DIST_ROOT}/frontend.${tag}.tar"
|
||||
echo " docker load -i ${DIST_ROOT}/postgres.${tag}.tar"
|
||||
echo " # Load images (decompress stream):"
|
||||
echo " xz -dc ${DIST_ROOT}/backend.${tag}.tar.xz | docker load"
|
||||
echo " xz -dc ${DIST_ROOT}/frontend.${tag}.tar.xz | docker load"
|
||||
echo " xz -dc ${DIST_ROOT}/postgres.${tag}.tar.xz | docker load"
|
||||
echo " docker compose -f ${DIST_ROOT}/docker-compose.enterprise-clean.yml up"
|
||||
}
|
||||
|
||||
@@ -325,13 +332,13 @@ bundle_light() {
|
||||
echo "[bundle:light] Building all-in-one image ${image_tag}..."
|
||||
docker build -f docker/all-in-one.Dockerfile -t "${image_tag}" .
|
||||
|
||||
echo "[bundle:light] Exporting .tar..."
|
||||
docker save -o "${DIST_ROOT}/ss-tools.${tag}.tar" "${image_tag}"
|
||||
echo "[bundle:light] Exporting .tar.xz..."
|
||||
docker save "${image_tag}" | xz -T0 -9 > "${DIST_ROOT}/ss-tools.${tag}.tar.xz"
|
||||
|
||||
echo "[bundle:light] Calculating checksums..."
|
||||
(
|
||||
cd "${DIST_ROOT}"
|
||||
sha256sum "ss-tools.${tag}.tar" > "sha256sums-light.${tag}.txt"
|
||||
sha256sum "ss-tools.${tag}.tar.xz" > "sha256sums-light.${tag}.txt"
|
||||
)
|
||||
|
||||
local img_id repo_digest
|
||||
@@ -343,7 +350,7 @@ release_tag=${tag}
|
||||
image=${image_tag}
|
||||
image_id=${img_id}
|
||||
repo_digest=${repo_digest}
|
||||
archive=ss-tools.${tag}.tar
|
||||
archive=ss-tools.${tag}.tar.xz
|
||||
compose_file=docker-compose.light.yml
|
||||
checksums_file=sha256sums-light.${tag}.txt
|
||||
generated_at_utc=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
@@ -356,7 +363,7 @@ EOF
|
||||
"image": "${image_tag}",
|
||||
"image_id": "${img_id}",
|
||||
"repo_digest": "${repo_digest}",
|
||||
"archive": "ss-tools.${tag}.tar",
|
||||
"archive": "ss-tools.${tag}.tar.xz",
|
||||
"compose_file": "docker-compose.light.yml",
|
||||
"checksums_file": "sha256sums-light.${tag}.txt"
|
||||
}
|
||||
@@ -415,7 +422,8 @@ COMPOSE
|
||||
cp "${SCRIPT_DIR}/.env.enterprise-clean.example" "${DIST_ROOT}/.env.light.example"
|
||||
|
||||
echo "[bundle:light] ✅ Lightweight bundle created in ${DIST_ROOT}"
|
||||
echo " docker load -i ${DIST_ROOT}/ss-tools.${tag}.tar"
|
||||
echo " # Load image:"
|
||||
echo " xz -dc ${DIST_ROOT}/ss-tools.${tag}.tar.xz | docker load"
|
||||
echo " docker compose -f ${DIST_ROOT}/docker-compose.light.yml up"
|
||||
echo ""
|
||||
echo " Single container (without compose):"
|
||||
@@ -438,10 +446,10 @@ Commands for local docker:
|
||||
status Show running containers for all profiles
|
||||
|
||||
Commands for release bundles:
|
||||
bundle <tag> Full release — backend + frontend + postgres .tar's
|
||||
bundle <tag> Full release — backend + frontend + postgres .tar.xz's
|
||||
Example: ./build.sh bundle v1.0.0
|
||||
|
||||
bundle:light <tag> Lightweight all-in-one image (<200 MB, no Playwright)
|
||||
bundle:light <tag> Lightweight all-in-one image (.tar.xz, <200 MB, no Playwright)
|
||||
Example: ./build.sh bundle:light v1.0.0
|
||||
|
||||
Profiles: current (default), master
|
||||
|
||||
Reference in New Issue
Block a user