Deployment mit Drone #128
86
.drone.yml
86
.drone.yml
@ -1,46 +1,74 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build_webseite_main
|
||||
|
||||
workspace:
|
||||
path: /workspace
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: registry.wtf-eg.net/lektor
|
||||
|
||||
image_pull_secrets:
|
||||
- dockerconfig
|
||||
name: build
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: python:3.10-alpine
|
||||
commands:
|
||||
- apk add imagemagick
|
||||
- python3 -m pip install --user pipx
|
||||
- export PATH=/root/.local/bin:$PATH
|
||||
- pipx install lektor
|
||||
- lektor build
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build_webseite_pr
|
||||
|
||||
workspace:
|
||||
path: /workspace
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: registry.wtf-eg.net/lektor
|
||||
|
||||
image_pull_secrets:
|
||||
- dockerconfig
|
||||
name: deploy
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- pull_request
|
||||
event:
|
||||
- promote
|
||||
|
||||
steps:
|
||||
- name: deploy-live
|
||||
image: python:3.10-alpine
|
||||
environment:
|
||||
LEKTOR_DEPLOY_KEY:
|
||||
from_secret: drone_ssh_key
|
||||
commands:
|
||||
- apk add imagemagick
|
||||
- python3 -m pip install --user pipx
|
||||
- export PATH=/root/.local/bin:$PATH
|
||||
- pipx install lektor
|
||||
- lektor build
|
||||
- apk add rsync openssh
|
||||
- mkdir ~/.ssh
|
||||
- echo "www.wtf-eg.net ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICBp7eSOC07exvXuY4XhpZOuXax+zyzoymSVD4/+D/P6" >> ~/.ssh/known_hosts
|
||||
- lektor deploy live
|
||||
when:
|
||||
target:
|
||||
- www
|
||||
- name: deploy-dev
|
||||
image: python:3.10-alpine
|
||||
environment:
|
||||
LEKTOR_DEPLOY_KEY:
|
||||
from_secret: drone_ssh_key
|
||||
commands:
|
||||
- apk add imagemagick
|
||||
- python3 -m pip install --user pipx
|
||||
- export PATH=/root/.local/bin:$PATH
|
||||
- pipx install lektor
|
||||
- lektor build
|
||||
- apk add rsync openssh
|
||||
- mkdir ~/.ssh
|
||||
- echo "www.wtf-eg.net ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICBp7eSOC07exvXuY4XhpZOuXax+zyzoymSVD4/+D/P6" >> ~/.ssh/known_hosts
|
||||
- lektor deploy dev
|
||||
when:
|
||||
target:
|
||||
- spielwiese
|
||||
|
||||
---
|
||||
kind: signature
|
||||
hmac: a7c0aeda778717207ec641e7af90a358376eb3bfb22beeb67217b6d201e9e675
|
||||
hmac: 1d3d4b3f8845995c06e246c3874c98b5ae9ef2cb50ed3bf382942f52038eb784
|
||||
|
||||
...
|
||||
|
21
README.md
21
README.md
@ -62,3 +62,24 @@ export GIT_LFS_SKIP_SMUDGE=1
|
||||
git clone <git_repo>
|
||||
```
|
||||
*(Da das Rendern der Startseite die Bilder benötigt, willst du dann im lektor direkt auf eine andere Unterseite wechseln. Die Seite [http://localhost:5000/admin/](http://localhost:5000/admin/) sollte nützlich sein!)*
|
||||
|
||||
## Deployment
|
||||
|
||||
### Per Drone
|
||||
|
||||
Drone testet bereits automatisch den eingecheckten Code im `main`-Branch und für Pull Requests.
|
||||
Deployments finden nicht automatisch statt, sondern müssen angestoßen werden.
|
||||
|
||||
Wähle dazu den erfolgreichen Build, den du deployen möchtest unter https://drone.wtf-eg.de/ag_kommunikation/webseite aus.
|
||||
Rechts oben findest du dann einen Knopf zum Deployment (Wolke mit Pfeil).
|
||||
Als Environment kannst du _spielwiese_ oder _www_ verwenden.
|
||||
|
||||
### Per Hand
|
||||
Das Deployment sollte für maximale Reproduzierbarkeit und Nachvollziehbarkeit immer über Drone stattfinden.
|
||||
In Ausnahmesituationen kann jedoch ein manuelles Deployment nötig sein.
|
||||
|
||||
```bash
|
||||
lektor build
|
||||
lektor deploy dev # Deployment auf die Spielwiese
|
||||
lektor deploy live # Deployment auf die Live-Seite
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user