This commit is contained in:
master
2026-02-21 16:21:33 +02:00
parent 7e36c1f151
commit b911537870
116 changed files with 4365 additions and 5903 deletions

View File

@@ -123,16 +123,51 @@ check_prerequisites() {
fi
}
# ─── 2. Check hosts file ───────────────────────────────────────────────────
# ─── 2. Check and install hosts file ─────────────────────────────────────
check_hosts() {
step 'Checking hosts file for stella-ops.local entries'
local hosts_source="${ROOT}/devops/compose/hosts.stellaops.local"
if grep -q 'stella-ops\.local' /etc/hosts 2>/dev/null; then
ok 'stella-ops.local entries found in /etc/hosts'
else
warn 'stella-ops.local entries NOT found in /etc/hosts.'
return
fi
warn 'stella-ops.local entries NOT found in /etc/hosts.'
if [[ ! -f "$hosts_source" ]]; then
warn "Hosts source file not found at $hosts_source"
echo ' Add the hosts block from docs/dev/DEV_ENVIRONMENT_SETUP.md section 2'
echo ' to /etc/hosts (use sudo).'
return
fi
echo ''
echo ' Stella Ops needs ~50 hosts file entries for local development.'
echo " Source: devops/compose/hosts.stellaops.local"
echo ''
printf ' Add entries to /etc/hosts now? (Y/n) '
read -r answer
if [[ -z "$answer" || "$answer" =~ ^[Yy] ]]; then
if [[ "$(id -u)" -eq 0 ]]; then
printf '\n' >> /etc/hosts
cat "$hosts_source" >> /etc/hosts
ok 'Hosts entries added successfully'
else
echo ''
echo ' Adding hosts entries requires sudo...'
if sudo sh -c "printf '\n' >> /etc/hosts && cat '$hosts_source' >> /etc/hosts"; then
ok 'Hosts entries added successfully'
else
warn 'Failed to add hosts entries. Add them manually:'
echo " sudo sh -c 'cat $hosts_source >> /etc/hosts'"
fi
fi
else
warn 'Skipped. Add them manually before accessing the platform:'
echo " sudo sh -c 'cat $hosts_source >> /etc/hosts'"
fi
}
@@ -148,7 +183,7 @@ ensure_env() {
elif [[ -f "$env_example" ]]; then
cp "$env_example" "$env_file"
ok "Copied $env_example -> $env_file"
warn 'Review .env and change POSTGRES_PASSWORD at minimum.'
warn 'For production, change POSTGRES_PASSWORD in .env.'
else
fail "Neither .env nor env/stellaops.env.example found in $COMPOSE_DIR"
exit 1
@@ -235,6 +270,7 @@ start_platform() {
smoke_test() {
step 'Running smoke tests'
# Infrastructure checks
if docker exec stellaops-dev-postgres pg_isready -U stellaops &>/dev/null; then
ok 'PostgreSQL'
else
@@ -247,6 +283,49 @@ smoke_test() {
else
warn 'Valkey not responding'
fi
# Platform container health summary
step 'Container health summary'
cd "$COMPOSE_DIR"
local total=0
local healthy=0
local unhealthy_names=""
for cf in docker-compose.dev.yml docker-compose.stella-ops.yml; do
[[ ! -f "$cf" ]] && continue
while IFS= read -r line; do
[[ -z "$line" ]] && continue
local name; name=$(echo "$line" | python3 -c "import sys,json; print(json.load(sys.stdin).get('Name',''))" 2>/dev/null || true)
local h; h=$(echo "$line" | python3 -c "import sys,json; print(json.load(sys.stdin).get('Health',''))" 2>/dev/null || true)
total=$((total + 1))
if [[ -z "$h" || "$h" == "healthy" ]]; then
healthy=$((healthy + 1))
else
unhealthy_names="${unhealthy_names} Unhealthy: ${name}\n"
fi
done < <(docker compose -f "$cf" ps --format json 2>/dev/null)
done
if (( total > 0 )); then
if (( healthy == total )); then
ok "$healthy/$total containers healthy"
else
warn "$healthy/$total containers healthy"
[[ -n "$unhealthy_names" ]] && printf " \033[0;33m%b\033[0m" "$unhealthy_names"
fi
fi
# Platform endpoint check
if curl -sk --connect-timeout 5 -o /dev/null -w '' https://stella-ops.local 2>/dev/null; then
ok 'Platform accessible at https://stella-ops.local'
elif bash -c "echo >/dev/tcp/stella-ops.local/443" 2>/dev/null; then
ok 'Platform listening on https://stella-ops.local (TLS handshake pending)'
else
warn 'Platform not yet accessible at https://stella-ops.local (may still be starting)'
fi
cd "$ROOT"
}
# ─── Main ───────────────────────────────────────────────────────────────────