de88679f25
- Fail startup on unsafe or malformed production settings (scripts/validate_config.py), run it before migrations, and stop on a failed `aerich upgrade`. - Forward the context-budget, timeout and metrics settings through Compose; accept the historical TAVILIY_API_KEY spelling. - Build the image from uv.lock and yarn.lock in a multi-stage Dockerfile. - Add Gitea Actions CI: Ruff, unit tests, context evaluation, frontend tests, typecheck and build. - Update README and deployment/development docs to match the current stack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
1.8 KiB
Bash
48 lines
1.8 KiB
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# Support the historical misspelling for externally supplied environments.
|
|
if [ -z "${TAVILY_API_KEY:-}" ] && [ -n "${TAVILIY_API_KEY:-}" ]; then
|
|
export TAVILY_API_KEY="${TAVILIY_API_KEY}"
|
|
fi
|
|
|
|
python scripts/validate_config.py
|
|
|
|
echo "Running database migrations..."
|
|
aerich upgrade
|
|
|
|
# Ensure Obsidian vault directory exists
|
|
mkdir -p /app/data/obsidian
|
|
|
|
# Start continuous Obsidian sync if enabled
|
|
if [ "${OBSIDIAN_CONTINUOUS_SYNC:-false}" = "true" ]; then
|
|
if [ -z "${OBSIDIAN_EMAIL:-}" ] || [ -z "${OBSIDIAN_PASSWORD:-}" ] || [ -z "${OBSIDIAN_VAULT_ID:-}" ]; then
|
|
echo "WARNING: OBSIDIAN_EMAIL, OBSIDIAN_PASSWORD, or OBSIDIAN_VAULT_ID not set. Skipping sync."
|
|
else
|
|
echo "Setting up Obsidian sync..."
|
|
|
|
VAULT_PATH="${OBSIDIAN_VAULT_PATH:-/app/data/obsidian}"
|
|
|
|
# Login and setup sync (foreground, must complete before sync starts)
|
|
if ob login --email "${OBSIDIAN_EMAIL}" --password "${OBSIDIAN_PASSWORD}" && \
|
|
ob sync-setup \
|
|
--vault "${OBSIDIAN_VAULT_ID}" \
|
|
--path "${VAULT_PATH}" \
|
|
--password "${OBSIDIAN_E2E_PASSWORD:-}" \
|
|
--device-name "${OBSIDIAN_DEVICE_NAME:-simbarag}"; then
|
|
# Remove stale lock from previous container run
|
|
rm -rf "${VAULT_PATH}/.obsidian/.sync.lock"
|
|
# Set sync to pull-only (read-only) mode
|
|
ob sync-config --mode pull-only --path "${VAULT_PATH}"
|
|
# Start continuous sync in background
|
|
echo "Starting Obsidian continuous sync (pull-only)..."
|
|
ob sync --continuous --path "${VAULT_PATH}" &
|
|
else
|
|
echo "WARNING: Obsidian sync setup failed. Continuing without sync."
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
echo "Starting application..."
|
|
exec python app.py
|