Archived
37 lines
1.1 KiB
Bash
Executable File
37 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
BASE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PY="$BASE/.venv/bin/python"
|
|
|
|
action="${1:-help}"
|
|
case "$action" in
|
|
setup)
|
|
python3 -m venv "$BASE/.venv"
|
|
"$BASE/.venv/bin/pip" install --upgrade pip
|
|
"$BASE/.venv/bin/pip" install -r "$BASE/requirements.txt"
|
|
"$PY" -m app.ingest init
|
|
docker compose -f "$BASE/docker-compose.yml" up -d meilisearch
|
|
echo "Klar. Lägg länkar i $BASE/watch/*.url eller använd UI:et."
|
|
;;
|
|
start)
|
|
systemctl --user daemon-reload
|
|
systemctl --user enable --now vv-web vv-worker
|
|
systemctl --user start vv-web vv-worker
|
|
echo "UI: http://127.0.0.1:8080"
|
|
;;
|
|
stop)
|
|
systemctl --user stop vv-web vv-worker
|
|
;;
|
|
status)
|
|
systemctl --user is-active vv-web vv-worker
|
|
curl -s http://127.0.0.1:8080/health
|
|
;;
|
|
web) "$PY" -m app.ingest serve ;;
|
|
worker) "$PY" -m app.ingest daemon ;;
|
|
add) shift; "$PY" -m app.ingest add "$@" ;;
|
|
watch) "$PY" -m app.ingest watch ;;
|
|
*)
|
|
echo "Användning: $0 {setup|start|stop|status|web|worker|add <url>|watch}"
|
|
;;
|
|
esac
|