Some checks failed
Django Helm GitOps Deploy / build-and-deploy (push) Failing after 36s
82 lines
2.8 KiB
YAML
82 lines
2.8 KiB
YAML
name: Django Helm GitOps Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
container: catthehacker/ubuntu:act-latest
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
# DER INSTALLATIONS-/AKTIVIERUNGSSCHRITT IST ENTFERNT!
|
|
# Terraform steht durch das Runner-Volume sofort global bereit.
|
|
|
|
- name: Trust Local Nginx Certificate Inside Container
|
|
run: |
|
|
mkdir -p /usr/local/share/ca-certificates/
|
|
cp nginx_ssl/nginx.crt /usr/local/share/ca-certificates/nginx-sandbox.crt 2>/dev/null || echo "Nutze Workspace-Zertifikat"
|
|
update-ca-certificates
|
|
|
|
- name: Log in to Local Registry
|
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login localhost:3005 -u ${{ github.actor }} --password-stdin
|
|
|
|
- name: Build Django Image
|
|
run: |
|
|
# Wir nutzen wieder localhost für den unkomplizierten Push über den Socket!
|
|
docker build -t localhost:3005/${{ github.repository }}:${{ github.sha }} .
|
|
docker build -t localhost:3005/${{ github.repository }}:latest .
|
|
|
|
- name: Push Django Image
|
|
run: |
|
|
docker push localhost:3005/${{ github.repository }}:${{ github.sha }}
|
|
docker push localhost:3005/${{ github.repository }}:latest
|
|
|
|
- name: Prepare Kubernetes Access
|
|
run: |
|
|
echo "${{ secrets.KUBECONFIG_DATA }}" > ./kind_kubeconfig
|
|
chmod 600 ./kind_kubeconfig
|
|
|
|
- name: Terraform Deploy
|
|
run: |
|
|
# Führt direkt das installierte Zentral-Binary aus!
|
|
terraform --version
|
|
terraform init
|
|
terraform apply -auto-approve -var="app_version=${{ github.sha }}"
|
|
|
|
- name: Verify App Health
|
|
run: |
|
|
echo "Warte 15 Sekunden auf die Django-Zertifikate und Migrationen..."
|
|
sleep 15
|
|
|
|
# -L folgt der automatischen Sprachweiterleitung (/en/) fehlerfrei ins Ziel!
|
|
# Wir zielen auf die feste Gateway-IP 172.17.0.1 auf Port 8080 deines Host-Systems
|
|
curl --fail -L --connect-timeout 5 -H "Host: boday-it.ch" http://172.17.0 || exit 1
|
|
|
|
echo "Erfolg: Die Boday-IT Django-Webseite läuft perfekt via Helm im GitOps-Standard!"
|
|
|
|
- name: Publish Map to cloudmon Dashboard
|
|
run: |
|
|
terraform show -json > plan.json
|
|
|
|
# EXAKT SO EINSETZEN (Achte auf den Port 8080 und die Slashes!):
|
|
curl -X POST \
|
|
-H "Authorization: Bearer boday-cloudmon-super-token-2026" \
|
|
-H "Content-Type: application/json" \
|
|
--data-binary @plan.json \
|
|
"http://172.17.0{{ github.repository }}"
|
|
|
|
echo "Infrastruktur-Map erfolgreich an cloudmon übermittelt!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|