Deploy Docs su Dominio Tuo (Self-Host)¶
Questa guida usa il workflow GitHub Actions:
.github/workflows/docs-selfhost.yml
1) Prerequisiti server¶
Sul server di destinazione:
- cartella destinazione, esempio:
/var/www/safeops-docs- utente SSH dedicato con permessi scrittura su quella cartella.
- Nginx/Proxy che serve la cartella sul dominio docs.
2) Secrets GitHub da configurare¶
Nel repository GitHub, aggiungi questi Secrets:
DOCS_DEPLOY_HOST: host o IP server docsDOCS_DEPLOY_PORT: porta SSH (es.22)DOCS_DEPLOY_USER: utente SSH deployDOCS_DEPLOY_PATH: path remote (es./var/www/safeops-docs)DOCS_DEPLOY_SSH_KEY: chiave privata SSH (formato OpenSSH)
3) Chiave SSH¶
Genera una chiave deploy dedicata:
ssh-keygen -t ed25519 -f ~/.ssh/safeops_docs_deploy -C "safeops-docs-deploy"
- aggiungi la pubblica in
~/.ssh/authorized_keysdell’utente deploy sul server - copia la privata in
DOCS_DEPLOY_SSH_KEY(GitHub Secret)
4) Esecuzione¶
- push su
main/masteroppureRun workflowmanuale - il job:
- builda
mkdocs - genera
docs/release_notes.md - sincronizza
site/viarsync --delete
5) Nginx esempio rapido¶
server {
listen 80;
server_name docs.tuodominio.it;
root /var/www/safeops-docs;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
Se usi firewall/reverse proxy esterno, mantieni solo il vhost statico locale.