mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: address code review findings before merge
- Warn on startup if deprecated STIRLING_VARIANT env var is set - Broaden upscale.py exception handling to catch RuntimeError/OSError for Lanczos fallback (not just ImportError) - Add QEMU + multi-arch (amd64+arm64) to CI Docker build test - Use .get() instead of .all() for single-row health check query - Restore container_name in docker-compose.yml for backwards compat
This commit is contained in:
@@ -87,11 +87,14 @@ jobs:
|
|||||||
|
|
||||||
- uses: docker/setup-buildx-action@v3
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
- uses: docker/build-push-action@v6
|
- uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: docker/Dockerfile
|
file: docker/Dockerfile
|
||||||
push: false
|
push: false
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: stirling-image:ci
|
tags: stirling-image:ci
|
||||||
cache-from: type=gha,scope=unified
|
cache-from: type=gha,scope=unified
|
||||||
cache-to: type=gha,mode=max,scope=unified
|
cache-to: type=gha,mode=max,scope=unified
|
||||||
|
|||||||
@@ -23,6 +23,14 @@ import { teamsRoutes } from "./routes/teams.js";
|
|||||||
import { registerToolRoutes } from "./routes/tools/index.js";
|
import { registerToolRoutes } from "./routes/tools/index.js";
|
||||||
import { userFileRoutes } from "./routes/user-files.js";
|
import { userFileRoutes } from "./routes/user-files.js";
|
||||||
|
|
||||||
|
// Warn about deprecated STIRLING_VARIANT env var
|
||||||
|
if (process.env.STIRLING_VARIANT) {
|
||||||
|
console.warn(
|
||||||
|
`WARNING: STIRLING_VARIANT="${process.env.STIRLING_VARIANT}" is set but ignored. ` +
|
||||||
|
"There is now a single unified image with all features. Remove STIRLING_VARIANT from your environment.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Run before anything else
|
// Run before anything else
|
||||||
runMigrations();
|
runMigrations();
|
||||||
console.log("Database initialized");
|
console.log("Database initialized");
|
||||||
@@ -112,7 +120,7 @@ await docsRoutes(app);
|
|||||||
app.get("/api/v1/health", async (_request, reply) => {
|
app.get("/api/v1/health", async (_request, reply) => {
|
||||||
let dbOk = false;
|
let dbOk = false;
|
||||||
try {
|
try {
|
||||||
db.select().from(schema.settings).limit(1).all();
|
db.select().from(schema.settings).limit(1).get();
|
||||||
dbOk = true;
|
dbOk = true;
|
||||||
} catch {
|
} catch {
|
||||||
/* db unreachable */
|
/* db unreachable */
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ services:
|
|||||||
context: ..
|
context: ..
|
||||||
dockerfile: docker/Dockerfile
|
dockerfile: docker/Dockerfile
|
||||||
image: stirlingimage/stirling-image:latest
|
image: stirlingimage/stirling-image:latest
|
||||||
|
container_name: stirling-image
|
||||||
ports:
|
ports:
|
||||||
- "1349:1349"
|
- "1349:1349"
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ def main():
|
|||||||
emit_progress(95, "Saving result")
|
emit_progress(95, "Saving result")
|
||||||
result.save(output_path)
|
result.save(output_path)
|
||||||
method = "realesrgan"
|
method = "realesrgan"
|
||||||
except ImportError:
|
except (ImportError, FileNotFoundError, RuntimeError, OSError):
|
||||||
# RealESRGAN not installed - fall back to Lanczos
|
# RealESRGAN unavailable or failed - fall back to Lanczos
|
||||||
emit_progress(50, "Upscaling with Lanczos")
|
emit_progress(50, "Upscaling with Lanczos")
|
||||||
img_upscaled = img.resize(new_size, Image.LANCZOS)
|
img_upscaled = img.resize(new_size, Image.LANCZOS)
|
||||||
emit_progress(95, "Saving result")
|
emit_progress(95, "Saving result")
|
||||||
|
|||||||
Reference in New Issue
Block a user