mirror of
https://github.com/germondai/trawl.git
synced 2026-08-17 12:11:23 +02:00
Merge pull request #4 from germondai/3-bug-docker-healthchecks-are-failing
3 bug docker healthchecks are failing
This commit is contained in:
+1
-3
@@ -33,9 +33,6 @@ RUN --mount=type=secret,id=GITHUB_TOKEN,env=GITHUB_TOKEN \
|
||||
|
||||
# Secret mount keeps GITHUB_TOKEN out of image layers.
|
||||
# Token prevents GitHub API rate-limits that cause the binary download to stall.
|
||||
RUN --mount=type=secret,id=GITHUB_TOKEN,env=GITHUB_TOKEN \
|
||||
bun x camoufox-js fetch \
|
||||
&& rm -rf /opt/camoufox/fonts/macos /opt/camoufox/fonts/windows
|
||||
|
||||
# ── Stage 3: lean runtime (only API-required files) ────────────────────────────
|
||||
FROM ubuntu:22.04
|
||||
@@ -60,6 +57,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
libasound2 \
|
||||
fonts-liberation \
|
||||
ca-certificates \
|
||||
curl \
|
||||
&& apt-get clean
|
||||
|
||||
COPY --from=oven/bun:1.3.14 /usr/local/bin/bun /usr/local/bin/bun
|
||||
|
||||
+16
-13
@@ -73,19 +73,22 @@ function flareSolverrError(url: string, message: string): FlareSolverrResponse {
|
||||
}
|
||||
|
||||
new Elysia()
|
||||
.get("/health", () => ({
|
||||
status: pool ? "ok" : "starting",
|
||||
uptime: Math.floor((Date.now() - startTime) / 1000),
|
||||
pool:
|
||||
pool?.getStats() ??
|
||||
({
|
||||
total: 0,
|
||||
busy: 0,
|
||||
available: 0,
|
||||
restarts: 0,
|
||||
avgRestarts: 0,
|
||||
} satisfies PoolStats),
|
||||
}))
|
||||
.get("/health", ({ set }) => {
|
||||
if (!pool) set.status = 503
|
||||
return {
|
||||
status: pool ? "ok" : "starting",
|
||||
uptime: Math.floor((Date.now() - startTime) / 1000),
|
||||
pool:
|
||||
pool?.getStats() ??
|
||||
({
|
||||
total: 0,
|
||||
busy: 0,
|
||||
available: 0,
|
||||
restarts: 0,
|
||||
avgRestarts: 0,
|
||||
} satisfies PoolStats),
|
||||
}
|
||||
})
|
||||
|
||||
.get("/stats", () => {
|
||||
const stats = pool?.getStats() ?? {
|
||||
|
||||
@@ -25,6 +25,12 @@ services:
|
||||
dns:
|
||||
- 1.1.1.1
|
||||
- 8.8.8.8
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-sf", "http://localhost:8191/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 90s
|
||||
|
||||
web:
|
||||
build:
|
||||
|
||||
@@ -6,3 +6,9 @@ services:
|
||||
shm_size: 1gb
|
||||
environment:
|
||||
BROWSER_POOL_SIZE: 1
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-sf", "http://localhost:8191/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 90s
|
||||
|
||||
@@ -18,8 +18,11 @@ services:
|
||||
depends_on:
|
||||
- redis
|
||||
healthcheck:
|
||||
test: wget -qO- http://localhost:8191/health
|
||||
test: ["CMD", "curl", "-sf", "http://localhost:8191/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 90s
|
||||
|
||||
volumes:
|
||||
redis_data:
|
||||
|
||||
@@ -14,6 +14,12 @@ services:
|
||||
BROWSER_POOL_SIZE: 3
|
||||
depends_on:
|
||||
- redis
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-sf", "http://localhost:8191/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 90s
|
||||
|
||||
volumes:
|
||||
redis_data:
|
||||
|
||||
Reference in New Issue
Block a user