Add bootstrap-install.sh for VM-agnostic git-based deployment

This commit is contained in:
Hannes Ahlin
2026-08-22 15:02:38 +02:00
parent e7cdc4fffe
commit 6bea38ebb8
9 changed files with 275 additions and 75 deletions
+14 -8
View File
@@ -58,12 +58,20 @@ fi
code_ip="$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "${CODE_CONTAINER}" 2>/dev/null | head -1)"
if [ -n "${code_ip}" ] && [ "${code_ip}" != "${COLLABORA_IP}" ]; then
log "OBS: CODE IP är ${code_ip} (inte ${COLLABORA_IP}). Uppdatera COLLABORA_URL i .env om nödvändigt."
log "OBS: CODE IP är ${code_ip} (inte ${COLLABORA_IP}). Uppdaterar COLLABORA_URL i .env."
if grep -q '^COLLABORA_URL=' .env; then
sed -i "s|^COLLABORA_URL=.*|COLLABORA_URL=http://${code_ip}:9980|" .env
fi
fi
# extra_hosts: uppdatera NC_HOST_IP om vi kan detektera
if [ -f .env ] && grep -q '^NC_HOST_IP=' .env; then
host_ip="$(hostname -I 2>/dev/null | awk '{print $1}' || true)"
if [ -n "${host_ip}" ]; then
sed -i "s|^NC_HOST_IP=.*|NC_HOST_IP=${host_ip}|" .env
fi
fi
log "Bygger och startar sidecar (port 1881, nätverk bridge + collab_default)..."
if [ "${FORCE_REBUILD:-0}" = "1" ]; then
${COMPOSE} build --no-cache
@@ -84,26 +92,24 @@ done
log "Testar CODE capabilities från sidecar..."
collab_url="$(grep '^COLLABORA_URL=' .env | cut -d= -f2- || echo "http://${COLLABORA_IP}:9980")"
host_ip="$(grep '^NC_HOST_IP=' .env 2>/dev/null | cut -d= -f2- || hostname -I | awk '{print $1}')"
if docker exec nextcloud-collabora-nodered curl -sf "${collab_url}/hosting/capabilities" >/dev/null 2>&1; then
log "OK: CODE nås på ${collab_url}"
else
log "VARNING: Kunde inte nå ${collab_url}/hosting/capabilities från sidecar."
log " Kontrollera: docker network inspect bridge | grep -A2 code"
log " Kontrollera: docker network inspect bridge | grep -A2 ${CODE_CONTAINER}"
log " Alternativ: docker network connect bridge nextcloud-collabora-nodered"
fi
cat <<EOF
Nästa steg:
1. Öppna http://192.168.1.26:1881
1. Öppna http://${host_ip:-127.0.0.1}:1881
2. nc-collab-config: app-lösenord, collaboraUrl=${collab_url}
3. Kör acceptansflödet (capabilities → ncFileToPdf)
Git (Gitea): https://kode.hannesahlin.se/
git remote add origin https://kode.hannesahlin.se/<user>/nextcloud-collabora-nodered.git
git push -u origin main
Orört: nextcloud-node-red :1880 (odds_network), odds-scraper, Gitea-databaslösen.
Repo: https://kode.hannesahlin.se/n3wk/nextcloud-collabora-nodered
Orört: nextcloud-node-red :1880, odds-scraper, Gitea-databaslösen.
EOF
log "Klart."