Adjustments to the Starting script to exclude any ngnix configuration

This commit is contained in:
2026-07-11 13:11:46 +02:00
parent 75e6b3f2f9
commit eb72131911
6 changed files with 1 additions and 581 deletions
+1 -16
View File
@@ -24,14 +24,8 @@ fi
docker compose build website
docker compose up -d
NGINX_SCRIPT="$SCRIPT_DIR/../nginx.sh"
if [[ -x "$NGINX_SCRIPT" ]]; then
echo "Aktualisiere Nginx Reverse Proxy..."
sudo "$NGINX_SCRIPT" apply || echo "Warnung: Nginx konnte nicht automatisch aktualisiert werden."
fi
# Wait for website to become healthy (simple HTTP check)
check_url="http://127.0.0.1:4999/"
check_url="http://localhost:4999"
timeout_seconds=60
interval=2
elapsed=0
@@ -55,14 +49,5 @@ if [ $elapsed -ge $timeout_seconds ]; then
echo "Bitte prüfe Container-Logs und nginx-Konfiguration."
fi
if [[ -x "$SCRIPT_DIR/sync_dev_hosts.sh" ]]; then
"$SCRIPT_DIR/sync_dev_hosts.sh" || true
if [[ "${DEV_HOSTS_REFRESH_INTERVAL}" != "0" ]]; then
nohup bash -lc "while true; do '$SCRIPT_DIR/sync_dev_hosts.sh' >/dev/null 2>&1 || true; sleep '$DEV_HOSTS_REFRESH_INTERVAL'; done" \
>"$SCRIPT_DIR/dev-hosts-sync.log" 2>&1 &
echo " Dev-Hosts-Sync läuft im Hintergrund (Log: $SCRIPT_DIR/dev-hosts-sync.log)"
fi
fi
echo "Development stack is running on http://localhost:4999"
echo "Provisioning creates self-signed certs per subdomain when needed."
-55
View File
@@ -1,55 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
HOSTS_FILE="/etc/hosts"
START_MARK="# >>> invario-dev-hosts >>>"
END_MARK="# <<< invario-dev-hosts <<<"
HOST_IP="${DEV_HOSTS_IP:-}"
if [[ -z "$HOST_IP" ]]; then
HOST_IP="$(hostname -I 2>/dev/null | awk '{print $1}')"
fi
if [[ -z "$HOST_IP" ]]; then
HOST_IP="127.0.0.1"
fi
if ! command -v docker >/dev/null 2>&1; then
echo "docker fehlt; Hosts-Sync übersprungen"
exit 0
fi
if ! docker compose ps mongodb >/dev/null 2>&1; then
echo "mongodb-compose-Service nicht erreichbar; Hosts-Sync übersprungen"
exit 0
fi
DOMAINS_RAW="$(docker compose exec -T mongodb mongosh --quiet --eval 'db.getSiblingDB("Invario_Website").school_instances.find({},{_id:0,domain:1}).toArray().forEach(d=>{ if(d.domain){ print(String(d.domain).trim()) } })' 2>/dev/null || true)"
TMP_BLOCK="$(mktemp)"
trap 'rm -f "$TMP_BLOCK"' EXIT
{
echo "$START_MARK"
echo "127.0.0.1 localhost"
while IFS= read -r line; do
domain="$(echo "$line" | tr -d '\r' | xargs)"
if [[ -n "$domain" ]]; then
echo "$HOST_IP $domain"
fi
done <<< "$DOMAINS_RAW"
echo "$END_MARK"
} > "$TMP_BLOCK"
if [[ "${EUID}" -eq 0 ]]; then
sed -i "/$START_MARK/,/$END_MARK/d" "$HOSTS_FILE"
cat "$TMP_BLOCK" >> "$HOSTS_FILE"
else
sudo sed -i "/$START_MARK/,/$END_MARK/d" "$HOSTS_FILE"
sudo tee -a "$HOSTS_FILE" < "$TMP_BLOCK" >/dev/null
fi
echo "Hosts-Sync abgeschlossen"