Merge pull request '0.3.0 - installer allineato a IRIDE 0.100.93' (#1) from setup-0.3.0-allineamento-iride into main
This commit is contained in:
commit
c2e55763ce
|
|
@ -56,11 +56,18 @@ Poi apri `http://<IP>:8888`:
|
||||||
- *autofirmato* (RSA 4096, 10 anni, SAN con hostname, alias e IP: LAN e demo;
|
- *autofirmato* (RSA 4096, 10 anni, SAN con hostname, alias e IP: LAN e demo;
|
||||||
**non** per WhatsApp, che richiede un certificato valido).
|
**non** per WhatsApp, che richiede un certificato valido).
|
||||||
4. **Intelligenza artificiale** — provider del modello testuale: `fake` (demo, nessuna
|
4. **Intelligenza artificiale** — provider del modello testuale: `fake` (demo, nessuna
|
||||||
chiave), OpenAI o Anthropic con API key. Modificabile dal portale.
|
chiave) oppure OpenAI con API key (Anthropic e' stato rimosso da IRIDE 0.100.58).
|
||||||
|
Modificabile dal portale; ogni Azienda puo' avere il proprio abbonamento.
|
||||||
5. **Utente admin** — primo accesso al portale (password ≥ 12 caratteri, hash bcrypt).
|
5. **Utente admin** — primo accesso al portale (password ≥ 12 caratteri, hash bcrypt).
|
||||||
6. **Installa** — riepilogo e avvio; il log dell'installazione scorre nella pagina.
|
6. **Installa** — riepilogo e avvio; il log dell'installazione scorre nella pagina.
|
||||||
|
|
||||||
A fine wizard la porta 8888 viene chiusa e `/opt/iride-setup-pkg` rimosso.
|
A fine wizard la porta 8888 viene chiusa e `/opt/iride-setup-pkg` rimosso.
|
||||||
|
|
||||||
|
Dalla 0.3.0 l'installazione nasce allineata a IRIDE 0.100.93 e successive: chiave master in
|
||||||
|
`/etc/iride/master.key` con `credentials.json` sigillato (**conservarne subito una copia fuori
|
||||||
|
dal server**), sito nginx completato con le location del modello del prodotto (cache della
|
||||||
|
console, service worker), aggiornamento dalla console attivo (`iride-updater.path`) e
|
||||||
|
`iride-health` che controlla anche readiness, chiave master e aggiornamento dalla console.
|
||||||
Aggiornamenti successivi: `sudo bash /opt/iride/app/scripts/update.sh` (usa il token
|
Aggiornamenti successivi: `sudo bash /opt/iride/app/scripts/update.sh` (usa il token
|
||||||
della licenza, mai credenziali personali). Verifica rapida: `iride-health`.
|
della licenza, mai credenziali personali). Verifica rapida: `iride-health`.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ echo "IRIDE health check"
|
||||||
for svc in iride-api iride-worker iride-scheduler; do
|
for svc in iride-api iride-worker iride-scheduler; do
|
||||||
systemctl is-active --quiet "$svc" && pass "$svc attivo" || fail "$svc non attivo (journalctl -u $svc -n 50)"
|
systemctl is-active --quiet "$svc" && pass "$svc attivo" || fail "$svc non attivo (journalctl -u $svc -n 50)"
|
||||||
done
|
done
|
||||||
|
systemctl is-active --quiet iride-updater.path && pass "aggiornamento dalla console attivo" || fail "iride-updater.path non attivo"
|
||||||
|
[[ -f /etc/iride/master.key ]] && pass "chiave master presente" || fail "chiave master assente: /etc/iride/master.key"
|
||||||
systemctl is-active --quiet nginx && pass "nginx attivo" || fail "nginx non attivo"
|
systemctl is-active --quiet nginx && pass "nginx attivo" || fail "nginx non attivo"
|
||||||
nginx -t >/dev/null 2>&1 && pass "configurazione nginx valida" || fail "nginx -t fallito"
|
nginx -t >/dev/null 2>&1 && pass "configurazione nginx valida" || fail "nginx -t fallito"
|
||||||
|
|
||||||
|
|
@ -23,6 +25,12 @@ if [[ -n "${HEALTH:-}" ]]; then
|
||||||
else
|
else
|
||||||
fail "API non risponde su http://127.0.0.1:8080/api/health"
|
fail "API non risponde su http://127.0.0.1:8080/api/health"
|
||||||
fi
|
fi
|
||||||
|
READY="$(curl -fsS http://127.0.0.1:8080/api/health/ready 2>/dev/null)"
|
||||||
|
if [[ -n "$READY" ]] && echo "$READY" | python3 -c 'import json,sys; sys.exit(0 if json.load(sys.stdin).get("ready") else 1)'; then
|
||||||
|
pass "readiness: pronta"
|
||||||
|
else
|
||||||
|
fail "readiness: non pronta ($(echo "$READY" | python3 -c 'import json,sys; d=json.load(sys.stdin); print(d.get("failed"))' 2>/dev/null))"
|
||||||
|
fi
|
||||||
|
|
||||||
[[ -f /opt/iride/data/iride.db ]] && pass "database presente" || fail "database assente in /opt/iride/data"
|
[[ -f /opt/iride/data/iride.db ]] && pass "database presente" || fail "database assente in /opt/iride/data"
|
||||||
PERM="$(stat -c '%a %U' /opt/iride/config/iride.json 2>/dev/null)"
|
PERM="$(stat -c '%a %U' /opt/iride/config/iride.json 2>/dev/null)"
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ html,body{height:100%;background:var(--bg);color:var(--text);font-family:var(--s
|
||||||
<div class="panel-title">🧠 Intelligenza artificiale</div>
|
<div class="panel-title">🧠 Intelligenza artificiale</div>
|
||||||
<div class="panel-sub">Provider del modello testuale. "Fake" è deterministico e senza costi: va bene per demo e collaudo; la chiave si può inserire o cambiare dopo dal portale.</div>
|
<div class="panel-sub">Provider del modello testuale. "Fake" è deterministico e senza costi: va bene per demo e collaudo; la chiave si può inserire o cambiare dopo dal portale.</div>
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
<div><label class="form-label">Provider</label><select class="form-select" id="ai_provider" onchange="onProviderChange()"><option value="fake">Fake (demo, nessuna chiave)</option><option value="openai">OpenAI</option><option value="anthropic">Anthropic (disponibile nella slice 2)</option></select></div>
|
<div><label class="form-label">Provider</label><select class="form-select" id="ai_provider" onchange="onProviderChange()"><option value="fake">Fake (demo, nessuna chiave)</option><option value="openai">OpenAI</option></select></div>
|
||||||
<div><label class="form-label">Modello</label><input class="form-input mono-input" id="ai_model" placeholder="gpt-4.1-mini" value="gpt-4.1-mini"></div>
|
<div><label class="form-label">Modello</label><input class="form-input mono-input" id="ai_model" placeholder="gpt-4.1-mini" value="gpt-4.1-mini"></div>
|
||||||
<div class="form-full" id="ai-key-block" style="display:none"><label class="form-label">API key</label><input class="form-input mono-input" type="password" id="ai_api_key" placeholder="sk-..."><div class="form-hint">Salvata in /opt/iride/config/iride.json (0600). Prima di dati reali: DPA e regione di elaborazione verificati (B-063).</div></div>
|
<div class="form-full" id="ai-key-block" style="display:none"><label class="form-label">API key</label><input class="form-input mono-input" type="password" id="ai_api_key" placeholder="sk-..."><div class="form-hint">Salvata in /opt/iride/config/iride.json (0600). Prima di dati reali: DPA e regione di elaborazione verificati (B-063).</div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -366,8 +366,7 @@ function onProviderChange() {
|
||||||
const p = g('ai_provider');
|
const p = g('ai_provider');
|
||||||
document.getElementById('ai-key-block').style.display = p === 'fake' ? 'none' : 'block';
|
document.getElementById('ai-key-block').style.display = p === 'fake' ? 'none' : 'block';
|
||||||
const m = document.getElementById('ai_model');
|
const m = document.getElementById('ai_model');
|
||||||
if (p === 'openai' && (!m.value || m.value.startsWith('claude'))) m.value = 'gpt-4.1-mini';
|
if (p === 'openai' && (!m.value || m.value.startsWith('claude') || m.value === '')) m.value = 'gpt-4.1-mini';
|
||||||
if (p === 'anthropic' && (!m.value || m.value.startsWith('gpt'))) m.value = 'claude-sonnet-4-6';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function uploadSsl(input, type) {
|
async function uploadSsl(input, type) {
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ _LICENSE_PUBLIC_KEY_B64 = "GMRsZMoxOlCBiJU66EsQcj0ZO0gVd0GHB5LelEo/hns="
|
||||||
|
|
||||||
# ── Clone: username Basic Auth del bot Gitea al quale appartiene il token.
|
# ── Clone: username Basic Auth del bot Gitea al quale appartiene il token.
|
||||||
# Le licenze IRIDE lo portano nel payload (gitea_user); fallback al bot ARGOS.
|
# Le licenze IRIDE lo portano nel payload (gitea_user); fallback al bot ARGOS.
|
||||||
GITEA_BOT_USER = "argos-portal-bot"
|
GITEA_BOT_USER = "iride-portal-bot"
|
||||||
GITEA_REPO_PATH = "/tecnotel/iride.git"
|
GITEA_REPO_PATH = "/tecnotel/iride.git"
|
||||||
|
|
||||||
# ── Heartbeat verso il portale vendor (stessa chiave di registrazione ARGOS) ──
|
# ── Heartbeat verso il portale vendor (stessa chiave di registrazione ARGOS) ──
|
||||||
|
|
@ -164,7 +164,7 @@ def generate_iride_json(data):
|
||||||
hostname = data.get("domain", "").strip().lower()
|
hostname = data.get("domain", "").strip().lower()
|
||||||
aliases = [a.strip().lower() for a in data.get("aliases", "").split() if a.strip()]
|
aliases = [a.strip().lower() for a in data.get("aliases", "").split() if a.strip()]
|
||||||
provider = data.get("ai_provider", "fake") or "fake"
|
provider = data.get("ai_provider", "fake") or "fake"
|
||||||
if provider not in ("fake", "openai", "anthropic"):
|
if provider not in ("fake", "openai"): # Anthropic rimosso da IRIDE 0.100.58
|
||||||
provider = "fake"
|
provider = "fake"
|
||||||
api_key = data.get("ai_api_key", "").strip()
|
api_key = data.get("ai_api_key", "").strip()
|
||||||
cfg = {
|
cfg = {
|
||||||
|
|
@ -196,7 +196,6 @@ def generate_iride_json(data):
|
||||||
"realtime": {"provider": "openai", "options": {"model": ""}},
|
"realtime": {"provider": "openai", "options": {"model": ""}},
|
||||||
"providers": {
|
"providers": {
|
||||||
"openai": {"api_key": api_key if provider == "openai" else "", "base_url": "https://api.openai.com/v1"},
|
"openai": {"api_key": api_key if provider == "openai" else "", "base_url": "https://api.openai.com/v1"},
|
||||||
"anthropic": {"api_key": api_key if provider == "anthropic" else ""},
|
|
||||||
},
|
},
|
||||||
"limits": {"max_ai_turns": 20, "daily_budget_micros": 5000000},
|
"limits": {"max_ai_turns": 20, "daily_budget_micros": 5000000},
|
||||||
},
|
},
|
||||||
|
|
@ -417,10 +416,38 @@ extendedKeyUsage = serverAuth
|
||||||
run("nginx -t && systemctl restart nginx")
|
run("nginx -t && systemctl restart nginx")
|
||||||
log("Nginx configurato")
|
log("Nginx configurato")
|
||||||
|
|
||||||
|
# 10b. Segreti a riposo (IRIDE B-200): chiave master fuori da /opt/iride, poi
|
||||||
|
# credentials.json sigillato. Stessi permessi e stesso script di update.sh.
|
||||||
|
log("── Chiave master e sigillo dei segreti ──")
|
||||||
|
key_dir, key_file = Path("/etc/iride"), Path("/etc/iride/master.key")
|
||||||
|
if not key_file.exists():
|
||||||
|
key_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
run(f"chown root:{APP_USER} {key_dir} && chmod 750 {key_dir}")
|
||||||
|
run(f"umask 027 && head -c 32 /dev/urandom | base64 > {key_file}")
|
||||||
|
run(f"chown root:{APP_USER} {key_file} && chmod 640 {key_file}")
|
||||||
|
log(f"Chiave master creata in {key_file}: conservarne una copia fuori dal server")
|
||||||
|
res = run(f"sudo -u {APP_USER} env IRIDE_CONFIG_DIR={CONFIG_DIR} IRIDE_DATA_DIR={DATA_DIR} IRIDE_MASTER_KEY_FILE={key_file} "
|
||||||
|
f"{APP_DIR}/backend/venv/bin/python {APP_DIR}/scripts/seal_secrets.py --seal", check=False)
|
||||||
|
log("credentials.json sigillato con la chiave master" if res.returncode == 0 else
|
||||||
|
"ATTENZIONE: credentials.json NON sigillato: rilanciare scripts/update.sh dopo l'installazione")
|
||||||
|
|
||||||
|
# 10c. Sito nginx allineato al modello del prodotto: aggiunge le location che il
|
||||||
|
# sito generato qui non ha (cache della console, service worker, pagine pubbliche).
|
||||||
|
if (APP_DIR / "deploy/nginx/iride.conf").exists() and (APP_DIR / "scripts/nginx_sync.py").exists():
|
||||||
|
res = run(f"{APP_DIR}/backend/venv/bin/python {APP_DIR}/scripts/nginx_sync.py --site /etc/nginx/sites-available/iride "
|
||||||
|
f"--template {APP_DIR}/deploy/nginx/iride.conf --no-reload", check=False)
|
||||||
|
if res.returncode == 0 and run("nginx -t && systemctl reload nginx", check=False).returncode == 0:
|
||||||
|
log("Sito nginx allineato al modello di IRIDE")
|
||||||
|
else:
|
||||||
|
log("ATTENZIONE: sito nginx non allineato al modello: lo fara' il primo aggiornamento (update.sh)")
|
||||||
|
|
||||||
# 11. Servizi systemd (unit dal repo: update.sh le tiene allineate)
|
# 11. Servizi systemd (unit dal repo: update.sh le tiene allineate)
|
||||||
log("── Creazione e avvio servizi ──")
|
log("── Creazione e avvio servizi ──")
|
||||||
for svc in SERVICES:
|
for svc in SERVICES:
|
||||||
shutil.copy(APP_DIR / "deploy/systemd" / f"{svc}.service", f"/etc/systemd/system/{svc}.service")
|
shutil.copy(APP_DIR / "deploy/systemd" / f"{svc}.service", f"/etc/systemd/system/{svc}.service")
|
||||||
|
for unit in ("iride-updater.service", "iride-updater.path"):
|
||||||
|
if (APP_DIR / "deploy/systemd" / unit).exists():
|
||||||
|
shutil.copy(APP_DIR / "deploy/systemd" / unit, f"/etc/systemd/system/{unit}")
|
||||||
if (APP_DIR / "deploy/logrotate/iride").exists():
|
if (APP_DIR / "deploy/logrotate/iride").exists():
|
||||||
shutil.copy(APP_DIR / "deploy/logrotate/iride", "/etc/logrotate.d/iride")
|
shutil.copy(APP_DIR / "deploy/logrotate/iride", "/etc/logrotate.d/iride")
|
||||||
run("systemctl daemon-reload")
|
run("systemctl daemon-reload")
|
||||||
|
|
@ -428,6 +455,9 @@ extendedKeyUsage = serverAuth
|
||||||
chown(LOGS_DIR)
|
chown(LOGS_DIR)
|
||||||
for svc in SERVICES:
|
for svc in SERVICES:
|
||||||
run(f"systemctl enable --now {svc}")
|
run(f"systemctl enable --now {svc}")
|
||||||
|
if Path("/etc/systemd/system/iride-updater.path").exists():
|
||||||
|
run("systemctl enable --now iride-updater.path")
|
||||||
|
log("Aggiornamento dalla console attivo (iride-updater.path)")
|
||||||
log(f"{svc} avviato")
|
log(f"{svc} avviato")
|
||||||
|
|
||||||
# 12. Licenza in posizione finale
|
# 12. Licenza in posizione finale
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue