#!/usr/bin/env bash # Starts the app for a native install. systemd (Linux) or launchd (macOS) runs this as the # service user. It reads .env, keeps the git credentials away from the app, and execs uvicorn. set -euo pipefail INSTALL_DIR=$(cd "$(dirname "$0")/.." && pwd) . "$INSTALL_DIR/native/lib.sh" . "$INSTALL_DIR/.native" cd "$INSTALL_DIR" load_dotenv "$INSTALL_DIR/.env" unset GIT_TOKEN GIT_USERNAME GIT_SSH_KEY APP_VERSION=$(git -c safe.directory="$INSTALL_DIR" -C "$INSTALL_DIR" rev-parse --short HEAD 2>/dev/null || echo dev) PORT=$(app_port) export ROLE APP_VERSION PORT INSTALL_DIR INSTALL_MODE=native DATA_DIR="$INSTALL_DIR/data" PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 # How to deploy, as shown on the Settings page. sudo only where it exists (LXCs usually have # none and you are root there); macOS runs it as the installing user. UPDATE_COMMAND="$NAME-update" if [ "$PLATFORM" = systemd ] && command -v sudo >/dev/null 2>&1; then UPDATE_COMMAND="sudo $NAME-update"; fi if systemd-detect-virt -cq 2>/dev/null; then UPDATE_COMMAND="$NAME-update (from the Proxmox node: pct exec -- /usr/local/bin/$NAME-update)" fi export UPDATE_COMMAND exec "$INSTALL_DIR/.venv/bin/uvicorn" app.main:app --host "$(app_host)" --port "$PORT" \ --no-server-header --timeout-graceful-shutdown 10