remove xvfb, use headless with cookie auth
This commit is contained in:
@@ -7,13 +7,6 @@ RUN groupadd --system app && useradd --system --gid app --create-home app
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Xvfb for headed Chromium in container (IAAI blocks headless)
|
|
||||||
RUN apt-get update -qq && apt-get install -y --no-install-recommends xvfb \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Required for non-root Xvfb runtime in containers
|
|
||||||
RUN mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix
|
|
||||||
|
|
||||||
COPY pyproject.toml uv.lock ./
|
COPY pyproject.toml uv.lock ./
|
||||||
RUN pip install --no-cache-dir uv \
|
RUN pip install --no-cache-dir uv \
|
||||||
&& uv export --format requirements-txt --no-dev --no-hashes --no-emit-project --frozen -o /tmp/requirements.txt \
|
&& uv export --format requirements-txt --no-dev --no-hashes --no-emit-project --frozen -o /tmp/requirements.txt \
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ x-app-env: &app-env
|
|||||||
CELERY_WORKER_MAX_TASKS_PER_CHILD: ${CELERY_WORKER_MAX_TASKS_PER_CHILD:-20}
|
CELERY_WORKER_MAX_TASKS_PER_CHILD: ${CELERY_WORKER_MAX_TASKS_PER_CHILD:-20}
|
||||||
IAAI_TOKENS_FILE: ${IAAI_TOKENS_FILE:-/data/tokens.json}
|
IAAI_TOKENS_FILE: ${IAAI_TOKENS_FILE:-/data/tokens.json}
|
||||||
IAAI_RUNTIME_CONFIG_FILE: ${IAAI_RUNTIME_CONFIG_FILE:-/app/runtime_config.json}
|
IAAI_RUNTIME_CONFIG_FILE: ${IAAI_RUNTIME_CONFIG_FILE:-/app/runtime_config.json}
|
||||||
|
IAAI_STORAGE_STATE_PATH: ${IAAI_STORAGE_STATE_PATH:-/data/storage_state.json}
|
||||||
|
IAAI_SESSION_MAX_AGE_DAYS: ${IAAI_SESSION_MAX_AGE_DAYS:-30}
|
||||||
|
IAAI_SESSION_SAVE_ON_EXIT: ${IAAI_SESSION_SAVE_ON_EXIT:-true}
|
||||||
|
IAAI_LOGIN_EMAIL: ${IAAI_LOGIN_EMAIL:-}
|
||||||
|
IAAI_LOGIN_PASSWORD: ${IAAI_LOGIN_PASSWORD:-}
|
||||||
TZ: ${TZ:-UTC}
|
TZ: ${TZ:-UTC}
|
||||||
|
|
||||||
x-env-file: &env-file
|
x-env-file: &env-file
|
||||||
|
|||||||
@@ -55,47 +55,6 @@ start_proxy_bridge_if_needed() {
|
|||||||
echo "[entrypoint] Proxy bridge started (PID ${BRIDGE_PID})"
|
echo "[entrypoint] Proxy bridge started (PID ${BRIDGE_PID})"
|
||||||
}
|
}
|
||||||
|
|
||||||
start_xvfb_if_needed() {
|
|
||||||
if ! needs_browser_runtime "$@"; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# IAAI blocks headless Chromium on Linux; run headed via Xvfb virtual display
|
|
||||||
export DISPLAY=:99
|
|
||||||
export IAAI_HEADLESS=false
|
|
||||||
local xvfb_pid_file="/tmp/xvfb-99.pid"
|
|
||||||
|
|
||||||
if [ -f "${xvfb_pid_file}" ]; then
|
|
||||||
local existing_pid
|
|
||||||
existing_pid="$(cat "${xvfb_pid_file}")"
|
|
||||||
if [ -n "${existing_pid}" ] && kill -0 "${existing_pid}" 2>/dev/null; then
|
|
||||||
echo "[entrypoint] Reusing existing Xvfb on DISPLAY=${DISPLAY} (PID ${existing_pid})"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
echo "[entrypoint] Removing stale Xvfb pid file"
|
|
||||||
rm -f "${xvfb_pid_file}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -S /tmp/.X11-unix/X99 ] || [ -f /tmp/.X99-lock ]; then
|
|
||||||
echo "[entrypoint] Removing stale Xvfb socket/lock files for DISPLAY=${DISPLAY}"
|
|
||||||
rm -f /tmp/.X11-unix/X99 /tmp/.X99-lock
|
|
||||||
fi
|
|
||||||
|
|
||||||
Xvfb :99 -screen 0 1920x1080x24 -nolisten tcp &
|
|
||||||
XVFB_PID=$!
|
|
||||||
echo "${XVFB_PID}" > "${xvfb_pid_file}"
|
|
||||||
sleep 0.5
|
|
||||||
|
|
||||||
if ! kill -0 "${XVFB_PID}" 2>/dev/null; then
|
|
||||||
echo "[entrypoint] ERROR: Xvfb failed to start on DISPLAY=${DISPLAY}"
|
|
||||||
rm -f "${xvfb_pid_file}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "[entrypoint] Xvfb started (PID ${XVFB_PID}, DISPLAY=${DISPLAY})"
|
|
||||||
}
|
|
||||||
|
|
||||||
start_proxy_bridge_if_needed "$@"
|
start_proxy_bridge_if_needed "$@"
|
||||||
start_xvfb_if_needed "$@"
|
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user