2025-11-01 14:31:48 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
# Run the Solstice Orchestrator with sensible local defaults
|
2025-11-06 21:44:06 +01:00
|
|
|
# Default to info globally, but enable orchestrator debug to surface runner logs in CI
|
|
|
|
|
export RUST_LOG=${RUST_LOG:-info,orchestrator=debug}
|
2025-11-01 14:31:48 +01:00
|
|
|
export ORCH_CONFIG=${ORCH_CONFIG:-examples/orchestrator-image-map.yaml}
|
|
|
|
|
export AMQP_URL=${AMQP_URL:-amqp://127.0.0.1:5672/%2f}
|
|
|
|
|
export AMQP_EXCHANGE=${AMQP_EXCHANGE:-solstice.jobs}
|
|
|
|
|
export AMQP_QUEUE=${AMQP_QUEUE:-solstice.jobs.v1}
|
|
|
|
|
export AMQP_ROUTING_KEY=${AMQP_ROUTING_KEY:-jobrequest.v1}
|
|
|
|
|
export AMQP_PREFETCH=${AMQP_PREFETCH:-2}
|
|
|
|
|
export GRPC_ADDR=${GRPC_ADDR:-0.0.0.0:50051}
|
2025-11-03 22:36:31 +01:00
|
|
|
export DATABASE_URL=${DATABASE_URL:-postgres://solstice:solstice@127.0.0.1:5432/solstice}
|
|
|
|
|
|
|
|
|
|
# Detect a host IP reachable from VMs (prefer virbr0, fallback to 127.0.0.1)
|
|
|
|
|
if command -v ip >/dev/null 2>&1 && ip addr show virbr0 >/dev/null 2>&1; then
|
|
|
|
|
HOST_IP=$(ip -o -4 addr show virbr0 | awk '{print $4}' | cut -d/ -f1 | head -n1)
|
|
|
|
|
else
|
|
|
|
|
HOST_IP=${HOST_IP_OVERRIDE:-127.0.0.1}
|
|
|
|
|
fi
|
|
|
|
|
# Contact address for gRPC log streaming from guests (used in cloud-init)
|
|
|
|
|
export ORCH_CONTACT_ADDR=${ORCH_CONTACT_ADDR:-$HOST_IP:50051}
|
|
|
|
|
|
2025-11-06 21:44:06 +01:00
|
|
|
# Serve runner binaries directly from the orchestrator unless overridden
|
|
|
|
|
# Set RUNNER_DIR to a directory containing files:
|
|
|
|
|
# - solstice-runner (generic)
|
|
|
|
|
# - solstice-runner-linux (Linux-specific)
|
|
|
|
|
# - solstice-runner-illumos (Illumos-specific)
|
|
|
|
|
export RUNNER_DIR=${RUNNER_DIR:-target/runners}
|
|
|
|
|
# If user didn't provide external URLs, the orchestrator will compose URLs like
|
|
|
|
|
# http://$HOST_IP:${HTTP_PORT:-8081}/runners/solstice-runner[-linux|-illumos]
|
|
|
|
|
# automatically when RUNNER_DIR is set.
|
|
|
|
|
# To force external URLs instead, set SOLSTICE_RUNNER_URL(S) explicitly before running this task.
|
2025-11-03 22:36:31 +01:00
|
|
|
|
2025-11-01 14:31:48 +01:00
|
|
|
# For Linux + libvirt users, customize via LIBVIRT_URI and LIBVIRT_NETWORK
|
2025-11-01 18:38:17 +01:00
|
|
|
exec cargo run -p orchestrator --features libvirt -- \
|
2025-11-01 14:31:48 +01:00
|
|
|
--config "$ORCH_CONFIG" \
|
|
|
|
|
--grpc-addr "$GRPC_ADDR"
|