Deployment-Konventionen und Projektvorlagen
DEPLOY.md beschreibt, wie ein Container aussehen muss, damit er mit dem Runner und dem Nginx Proxy Manager zusammenspielt: fester Projektname, Image mit Versionstag, kein ports-Mapping, Healthcheck als Deploy-Gate, named volumes statt relativer Bind-Mounts. bootstrap.sh holt die Vorlagen per curl in ein neues Projekt und ersetzt __APP__ und __PORT__. Vorhandene Dateien bleiben unangetastet. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
61
bootstrap.sh
Executable file
61
bootstrap.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
# Holt die Deployment-Dateien in ein neues Projekt.
|
||||
#
|
||||
# sh bootstrap.sh <app-name> <port>
|
||||
#
|
||||
# Vorhandene Dateien werden nicht ueberschrieben, nur fehlende angelegt.
|
||||
# Bei privatem Repo: DEPLOY_KIT_TOKEN=<gitea-pat> vorher setzen.
|
||||
set -eu
|
||||
|
||||
BASE="${DEPLOY_KIT_BASE:-https://gitea.lucas-orth.de/lucas.orth/deploy-kit/raw/branch/main}"
|
||||
|
||||
APP="${1:-}"
|
||||
PORT="${2:-}"
|
||||
if [ -z "$APP" ] || [ -z "$PORT" ]; then
|
||||
echo "Aufruf: sh bootstrap.sh <app-name> <port>" >&2
|
||||
echo "Beispiel: sh bootstrap.sh busyfeed 8080" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fetch() {
|
||||
remote="$1"
|
||||
local_path="$2"
|
||||
if [ -e "$local_path" ]; then
|
||||
echo " uebersprungen, existiert: $local_path"
|
||||
return 0
|
||||
fi
|
||||
dir=$(dirname "$local_path")
|
||||
[ "$dir" = "." ] || mkdir -p "$dir"
|
||||
if [ -n "${DEPLOY_KIT_TOKEN:-}" ]; then
|
||||
curl -fsSL -H "Authorization: token $DEPLOY_KIT_TOKEN" "$BASE/$remote" -o "$local_path"
|
||||
else
|
||||
curl -fsSL "$BASE/$remote" -o "$local_path"
|
||||
fi
|
||||
echo " angelegt: $local_path"
|
||||
}
|
||||
|
||||
fetch DEPLOY.md DEPLOY.md
|
||||
fetch template/docker-compose.yml docker-compose.yml
|
||||
fetch template/.gitea/workflows/deploy.yml .gitea/workflows/deploy.yml
|
||||
fetch template/.dockerignore .dockerignore
|
||||
fetch template/Dockerfile Dockerfile
|
||||
|
||||
for f in docker-compose.yml Dockerfile; do
|
||||
[ -f "$f" ] && sed -i "s/__APP__/$APP/g; s/__PORT__/$PORT/g" "$f"
|
||||
done
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Fertig. Noch zu tun:
|
||||
|
||||
1. Dockerfile an den Stack anpassen (die Vorlage ist fuer Node).
|
||||
2. Build- und Test-Schritte in .gitea/workflows/deploy.yml einkommentieren.
|
||||
3. Healthcheck in docker-compose.yml auf den echten Endpoint zeigen lassen.
|
||||
4. Repo-Secret DOTENV in Gitea anlegen.
|
||||
5. Proxy Host im NPM: $APP.lucas-orth.de -> $APP:$PORT
|
||||
|
||||
Konventionen und Fallstricke: DEPLOY.md
|
||||
Damit Claude sie liest, in CLAUDE.md eine Zeile ergaenzen:
|
||||
Deployment-Konventionen stehen in DEPLOY.md. Vor Aenderungen an
|
||||
Dockerfile, docker-compose.yml oder Workflows dort nachsehen.
|
||||
EOF
|
||||
Reference in New Issue
Block a user