Files
ChatApp/scripts/prod/logs.sh
T
2026-04-18 23:11:35 +02:00

41 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Tail logs from a service in either the Supabase or LiveKit compose stack.
#
# Usage:
# ./scripts/prod/logs.sh <stack> [<service>] [<tail>]
# stack = supabase | livekit
# service = (optional) single service, default = all
# tail = (optional) line count, default = 100
#
# Examples:
# ./scripts/prod/logs.sh supabase # all services
# ./scripts/prod/logs.sh supabase auth # just auth
# ./scripts/prod/logs.sh supabase auth 300 # auth, last 300 lines
# ./scripts/prod/logs.sh livekit livekit 200
set -euo pipefail
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${here}/config.sh"
stack="${1:-}"
service="${2:-}"
tail_n="${3:-100}"
case "${stack}" in
supabase) dir="${PROD_SUPABASE_DIR}" ;;
livekit) dir="${PROD_LIVEKIT_DIR}" ;;
*)
echo "usage: $0 <supabase|livekit> [service] [tail-lines]" >&2
exit 1
;;
esac
cmd="cd ${dir} && docker compose logs --tail=${tail_n} -f"
if [[ -n "${service}" ]]; then
cmd+=" ${service}"
fi
remote_tty "${cmd}"