rdev/scripts/logs.sh
jordan c86516c53a feat: Add multi-domain support with auto-generated slugs for landing page cookbook
Landing page cookbook implementation (Weeks 1-4):

Domain Infrastructure:
- Add project_domains table with migration (013_project_domains.sql)
- Add ProjectDomain model with domain types (primary_auto, primary_custom, alias)
- Add SlugGenerator and ProjectDomainRepository interfaces
- Implement postgres adapters for domain and slug management

Service Layer:
- Add domain CRUD methods to ProjectInfraService
- Generate 8-char random slugs for auto-domains
- Support custom subdomains during project creation
- Add site_live health check to project status
- Trigger CI build after template seeding

Handler Updates:
- Add DomainService interface and adapter pattern
- Rewrite domain handlers to use database-backed service
- Add proper error handling for duplicate/missing domains

CI Integration:
- Add TriggerBuild to CIProvider interface
- Implement TriggerBuild in Woodpecker adapter
- Manually trigger initial build after template seed

Cookbook & Scripts:
- Add landing-test.sh script for E2E testing
- Add release.sh for version releases
- Add logs.sh for quick log access

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 12:55:59 -07:00

66 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# rdev logs - Easy log viewing for rdev-api
# Usage: ./scripts/logs.sh [options]
#
# Options:
# -f, --follow Stream logs (like tail -f)
# -n, --lines NUM Number of lines (default: 100)
# -e, --errors Only show errors/warnings
# -a, --all Show all pods (including previous crashes)
# -p, --previous Show logs from previous container instance
# -h, --help Show this help
set -euo pipefail
export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/orchard9-k3sf.yaml}"
FOLLOW=""
LINES="100"
ERRORS_ONLY=""
ALL_PODS=""
PREVIOUS=""
while [[ $# -gt 0 ]]; do
case $1 in
-f|--follow)
FOLLOW="-f"
shift
;;
-n|--lines)
LINES="$2"
shift 2
;;
-e|--errors)
ERRORS_ONLY="1"
shift
;;
-a|--all)
ALL_PODS="1"
shift
;;
-p|--previous)
PREVIOUS="--previous"
shift
;;
-h|--help)
head -14 "$0" | tail -13
exit 0
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
if [[ -n "$ALL_PODS" ]]; then
# Show logs from all rdev-api pods
kubectl logs -n rdev -l app=rdev-api --tail="$LINES" $FOLLOW $PREVIOUS
elif [[ -n "$ERRORS_ONLY" ]]; then
# Filter for errors/warnings only
kubectl logs -n rdev -l app=rdev-api --tail="$LINES" $PREVIOUS | grep -iE "error|warn|fatal|panic"
else
# Default: latest pod logs
kubectl logs -n rdev -l app=rdev-api --tail="$LINES" $FOLLOW $PREVIOUS
fi