mirror of
https://codeberg.org/Toasterson/solstice-ci.git
synced 2026-04-10 13:20:41 +00:00
This commit introduces: - A heuristic to mark jobs as failed if VMs stop quickly without generating logs. - Improved configuration for runner URLs, including auto-detection of host IPs and default multi-OS runner URLs. - Updates to the orchestrator's HTTP routing for consistency. - New task scripts for Forge integration and updates to environment defaults for local development.
46 lines
No EOL
2.3 KiB
Bash
Executable file
46 lines
No EOL
2.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
# Run the Solstice Orchestrator with sensible local defaults
|
|
export RUST_LOG=${RUST_LOG:-info}
|
|
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}
|
|
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}
|
|
|
|
# Auto-compose runner URLs if not provided, to match ci:vm-build behavior
|
|
# You must run a runner server in another terminal first:
|
|
# mise run run:runner-serve-multi (serves on 8090/8091 by default)
|
|
# or: mise run run:runner-serve (serves on 8089 by default)
|
|
if [[ -z "${SOLSTICE_RUNNER_URLS:-}" && -z "${SOLSTICE_RUNNER_URL:-}" ]]; then
|
|
# Multi-OS defaults
|
|
SOL_RUNNER_PORT_LINUX=${SOL_RUNNER_PORT_LINUX:-8090}
|
|
SOL_RUNNER_PORT_ILLUMOS=${SOL_RUNNER_PORT_ILLUMOS:-8091}
|
|
LINUX_URL="http://$HOST_IP:$SOL_RUNNER_PORT_LINUX/solstice-runner-linux"
|
|
ILLUMOS_URL="http://$HOST_IP:$SOL_RUNNER_PORT_ILLUMOS/solstice-runner-illumos"
|
|
export SOLSTICE_RUNNER_URLS="$LINUX_URL $ILLUMOS_URL"
|
|
# Also set single-runner URL fallback if someone uses run:runner-serve
|
|
SOL_RUNNER_PORT=${SOL_RUNNER_PORT:-8089}
|
|
export SOLSTICE_RUNNER_URL=${SOLSTICE_RUNNER_URL:-"http://$HOST_IP:$SOL_RUNNER_PORT/solstice-runner"}
|
|
echo "Using default runner URLs:" >&2
|
|
echo " SOLSTICE_RUNNER_URLS=$SOLSTICE_RUNNER_URLS" >&2
|
|
echo " SOLSTICE_RUNNER_URL=$SOLSTICE_RUNNER_URL" >&2
|
|
echo "Override by exporting SOLSTICE_RUNNER_URLS or SOLSTICE_RUNNER_URL before running this task." >&2
|
|
fi
|
|
|
|
# For Linux + libvirt users, customize via LIBVIRT_URI and LIBVIRT_NETWORK
|
|
exec cargo run -p orchestrator --features libvirt -- \
|
|
--config "$ORCH_CONFIG" \
|
|
--grpc-addr "$GRPC_ADDR" |