Compare commits

...

23 Commits

Author SHA1 Message Date
Sebastian Serfling 6a5b529fc8 change workflow staging
Deploy Staging / staging (push) Has been cancelled
2026-05-08 15:47:21 +02:00
Sebastian Serfling 184d8ca313 simplify: nutze ~/.ssh/deploy vom proxmox host
Deploy Staging / staging (push) Failing after 3m7s
2026-05-08 15:37:37 +02:00
Sebastian Serfling a429605f32 simplify: nutze ~/.ssh/deploy vom proxmox host
Deploy Staging / staging (push) Failing after 10s
2026-05-08 15:36:33 +02:00
Sebastian Serfling 0a4568fc83 simplify: nutze ~/.ssh/deploy vom proxmox host
Deploy Staging / staging (push) Failing after 12s
2026-05-08 15:12:54 +02:00
Sebastian Serfling 1f5abb9bc5 feat: setup jetzt via ssh-key nach pct create
Deploy Staging / staging (push) Failing after 48s
2026-05-08 15:09:29 +02:00
Sebastian Serfling 666ae202fb fix: ssh-public-keys als datei statt string
Deploy Staging / staging (push) Failing after 27s
2026-05-08 15:05:56 +02:00
Sebastian Serfling 4d155c907e debug: zeige pct create fehler
Deploy Staging / staging (push) Failing after 8s
2026-05-08 15:04:37 +02:00
Sebastian Serfling 46cd198b41 feat: ssh-public-keys direkt beim pct create
Deploy Staging / staging (push) Failing after 19s
2026-05-08 14:59:27 +02:00
Sebastian Serfling 91a96e6cd3 feat: ssh-public-keys direkt beim pct create
Deploy Staging / staging (push) Failing after 12s
2026-05-08 14:58:10 +02:00
Sebastian Serfling 63145188f8 feat: root password setup + ssh timeout fix
Deploy Staging / staging (push) Has been cancelled
2026-05-08 14:50:21 +02:00
Sebastian Serfling bda56f8563 feat: change Debain Version to 12
Deploy Staging / staging (push) Has been cancelled
2026-05-08 14:43:19 +02:00
Sebastian Serfling 0a4f1ba1e9 feat: pct destroy für sauberes Staging Redeploy
Deploy Staging / staging (push) Has been cancelled
2026-05-08 14:39:45 +02:00
Sebastian Serfling e53a6016cd feat: terraform import für alte VM - clean deploy
Deploy Staging / staging (push) Failing after 3s
2026-05-08 14:35:07 +02:00
Sebastian Serfling cc4ae05638 fix: direktes Löschen der alten VM via Proxmox API
Deploy Staging / staging (push) Failing after 12s
2026-05-08 14:33:21 +02:00
Sebastian Serfling 9d2f12a8ef fix: terraform refresh vor destroy + lifecycle rules
Deploy Staging / staging (push) Failing after 4s
2026-05-08 14:31:30 +02:00
Sebastian Serfling f58b75980b trigger: staging workflow test
Deploy Staging / staging (push) Failing after 3s
2026-05-08 14:29:44 +02:00
Sebastian Serfling 04e38a03c6 feat: Terraform Staging - destroy alte VM vor neuem Deploy
Deploy Staging / staging (push) Failing after 3s
2026-05-08 13:54:05 +02:00
sebastian.serfling 81d4126e0f terraform/variables.tf aktualisiert
Deploy Staging / staging (push) Failing after 4s
2026-05-07 17:58:00 +00:00
sebastian.serfling 64b17872a8 terraform/terraform.tfvars.example aktualisiert
Deploy Staging / staging (push) Failing after 6s
2026-05-07 17:57:01 +00:00
sebastian.serfling 3a5b252dca change lxc_storage
Deploy Staging / staging (push) Failing after 5s
2026-05-07 17:52:28 +00:00
Sebastian Serfling 623d03e559 test: trigger staging deployment workflow
Deploy Staging / staging (push) Failing after 3s
2026-05-07 15:00:25 +02:00
Sebastian Serfling faaa9ce511 resolve: merge conflicts in terraform/main.tf
Deploy Staging / staging (push) Failing after 2s
2026-05-07 14:58:56 +02:00
Sebastian Serfling 7c1b9a5e40 feat: Update workflows for Token-based Git clone 2026-05-07 14:56:37 +02:00
6 changed files with 113 additions and 63 deletions
+11 -14
View File
@@ -7,26 +7,23 @@ on:
jobs:
production:
runs-on: ubuntu-latest
runs-on: production
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: SSH Key einrichten
- name: Configure Git Token
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
echo "${{ secrets.PROD_HOST_KEY }}" >> ~/.ssh/known_hosts
git config --global url."https://sebastian.serfling:${{ secrets.GIT_TOKEN }}@gitlab.stines.de/".insteadOf "https://gitlab.stines.de/"
- name: Hugo Build
run: hugo --minify --source ./hugo
- name: Deploy auf Production
- name: Hugo Build & Deploy
run: |
rsync -az --delete \
-e "ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=no" \
./hugo/public/ \
root@${{ secrets.PROD_IP }}:/var/www/html/
set -e
# Hugo Build direkt in /var/www/html
hugo --minify --source ./hugo -d /var/www/html
echo "✅ Production Hugo Build erfolgreich!"
echo "🚀 Live unter https://stines.de"
+29 -16
View File
@@ -4,17 +4,23 @@ on:
push:
branches:
- main
- "dev*"
jobs:
staging:
runs-on: ubuntu-latest
runs-on: proxmox
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Terraform Init & Apply (Staging LXC)
- name: Delete alte Staging VM (CT 200)
run: |
pct destroy 200 --force || true
sleep 3
- name: Terraform Init & Apply (Staging LXC erstellen)
working-directory: terraform
run: |
terraform init
@@ -23,25 +29,32 @@ jobs:
-var="proxmox_token_id=${{ secrets.PROXMOX_TOKEN_ID }}" \
-var="proxmox_token_secret=${{ secrets.PROXMOX_TOKEN_SECRET }}" \
-var="proxmox_node=${{ secrets.PROXMOX_NODE }}" \
-var="lxc_bridge=vmbr2" \
-var="staging_ip=${{ secrets.STAGING_IP }}" \
-var="staging_gw=${{ secrets.STAGING_GW }}" \
-var="ssh_public_key=${{ secrets.DEPLOY_SSH_PUBKEY }}"
-var="root_password=${{ secrets.ROOT_PASSWORD }}"
env:
TF_IN_AUTOMATION: "true"
- name: SSH Key einrichten
- name: Hugo Clone & Build auf Staging-LXC
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
echo "${{ secrets.STAGING_HOST_KEY }}" >> ~/.ssh/known_hosts
ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=no root@${{ secrets.STAGING_IP }} bash << 'EOF'
set -e
cd /tmp
- name: Hugo Build
run: hugo --minify --source ./hugo
# Repository clonen mit Token (oder updaten falls existiert)
GIT_URL="https://sebastian.serfling:${{ secrets.GIT_TOKEN }}@gitlab.stines.de/sebastian.serfling/Webseite_Stines.git"
- name: Deploy auf Staging
run: |
rsync -az --delete \
-e "ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=no" \
./hugo/public/ \
root@${{ secrets.STAGING_IP_PLAIN }}:/var/www/html/
if [ -d "webseite" ]; then
cd webseite
git pull origin main
else
git clone "$GIT_URL" webseite
cd webseite
fi
# Hugo Build direkt in /var/www/html
hugo --minify --source ./hugo -d /var/www/html
echo "✅ Staging Hugo Build erfolgreich!"
EOF
+1
View File
@@ -0,0 +1 @@
Test Deploy
+33 -26
View File
@@ -14,49 +14,56 @@ provider "proxmox" {
pm_tls_insecure = true
}
resource "proxmox_lxc" "staging" {
target_node = var.proxmox_node
hostname = "hugo-staging"
ostemplate = var.lxc_ostemplate
unprivileged = true
start = true
onboot = false
cores = 1
memory = 512
swap = 512
rootfs {
storage = var.lxc_storage
size = "8G"
# Create staging LXC mit pct-Befehl
resource "null_resource" "staging_lxc" {
# SSH Public Key in Datei schreiben
provisioner "local-exec" {
command = "mkdir -p /tmp/terraform && echo '${var.ssh_public_key}' > /tmp/terraform/staging_key.pub"
}
network {
name = "eth0"
bridge = "vmbr2"
ip = var.staging_ip
gw = var.staging_gw != "" ? var.staging_gw : null
provisioner "local-exec" {
command = <<-EOT
pct create 200 \
${var.lxc_ostemplate} \
--hostname hugo-staging \
--cores ${var.lxc_cores} \
--memory ${var.lxc_memory} \
--swap ${var.lxc_swap} \
--rootfs ${var.lxc_rootfs} \
--net0 name=eth0,bridge=${var.lxc_bridge},ip=${var.staging_ip}/24,gw=${var.staging_gw} \
--unprivileged 1 \
--start 1 \
--password "${var.root_password}" \
--ssh-public-keys /tmp/terraform/staging_key.pub
EOT
}
ssh_public_keys = var.ssh_public_key
provisioner "local-exec" {
command = "sleep 30"
}
# Setup via SSH (nutzt ~/.ssh/deploy vom Proxmox Host)
provisioner "remote-exec" {
inline = [
"apt-get update -qq",
"apt-get install -y nginx",
"apt-get install -y hugo nginx git rsync curl",
"systemctl enable --now nginx",
"useradd -m -s /bin/bash deploy 2>/dev/null || true",
"mkdir -p /var/www/html",
"chown -R www-data:www-data /var/www/html"
"chown -R deploy:deploy /var/www/html",
"echo '✅ Staging VM Setup complete!'"
]
connection {
type = "ssh"
user = "root"
private_key = file("~/.ssh/deploy_key")
host = self.network[0].ip
private_key = file(pathexpand("~/.ssh/deploy_key"))
host = var.staging_ip
timeout = "5m"
}
}
}
output "staging_ip" {
value = proxmox_lxc.staging.network[0].ip
value = "${var.staging_ip}/24"
}
+1 -1
View File
@@ -2,7 +2,7 @@ proxmox_host = "https://192.168.1.10:8006/api2/json"
proxmox_token_id = "terraform@pve!deploy"
proxmox_token_secret = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
proxmox_node = "pve"
lxc_ostemplate = "local:vztmpl/debian-12-standard_12.7-1_amd64.tar.zst"
lxc_ostemplate = "local:vztmpl/debian-13-standard_13.1-2_amd64.tar.zst"
lxc_storage = "local-lvm"
staging_ip = "192.168.1.50/24"
staging_gw = "192.168.1.1"
+38 -6
View File
@@ -17,13 +17,17 @@ variable "proxmox_token_secret" {
variable "proxmox_node" {
description = "Ziel-Proxmox-Node"
type = string
default = "pve"
}
variable "lxc_bridge" {
description = "Netzwerk-Bridge (z.B. vmbr2)"
type = string
}
variable "lxc_ostemplate" {
description = "Pfad zum LXC-Template"
type = string
default = "local:vztmpl/debian-12-standard_12.7-1_amd64.tar.zst"
default = "local:vztmpl/debian-12-standard_12.12-1_amd64.tar.zst"
}
variable "lxc_storage" {
@@ -33,18 +37,46 @@ variable "lxc_storage" {
}
variable "staging_ip" {
description = "Statische IP fuer Staging-LXC (CIDR)"
description = "Statische IP fuer Staging-LXC (ohne CIDR)"
type = string
default = "dhcp"
default = "172.17.1.100"
}
variable "staging_gw" {
description = "Gateway fuer Staging-LXC"
type = string
default = ""
default = "172.17.1.1"
}
variable "ssh_public_key" {
description = "SSH Public Key fuer den deploy-User im LXC"
description = "SSH Public Key fuer deploy-User im LXC"
type = string
}
variable "ssh_private_key" {
description = "SSH Private Key (für Provisioning)"
type = string
sensitive = true
}
variable "root_password" {
description = "Root Password für Staging VM"
type = string
sensitive = true
}
variable "lxc_cores" {
default = 2
}
variable "lxc_memory" {
default = 1024
}
variable "lxc_swap" {
default = 512
}
variable "lxc_rootfs" {
default = "SSD:10"
}