Nightscout-koppeling + CI/CD-fixes #2
@@ -0,0 +1,8 @@
|
|||||||
|
.env
|
||||||
|
.venv/
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
.git/
|
||||||
|
.pytest_cache/
|
||||||
|
.ruff_cache/
|
||||||
|
tests/
|
||||||
@@ -47,23 +47,23 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: docker build -t gitea.thuis.local/willem/glucose-dashboard:${{ gitea.sha }} .
|
run: docker build -t gitea.zb.local/willem/glucose-dashboard:${{ gitea.sha }} .
|
||||||
|
|
||||||
- name: Trivy scan
|
- name: Trivy scan
|
||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@master
|
||||||
with:
|
with:
|
||||||
image-ref: gitea.thuis.local/willem/glucose-dashboard:${{ gitea.sha }}
|
image-ref: gitea.zb.local/willem/glucose-dashboard:${{ gitea.sha }}
|
||||||
severity: CRITICAL,HIGH
|
severity: CRITICAL,HIGH
|
||||||
exit-code: "1" # laat de pipeline falen bij kritieke kwetsbaarheden
|
exit-code: "1" # laat de pipeline falen bij kritieke kwetsbaarheden
|
||||||
|
|
||||||
- name: Login bij Gitea-registry
|
- name: Login bij Gitea-registry
|
||||||
run: echo "${{ secrets.GLUCOSE_TOKEN }}" | docker login gitea.thuis.local -u willem --password-stdin
|
run: echo "${{ secrets.GLUCOSE_TOKEN }}" | docker login gitea.zb.local -u willem --password-stdin
|
||||||
|
|
||||||
- name: Tag en push
|
- name: Tag en push
|
||||||
run: |
|
run: |
|
||||||
docker tag gitea.thuis.local/willem/glucose-dashboard:${{ gitea.sha }} gitea.thuis.local/willem/glucose-dashboard:latest
|
docker tag gitea.zb.local/willem/glucose-dashboard:${{ gitea.sha }} gitea.zb.local/willem/glucose-dashboard:latest
|
||||||
docker push gitea.thuis.local/willem/glucose-dashboard:${{ gitea.sha }}
|
docker push gitea.zb.local/willem/glucose-dashboard:${{ gitea.sha }}
|
||||||
docker push gitea.thuis.local/willem/glucose-dashboard:latest
|
docker push gitea.zb.local/willem/glucose-dashboard:latest
|
||||||
|
|
||||||
# ---------------------------------------------------------------------
|
# ---------------------------------------------------------------------
|
||||||
# 4. Deploy — SSH naar de LXC en herstart met de nieuwe image
|
# 4. Deploy — SSH naar de LXC en herstart met de nieuwe image
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ __pycache__/
|
|||||||
.env
|
.env
|
||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
.ruff_cache/
|
.ruff_cache/
|
||||||
|
homelab-cicd-werkinstructie.md
|
||||||
@@ -10,14 +10,15 @@ koolhydraten en pomp-/sensorwissels overlay, plus time-in-range-cijfers.
|
|||||||
> Manage Tokens in Nightscout — geef het token minimaal `readable`-rechten)
|
> Manage Tokens in Nightscout — geef het token minimaal `readable`-rechten)
|
||||||
of het klassieke API secret.
|
of het klassieke API secret.
|
||||||
2. Kopieer `.env.example` naar `.env` en vul `NIGHTSCOUT_URL` en één van de
|
2. Kopieer `.env.example` naar `.env` en vul `NIGHTSCOUT_URL` en één van de
|
||||||
twee auth-opties in.
|
twee auth-opties in. `app.py` laadt `.env` zelf in (via `python-dotenv`),
|
||||||
|
dus dit werkt hetzelfde onder PowerShell, cmd of bash — je hoeft de
|
||||||
|
variabelen niet zelf in je shell te zetten.
|
||||||
3. Lokaal draaien:
|
3. Lokaal draaien:
|
||||||
|
|
||||||
```bash
|
```powershell
|
||||||
uv venv
|
uv venv
|
||||||
uv pip install -r requirements.txt
|
uv pip install -r requirements.txt --python .venv
|
||||||
set -a; source .env; set +a # of: laad de vars op je eigen manier
|
.venv\Scripts\streamlit run app.py
|
||||||
streamlit run app.py
|
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Met Docker Compose:
|
4. Met Docker Compose:
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
glucose-dashboard:
|
glucose-dashboard:
|
||||||
image: gitea.thuis.local/willem/glucose-dashboard:latest
|
image: gitea.zb.local/willem/glucose-dashboard:latest
|
||||||
container_name: glucose-dashboard
|
container_name: glucose-dashboard
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
Reference in New Issue
Block a user