Skip to content

Latest commit

 

History

History
162 lines (126 loc) · 4.28 KB

File metadata and controls

162 lines (126 loc) · 4.28 KB

eoAPI Scripts

This directory contains the implementation scripts for the eoAPI CLI.

Structure

scripts/
├── lib/
│   ├── common.sh          # Shared utilities (logging, validation)
│   └── k8s.sh             # Kubernetes helper functions
├── raw/
│   ├── ingest.sh          # Data ingestion (pure: psql/jq + a DSN, no kubectl)
│   └── export.sh          # Data export to NDJSON (pure: psql + a DSN, no kubectl)
├── cluster.sh             # Cluster management (start, stop, clean, status, inspect)
├── deployment.sh          # Deployment operations (run, debug)
├── test.sh                # Test suites (schema, lint, unit, integration)
├── data-management.sh     # Kubernetes wrapper for raw/ingest.sh and raw/export.sh
└── docs.sh                # Documentation (generate, serve)

Usage

All scripts are accessed through the main CLI:

./eoapi-cli <command> <subcommand> [options]

# Examples
./eoapi-cli cluster start
./eoapi-cli deployment run
./eoapi-cli test all
./eoapi-cli ingest collections.json items.json
./eoapi-cli export ./stac-export
./eoapi-cli docs serve

CLI Reference

The eoAPI CLI provides a unified interface for all operations:

Cluster Management

# Start local k3s cluster
./eoapi-cli cluster start

# Check cluster status
./eoapi-cli cluster status

# Stop cluster (preserves data)
./eoapi-cli cluster stop

# Clean up cluster and temporary files
./eoapi-cli cluster clean

# Detailed cluster diagnostics
./eoapi-cli cluster inspect

Deployment Operations

# Deploy eoAPI on k3d (Traefik ingress)
./eoapi-cli deployment run --profile k3d

# Deploy eoAPI on minikube (NGINX ingress)
./eoapi-cli deployment run --profile minikube

# Deploy with custom values (alternative to --profile)
./eoapi-cli deployment run -f charts/eoapi/profiles/local/minikube.yaml

# Debug deployment
./eoapi-cli deployment debug

Testing

# Run all tests
./eoapi-cli test all

# Run specific test suites
./eoapi-cli test schema      # Validate Helm chart schema
./eoapi-cli test lint        # Run Helm lint
./eoapi-cli test unit        # Run Helm unit tests
./eoapi-cli test integration # Run integration tests

Data Ingestion and Export

# Ingest sample data
./eoapi-cli ingest <collections-file> <items-file>

# Export STAC data to NDJSON (e.g. before migrating to a new PgSTAC)
./eoapi-cli export ./stac-export

# Both auto-discover/port-forward the current cluster's own database by
# default; pass --target-dsn / --source-dsn to talk to any other PgSTAC
# database instead (see docs/manage-data.md, or scripts/raw/*.sh directly
# for a Kubernetes-free standalone tool).

Documentation

# Generate documentation
./eoapi-cli docs generate

# Serve documentation locally
./eoapi-cli docs serve

# Check documentation
./eoapi-cli docs check

Getting Help

# Show main help
./eoapi-cli --help

# Show command-specific help
./eoapi-cli cluster --help
./eoapi-cli deployment --help
./eoapi-cli test --help

Integration testing

With k3d (recommended)

# Complete workflow with k3d-managed cluster
./eoapi-cli cluster start
./eoapi-cli deployment run --profile k3d
./eoapi-cli test integration
./eoapi-cli cluster clean

With minikube

kubectl config use-context minikube
./eoapi-cli deployment run --profile minikube
./eoapi-cli test integration

With existing k3s/k8s cluster

# Ensure kubectl is configured for your cluster
./eoapi-cli deployment run          # Deploy eoAPI
./eoapi-cli test integration        # Run tests

Test options:

  • test all - Run all test suites
  • test integration --pytest-args="-v" - Pass pytest arguments (flags may appear before or after the subcommand)
  • test integration --pytest-args "-v -k test_browser" - Run a filtered subset of integration tests

Environment variables

  • NAMESPACE - Kubernetes namespace (default: eoapi)
  • RELEASE_NAME - Helm release name (default: eoapi)
  • LOCAL_PROFILE - Local cluster profile for deployment (k3d or minikube; same as --profile)
  • DEBUG_MODE - Enable debug output (set to true)
  • CLUSTER_NAME - K3s cluster name (default: eoapi-local)

The scripts auto-detect CI environments through common environment variables (CI, GITHUB_ACTIONS, etc).