🚧 WIP
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
# Starts the mqtt-ingester stack on local Docker.
|
||||
#
|
||||
# Loads .env if present (existing environment variables take precedence),
|
||||
# warns about missing certificates, then runs docker compose up with the
|
||||
# requested profiles.
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/start.sh [profiles...]
|
||||
# ./scripts/start.sh telemetry
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
StackRoot="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$StackRoot"
|
||||
|
||||
Profiles="${*:-}"
|
||||
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
echo "docker not found in PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Load .env if present; existing environment variables win.
|
||||
if [ -f .env ]; then
|
||||
while IFS='=' read -r name value; do
|
||||
# Skip comments and blank lines.
|
||||
case "$name" in ''|\#*) continue ;; esac
|
||||
if [ -z "${!name:-}" ]; then
|
||||
export "$name=$value"
|
||||
fi
|
||||
done < <(grep -v -e '^[[:space:]]*$' -e '^[[:space:]]*#' .env)
|
||||
fi
|
||||
|
||||
# Required certificates (see README).
|
||||
missing=()
|
||||
for cert in ca.crt client.crt client.key server.crt server.key; do
|
||||
[ -f "certs/$cert" ] || missing+=("$cert")
|
||||
done
|
||||
if [ ${#missing[@]} -gt 0 ]; then
|
||||
echo "WARNING: missing certificates in certs/: ${missing[*]}" >&2
|
||||
echo "WARNING: the API will fail to start. See README.md 'Certificates'." >&2
|
||||
fi
|
||||
|
||||
if [ -z "${MQTT_BROKER_HOST:-}" ]; then
|
||||
echo "WARNING: MQTT_BROKER_HOST is not set; mqtt-client will exit with an error." >&2
|
||||
fi
|
||||
|
||||
ComposeArgs=(compose up -d --build)
|
||||
if [ -n "$Profiles" ]; then
|
||||
ComposeArgs+=(--profile "$Profiles")
|
||||
fi
|
||||
|
||||
echo "Starting stack..."
|
||||
docker "${ComposeArgs[@]}"
|
||||
|
||||
echo
|
||||
echo "Services:"
|
||||
docker compose ps
|
||||
echo
|
||||
echo "Web UI: http://localhost:8080 (default login admin/admin)"
|
||||
echo "API: https://localhost:8443 (mTLS or session cookie)"
|
||||
echo "Logs: docker compose logs -f <service>"
|
||||
Reference in New Issue
Block a user