Archestack su Kubernetes, la via breve
La via più breve per arrivare su un cluster che gestisci già: Archestack sotto un percorso di un
hostname che il suo ingress serve già, per esempio https://apps.example.com/archestack/.
Cinque file manifest e una pipeline, niente Helm, e anche PostgreSQL gira nel cluster.
Vuoi hostname tutti suoi, un database gestito e più repliche dell'API? Hosting su AKS è la versione completa.
Cosa gira
https://apps.example.com
/archestack/api, /archestack/hubs -> archestack-api 1 pod, with disks for files and backups
/archestack/... -> archestack-web 2 pods: the builder and the published app
/archestack-grafana/ -> archestack-grafana optional, with Prometheus, Tempo and Loki
archestack-api -> archestack-postgres PostgreSQL 16 on a disk of its own
Il builder è su /archestack/, l'app pubblicata su /archestack/app/, e l'API
allo stesso indirizzo, quindi non c'è un secondo hostname da configurare.
Cosa ti serve
- Un cluster con ingress-nginx e un hostname che serve già in HTTPS.
- Un namespace
archestacke una storage class che fornisce dischi, come fa quella predefinita di AKS. - Azure DevOps, GitHub o GitLab. Un cluster privato ha bisogno di un runner all'interno della sua rete, perché i runner ospitati lo raggiungono da internet.
Configurarlo
- Estrai il kit nel tuo repository come
archestack/. -
Crea nel tuo sistema CI un ambiente
archestack-devche contenga queste cinque, le ultime tre come segreti:HOST apps.example.com ADMIN_EMAIL you@example.com POSTGRES_PASSWORD secret, set once and never changed ADMIN_PASSWORD secret, the first admin's password GRAFANA_PASSWORD secret, Grafana's user admin - Collega la pipeline, come dice la sezione del tuo sistema CI qui sotto.
-
Eseguila. Il primo avvio richiede qualche minuto, mentre l'API crea i suoi database. Poi accedi su
https://<HOST>/archestack/con l'email e la password dell'admin.
Azure DevOps
- Aggiungi
archestack/azure-pipelines.ymlcome pipeline. -
In Pipelines, Environments, crea
archestack-devcon il namespacearchestackdel cluster come risorsa Kubernetes. - In Pipelines, Library, crea un gruppo di variabili con lo stesso nome che contenga le cinque.
GitHub Actions
- Sposta
archestack/github-actions.ymlin.github/workflows/archestack.yml. -
In Settings, Environments, crea
archestack-dev:HOSTeADMIN_EMAILcome variabili, le password come segreti, più il segretoKUBECONFIG(vedi qui sotto).
GitLab CI
-
Includi il file del kit dal tuo
.gitlab-ci.yml:include: - local: archestack/gitlab-ci.yml -
In Settings, CI/CD, Variables, aggiungi le cinque limitate a
archestack-dev, con le password mascherate e tutte protette, piùKUBECONFIGdi tipo File (vedi qui sotto).
Accedere al cluster
Esegui bash archestack/kubeconfig.sh una volta, come qualcuno che può creare ruoli nel
namespace, e salva ciò che stampa come KUBECONFIG. È un service account che può entrare
nel namespace archestack e in nient'altro. Non usare mai il tuo kubeconfig: porta con sé
i tuoi diritti sull'intero cluster.
I file
archestack/
azure-pipelines.yml Azure DevOps: fills in the manifests, makes the secret, deploys
github-actions.yml GitHub Actions: move it to .github/workflows/archestack.yml
gitlab-ci.yml GitLab CI: include it from the repository's .gitlab-ci.yml
deploy.sh what GitHub Actions and GitLab CI run: the same three steps
images.sh pins both images to the digest of the tag you deploy
kubeconfig.sh their sign-in, allowed into the archestack namespace only
manifests/
postgres.yml PostgreSQL 16 with a 32 GB disk
api.yml the API, with disks for files (20 GB) and backups (50 GB)
web.yml the builder and the published app
ingress.yml /archestack on the hostname the cluster already serves
observability.yml optional: Grafana with Prometheus, Tempo and Loki ingress.yml è l'unico file che potrebbe dover cambiare per il tuo cluster. Lascialo senza
riscrittura (Archestack si aspetta il prefisso /archestack) e senza un proxy di accesso
davanti: Archestack fa accedere le persone da solo.
Aggiornare
Esegui di nuovo la pipeline. latest prende la release più recente, una versione come
1.4.37 dice esattamente cosa gira, ed è il modo per portare una versione dal test alla
produzione. In entrambi i casi la pipeline fissa le due immagini al loro digest, così ogni pod esegue
esattamente l'immagine che è stata rilasciata. L'API non è disponibile per il minuto che impiega a
riavviarsi; i tuoi dati restano sui suoi dischi. Ogni versione e i suoi digest sono in Release.
Da sapere
- La password del database si imposta una volta sola. PostgreSQL tiene quella con cui si è avviato la prima volta, quindi cambiarla dopo nel sistema CI lascia l'API fuori.
- La password dell'admin crea solo il primo admin. Dopo cambiala in Archestack.
- I backup restano nel cluster. Copiali anche da un'altra parte.
- Tornare a una versione più vecchia può fallire una volta che una più nuova ha migrato il database. Prova prima un aggiornamento su un ambiente di test.
Dove andare dopo
Il deploy dal repository porta le tue applicazioni da git a questi ambienti.