Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
612b4f7250 | ||
|
|
7085909165 | ||
|
|
658d975ac9 | ||
|
|
c2add5e660 | ||
|
|
9122259f55 | ||
|
|
5cb8c6b67a |
No files matched your search
@@ -1,13 +0,0 @@
|
|||||||
# Beispiel für create-deploy-user.py – kopieren nach .env (wird nicht eingecheckt):
|
|
||||||
# cp .env.example .env && chmod 600 .env
|
|
||||||
# Laden und ausführen:
|
|
||||||
# set -a; source .env; set +a
|
|
||||||
# ./create-deploy-user.py --project-path owner/repo
|
|
||||||
# Das Skript liest nur die Umgebungsvariablen; fehlen sie, wird interaktiv gefragt.
|
|
||||||
|
|
||||||
# authentik-API-Token (authentik → Benutzer-Einstellungen → Tokens und App-Passwörter)
|
|
||||||
AUTHENTIK_TOKEN=
|
|
||||||
|
|
||||||
# Gitea-Access-Token mit Scope write:repository
|
|
||||||
# (https://git.share-fix.de/user/settings/applications)
|
|
||||||
GITEA_TOKEN=
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
name: lint
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
shell:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: bash -n
|
|
||||||
run: for f in *.sh; do bash -n "$f"; done
|
|
||||||
- name: shellcheck
|
|
||||||
run: |
|
|
||||||
sudo apt-get update -qq && sudo apt-get install -y -qq shellcheck
|
|
||||||
shellcheck --severity=warning *.sh
|
|
||||||
|
|
||||||
python:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: "3.12"
|
|
||||||
- name: Syntax-Check
|
|
||||||
run: python -m py_compile create-deploy-user.py
|
|
||||||
- name: ruff
|
|
||||||
run: pip install -q ruff && ruff check create-deploy-user.py
|
|
||||||
@@ -2,4 +2,3 @@ __pycache__/
|
|||||||
*.pyc
|
*.pyc
|
||||||
.claude/
|
.claude/
|
||||||
.codegraph/
|
.codegraph/
|
||||||
.env
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
# Beispiel: .gitea/workflows/deploy.yml im Repo eines Dienstes
|
|
||||||
#
|
|
||||||
# Voraussetzungen (Setup mit create-deploy-user.py --project-path owner/repo):
|
|
||||||
# Variable deploy_user – Deploy-User (wird vom Skript gesetzt)
|
|
||||||
# Secret deploy_pass – Passwort/App-Token des Users (wird vom Skript gesetzt)
|
|
||||||
# Variable deploy_host – Hostname/IP des Zielservers (manuell setzen)
|
|
||||||
#
|
|
||||||
# Das Repo enthält docker-compose.yml (und optional docker-compose.override.yml)
|
|
||||||
# im Wurzelverzeichnis; sie landen in ~/deployment auf dem Server.
|
|
||||||
name: deploy
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
# Nie zwei Deploys gleichzeitig für denselben Dienst
|
|
||||||
concurrency:
|
|
||||||
group: deploy-${{ gitea.repository }}
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
env:
|
|
||||||
DEPLOY_USER: ${{ vars.deploy_user }}
|
|
||||||
DEPLOY_HOST: ${{ vars.deploy_host }}
|
|
||||||
SSHPASS: ${{ secrets.deploy_pass }}
|
|
||||||
SSH_OPTS: -o StrictHostKeyChecking=accept-new -o PubkeyAuthentication=no
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Compose-Datei validieren
|
|
||||||
run: docker compose -f docker-compose.yml config --quiet
|
|
||||||
|
|
||||||
- name: Tools installieren
|
|
||||||
run: sudo apt-get update -qq && sudo apt-get install -y -qq sshpass rsync
|
|
||||||
|
|
||||||
- name: Dateien nach ~/deployment synchronisieren
|
|
||||||
run: |
|
|
||||||
sshpass -e rsync -az --delete \
|
|
||||||
--exclude '.git' --exclude '.gitea' --exclude '.env' \
|
|
||||||
-e "ssh $SSH_OPTS" \
|
|
||||||
./ "$DEPLOY_USER@$DEPLOY_HOST:deployment/"
|
|
||||||
|
|
||||||
- name: Deploy (pull → build → up)
|
|
||||||
run: |
|
|
||||||
sshpass -e ssh $SSH_OPTS "$DEPLOY_USER@$DEPLOY_HOST" \
|
|
||||||
"sudo /usr/local/bin/docker-deploy.sh $DEPLOY_USER deploy"
|
|
||||||
|
|
||||||
- name: Logs bei Fehler
|
|
||||||
if: failure()
|
|
||||||
run: |
|
|
||||||
sshpass -e ssh $SSH_OPTS "$DEPLOY_USER@$DEPLOY_HOST" \
|
|
||||||
"sudo /usr/local/bin/docker-deploy.sh $DEPLOY_USER logs" || true
|
|
||||||
+1
-1
@@ -161,7 +161,7 @@ PasswordAuthentication yes
|
|||||||
AuthorizedKeysCommand /usr/bin/sss_ssh_authorizedkeys %u
|
AuthorizedKeysCommand /usr/bin/sss_ssh_authorizedkeys %u
|
||||||
AuthorizedKeysCommandUser nobody
|
AuthorizedKeysCommandUser nobody
|
||||||
EOF
|
EOF
|
||||||
sshd -t || die "sshd-Konfiguration ungültig - Drop-in $SSHD_DROPIN prüfen"
|
sshd -t || die "sshd-Konfiguration ungültig – Drop-in $SSHD_DROPIN prüfen"
|
||||||
|
|
||||||
# ── docker-deploy.sh ─────────────────────────────────────────────────────────
|
# ── docker-deploy.sh ─────────────────────────────────────────────────────────
|
||||||
log "🔧 $DEPLOY_CONF schreiben"
|
log "🔧 $DEPLOY_CONF schreiben"
|
||||||
|
|||||||
Reference in new issue
Block a user