feat: split update config into update.env
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@ __pycache__/
|
|||||||
*.py[cod]
|
*.py[cod]
|
||||||
*$py.class
|
*$py.class
|
||||||
.venv/
|
.venv/
|
||||||
|
upload.token
|
||||||
venv/
|
venv/
|
||||||
ENV/
|
ENV/
|
||||||
.env
|
.env
|
||||||
|
|||||||
@ -71,6 +71,8 @@ By: Codex (GPT-5)
|
|||||||
| 15.01.2026 | 🏗️ Planning | ID: US_000046/TASK_000055 Update-Service Erreichbarkeit anzeigen. By: Codex (GPT-5) |
|
| 15.01.2026 | 🏗️ Planning | ID: US_000046/TASK_000055 Update-Service Erreichbarkeit anzeigen. By: Codex (GPT-5) |
|
||||||
| 15.01.2026 | ⚙️ Code | ID: US_000046 Update-Service Statusanzeige implementiert. By: Codex (GPT-5) |
|
| 15.01.2026 | ⚙️ Code | ID: US_000046 Update-Service Statusanzeige implementiert. By: Codex (GPT-5) |
|
||||||
| 15.01.2026 | ⚙️ Code | ID: Update-Service Status zeigt Dev/Prod und nutzt konsistente Panel-Styles. By: Codex (GPT-5) |
|
| 15.01.2026 | ⚙️ Code | ID: Update-Service Status zeigt Dev/Prod und nutzt konsistente Panel-Styles. By: Codex (GPT-5) |
|
||||||
|
| 15.01.2026 | 🏗️ Planning | ID: US_000047/TASK_000056 Update-ENV getrennt. By: Codex (GPT-5) |
|
||||||
|
| 15.01.2026 | ⚙️ Code | ID: Update-Config in env.update.example ausgelagert. By: Codex (GPT-5) |
|
||||||
| 15.01.2026 | ⚙️ Code | ID: Makefile restart-Target hinzugefuegt. By: Codex (GPT-5) |
|
| 15.01.2026 | ⚙️ Code | ID: Makefile restart-Target hinzugefuegt. By: Codex (GPT-5) |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@ -64,6 +64,7 @@ Derzeit keine offiziellen Badges, da im Repository keine CI, Coverage, Release o
|
|||||||
## Hinweise
|
## Hinweise
|
||||||
- Abweichung von der Zielstruktur: Die OpenAPI-Spezifikation des Update-Services bleibt unter `docs/architecture/openapi.yaml` und `docs/architecture/openapi/` erhalten.
|
- Abweichung von der Zielstruktur: Die OpenAPI-Spezifikation des Update-Services bleibt unter `docs/architecture/openapi.yaml` und `docs/architecture/openapi/` erhalten.
|
||||||
- Altdokumente liegen unter `docs/_archive/` und sind nicht geloescht.
|
- Altdokumente liegen unter `docs/_archive/` und sind nicht geloescht.
|
||||||
|
- Konfigurationsdateien: `/etc/skd/env` (Core) und `/etc/skd/update.env` (Update-Service).
|
||||||
|
|
||||||
## Legacy Script
|
## Legacy Script
|
||||||
Das Script `sk.sh` bleibt als CLI-Fallback. Details und Beispiele: `docs/USAGE.md`.
|
Das Script `sk.sh` bleibt als CLI-Fallback. Details und Beispiele: `docs/USAGE.md`.
|
||||||
|
|||||||
@ -4,7 +4,9 @@ By: Codex (GPT-5)
|
|||||||
# Konfiguration
|
# Konfiguration
|
||||||
|
|
||||||
## Speicherort
|
## Speicherort
|
||||||
Die Konfiguration erfolgt per ENV-Datei, standardmaessig `/etc/skd/env`. Vorlage: `env.example`.
|
Die Konfiguration erfolgt per ENV-Dateien:
|
||||||
|
- `/etc/skd/env` (Core-App, Vorlage: `env.example`)
|
||||||
|
- `/etc/skd/update.env` (Update-Service, Vorlage: `env.update.example`)
|
||||||
|
|
||||||
## Authentifizierung
|
## Authentifizierung
|
||||||
- `SKD_AUTH_MODE` (default `pam`): `pam` oder `oidc`. Ungueltige Werte fallen auf `pam` zurueck. Hinweis: Der Wert wird aktuell nicht zur Erzwingung genutzt; OIDC ist aktiv, sobald die OIDC-Variablen gesetzt sind.
|
- `SKD_AUTH_MODE` (default `pam`): `pam` oder `oidc`. Ungueltige Werte fallen auf `pam` zurueck. Hinweis: Der Wert wird aktuell nicht zur Erzwingung genutzt; OIDC ist aktiv, sobald die OIDC-Variablen gesetzt sind.
|
||||||
@ -77,6 +79,7 @@ Hinweis: OIDC ist aktiv, sobald Issuer, Client-ID und Secret gesetzt sind.
|
|||||||
|
|
||||||
## Hinweise
|
## Hinweise
|
||||||
- `scripts/install.sh` erstellt `/etc/skd/env` und setzt Default-Werte fuer PAM/Allowed-User.
|
- `scripts/install.sh` erstellt `/etc/skd/env` und setzt Default-Werte fuer PAM/Allowed-User.
|
||||||
|
- `scripts/install.sh` erstellt `/etc/skd/update.env` fuer Update-Service Variablen.
|
||||||
- Aenderungen in `/etc/skd/env` erfordern einen Service-Restart (`sudo systemctl restart skd.service`).
|
- Aenderungen in `/etc/skd/env` erfordern einen Service-Restart (`sudo systemctl restart skd.service`).
|
||||||
|
|
||||||
## Weitere Dokumente
|
## Weitere Dokumente
|
||||||
|
|||||||
@ -9,6 +9,7 @@ By: Codex (GPT-5)
|
|||||||
- kopiert das Projekt nach `/opt/sk`
|
- kopiert das Projekt nach `/opt/sk`
|
||||||
- erstellt/aktualisiert `.venv`
|
- erstellt/aktualisiert `.venv`
|
||||||
- erstellt `/etc/skd/env` aus `env.example`
|
- erstellt `/etc/skd/env` aus `env.example`
|
||||||
|
- erstellt `/etc/skd/update.env` aus `env.update.example`
|
||||||
- schreibt eine systemd-Unit nach `/etc/systemd/system/skd.service`
|
- schreibt eine systemd-Unit nach `/etc/systemd/system/skd.service`
|
||||||
|
|
||||||
Beispiel:
|
Beispiel:
|
||||||
|
|||||||
@ -21,14 +21,5 @@ SKD_OIDC_STATE_COOKIE_NAME=skd_oidc_state
|
|||||||
SKD_DEFAULT_COUNTDOWN=60
|
SKD_DEFAULT_COUNTDOWN=60
|
||||||
SKD_DEFAULT_SOUND=false
|
SKD_DEFAULT_SOUND=false
|
||||||
SKD_NOTIFY_TIMEOUT=5
|
SKD_NOTIFY_TIMEOUT=5
|
||||||
# Update client configuration
|
|
||||||
SKD_UPDATE_SERVICE_URL=https://update.wlkns.org
|
|
||||||
SKD_UPDATE_PROJECT_ID=safe-kiddo-control
|
|
||||||
SKD_UPDATE_ENROLL_TOKEN=
|
|
||||||
SKD_UPDATE_TOKEN=
|
|
||||||
SKD_UPDATE_TOKEN_FILE=/var/lib/skd/update_token
|
|
||||||
SKD_UPDATE_INTERVAL=3600
|
|
||||||
SKD_UPDATE_STATUS_FILE=/var/lib/skd/update_status.json
|
|
||||||
SKD_UPDATE_LOG_FILE=/var/lib/skd/update_logs.jsonl
|
|
||||||
# Set to true to test without performing real system changes
|
# Set to true to test without performing real system changes
|
||||||
SKD_DRY_RUN=false
|
SKD_DRY_RUN=false
|
||||||
|
|||||||
9
env.update.example
Normal file
9
env.update.example
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Copy to /etc/skd/update.env for update-service configuration
|
||||||
|
SKD_UPDATE_SERVICE_URL=https://update.wlkns.org
|
||||||
|
SKD_UPDATE_PROJECT_ID=safe-kiddo-control
|
||||||
|
SKD_UPDATE_ENROLL_TOKEN=
|
||||||
|
SKD_UPDATE_TOKEN=
|
||||||
|
SKD_UPDATE_TOKEN_FILE=/var/lib/skd/update_token
|
||||||
|
SKD_UPDATE_INTERVAL=3600
|
||||||
|
SKD_UPDATE_STATUS_FILE=/var/lib/skd/update_status.json
|
||||||
|
SKD_UPDATE_LOG_FILE=/var/lib/skd/update_logs.jsonl
|
||||||
@ -111,6 +111,8 @@ Sicheres, remote steuerbares System zum Sperren/Entsperren lokaler Nutzerkonten.
|
|||||||
- [x] TASK_000049: Script fuer Enrollment-Flow erstellen
|
- [x] TASK_000049: Script fuer Enrollment-Flow erstellen
|
||||||
- [x] US_000046: Update-Service Erreichbarkeit anzeigen
|
- [x] US_000046: Update-Service Erreichbarkeit anzeigen
|
||||||
- [x] TASK_000055: Endpoint und UI fuer Update-Service Status
|
- [x] TASK_000055: Endpoint und UI fuer Update-Service Status
|
||||||
|
- [x] US_000047: Update-Config auslagern
|
||||||
|
- [x] TASK_000056: Update-ENV separieren
|
||||||
|
|
||||||
### EPIC_000009: Update Webservice (External Team)
|
### EPIC_000009: Update Webservice (External Team)
|
||||||
- [ ] US_000026: Client bezieht Updates (Pull)
|
- [ ] US_000026: Client bezieht Updates (Pull)
|
||||||
|
|||||||
16
project-management/requirements/stories/US_000047.md
Normal file
16
project-management/requirements/stories/US_000047.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
ID: US_000047 | Version: 0.2.1 | Status: Done
|
||||||
|
By: Codex (GPT-5)
|
||||||
|
|
||||||
|
# US_000047: Update-Config auslagern
|
||||||
|
|
||||||
|
Als Betreiber moechte ich die Update-Service Konfiguration in einer separaten ENV-Datei,
|
||||||
|
damit Core-App und Addon-Konfigurationen sauber getrennt sind.
|
||||||
|
|
||||||
|
## Akzeptanzkriterien
|
||||||
|
- Given die App laeuft
|
||||||
|
- When Update-Variablen gesetzt werden
|
||||||
|
- Then werden sie aus `/etc/skd/update.env` gelesen
|
||||||
|
- And bestehende Installationen bleiben kompatibel
|
||||||
|
|
||||||
|
## Task-Platzhalter
|
||||||
|
- TASK_000056: Update-ENV separieren und Installationsskript anpassen
|
||||||
20
project-management/requirements/tasks/TASK_000056.md
Normal file
20
project-management/requirements/tasks/TASK_000056.md
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
ID: TASK_000056 | Version: 0.2.1 | Status: Done
|
||||||
|
By: Codex (GPT-5)
|
||||||
|
|
||||||
|
# TASK_000056: Update-ENV separieren
|
||||||
|
|
||||||
|
## Outcome
|
||||||
|
Update-Variablen werden aus `/etc/skd/update.env` geladen, separate Vorlage vorhanden.
|
||||||
|
|
||||||
|
## Story-Bezug
|
||||||
|
US_000047
|
||||||
|
|
||||||
|
## Beschreibung
|
||||||
|
- `env.update.example` anlegen.
|
||||||
|
- `env.example` auf Core-Variablen reduzieren.
|
||||||
|
- systemd Unit mit zweiter EnvironmentFile.
|
||||||
|
- Installer erstellt beide Dateien.
|
||||||
|
- Doku und Script anpassen.
|
||||||
|
|
||||||
|
## Definition of Done (DoD)
|
||||||
|
- Update-Konfig getrennt, kompatibel und dokumentiert.
|
||||||
@ -2,6 +2,7 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
ENV_FILE="${ENV_FILE:-/etc/skd/env}"
|
ENV_FILE="${ENV_FILE:-/etc/skd/env}"
|
||||||
|
UPDATE_ENV_FILE="${UPDATE_ENV_FILE:-/etc/skd/update.env}"
|
||||||
SERVICE_URL="${SKD_UPDATE_SERVICE_URL:-}"
|
SERVICE_URL="${SKD_UPDATE_SERVICE_URL:-}"
|
||||||
PROJECT_ID="${SKD_UPDATE_PROJECT_ID:-}"
|
PROJECT_ID="${SKD_UPDATE_PROJECT_ID:-}"
|
||||||
TOKEN_FILE="${SKD_UPDATE_TOKEN_FILE:-}"
|
TOKEN_FILE="${SKD_UPDATE_TOKEN_FILE:-}"
|
||||||
@ -20,7 +21,8 @@ Options:
|
|||||||
--client-id ID Client ID (default: hostname)
|
--client-id ID Client ID (default: hostname)
|
||||||
--software-id ID Software ID (default: safe-kiddo)
|
--software-id ID Software ID (default: safe-kiddo)
|
||||||
--output PATH Write token to PATH (default: SKD_UPDATE_TOKEN_FILE if set)
|
--output PATH Write token to PATH (default: SKD_UPDATE_TOKEN_FILE if set)
|
||||||
--env-file PATH Read env file (default: /etc/skd/env)
|
--env-file PATH Read core env file (default: /etc/skd/env)
|
||||||
|
--update-env PATH Read update env file (default: /etc/skd/update.env)
|
||||||
-h, --help Show this help
|
-h, --help Show this help
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@ -34,6 +36,7 @@ while [[ $# -gt 0 ]]; do
|
|||||||
--enroll-token) ENROLL_TOKEN="$2"; shift 2 ;;
|
--enroll-token) ENROLL_TOKEN="$2"; shift 2 ;;
|
||||||
--output) OUTPUT_PATH="$2"; shift 2 ;;
|
--output) OUTPUT_PATH="$2"; shift 2 ;;
|
||||||
--env-file) ENV_FILE="$2"; shift 2 ;;
|
--env-file) ENV_FILE="$2"; shift 2 ;;
|
||||||
|
--update-env) UPDATE_ENV_FILE="$2"; shift 2 ;;
|
||||||
-h|--help) usage; exit 0 ;;
|
-h|--help) usage; exit 0 ;;
|
||||||
*) echo "Unknown option: $1" >&2; usage; exit 1 ;;
|
*) echo "Unknown option: $1" >&2; usage; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
@ -41,16 +44,16 @@ done
|
|||||||
|
|
||||||
read_env_value() {
|
read_env_value() {
|
||||||
local key="$1"
|
local key="$1"
|
||||||
python3 - <<'PY' "${ENV_FILE}" "${key}"
|
python3 - <<'PY' "${ENV_FILE}" "${UPDATE_ENV_FILE}" "${key}"
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
path = Path(sys.argv[1])
|
env_paths = [Path(sys.argv[1]), Path(sys.argv[2])]
|
||||||
key = sys.argv[2]
|
key = sys.argv[3]
|
||||||
if not path.exists():
|
for path in env_paths:
|
||||||
sys.exit(0)
|
if not path.exists():
|
||||||
|
continue
|
||||||
for raw in path.read_text(encoding="utf-8").splitlines():
|
for raw in path.read_text(encoding="utf-8").splitlines():
|
||||||
line = raw.strip()
|
line = raw.strip()
|
||||||
if not line or line.startswith("#"):
|
if not line or line.startswith("#"):
|
||||||
continue
|
continue
|
||||||
|
|||||||
@ -10,6 +10,7 @@ SERVICE_GROUP="${SERVICE_GROUP:-$SERVICE_USER}"
|
|||||||
INSTALL_DIR="${INSTALL_DIR:-/opt/sk}"
|
INSTALL_DIR="${INSTALL_DIR:-/opt/sk}"
|
||||||
ENV_DIR="/etc/${SERVICE_NAME}"
|
ENV_DIR="/etc/${SERVICE_NAME}"
|
||||||
ENV_FILE="${ENV_DIR}/env"
|
ENV_FILE="${ENV_DIR}/env"
|
||||||
|
UPDATE_ENV_FILE="${ENV_DIR}/update.env"
|
||||||
SYSTEMD_PATH="/etc/systemd/system/${SERVICE_NAME}.service"
|
SYSTEMD_PATH="/etc/systemd/system/${SERVICE_NAME}.service"
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
@ -56,6 +57,18 @@ if [[ ! -f "${ENV_FILE}" ]]; then
|
|||||||
sudo chown root:"${SERVICE_GROUP}" "${ENV_FILE}"
|
sudo chown root:"${SERVICE_GROUP}" "${ENV_FILE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f "${UPDATE_ENV_FILE}" ]]; then
|
||||||
|
if [[ -f "${SOURCE_DIR}/env.update.example" ]]; then
|
||||||
|
sudo cp "${SOURCE_DIR}/env.update.example" "${UPDATE_ENV_FILE}"
|
||||||
|
log "Copied env.update.example to ${UPDATE_ENV_FILE}; edit update service variables."
|
||||||
|
else
|
||||||
|
sudo touch "${UPDATE_ENV_FILE}"
|
||||||
|
log "Created empty ${UPDATE_ENV_FILE}; populate update variables."
|
||||||
|
fi
|
||||||
|
sudo chmod 640 "${UPDATE_ENV_FILE}"
|
||||||
|
sudo chown root:"${SERVICE_GROUP}" "${UPDATE_ENV_FILE}"
|
||||||
|
fi
|
||||||
|
|
||||||
is_debian_like() {
|
is_debian_like() {
|
||||||
if [[ ! -r /etc/os-release ]]; then
|
if [[ ! -r /etc/os-release ]]; then
|
||||||
return 1
|
return 1
|
||||||
@ -113,6 +126,7 @@ User=root
|
|||||||
Group=root
|
Group=root
|
||||||
WorkingDirectory=${INSTALL_DIR}
|
WorkingDirectory=${INSTALL_DIR}
|
||||||
EnvironmentFile=${ENV_FILE}
|
EnvironmentFile=${ENV_FILE}
|
||||||
|
EnvironmentFile=-${UPDATE_ENV_FILE}
|
||||||
ExecStart=${INSTALL_DIR}/.venv/bin/uvicorn backend.app:app --host 0.0.0.0 --port 80
|
ExecStart=${INSTALL_DIR}/.venv/bin/uvicorn backend.app:app --host 0.0.0.0 --port 80
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=3
|
RestartSec=3
|
||||||
|
|||||||
@ -8,6 +8,7 @@ User=root
|
|||||||
Group=root
|
Group=root
|
||||||
WorkingDirectory=/opt/sk
|
WorkingDirectory=/opt/sk
|
||||||
EnvironmentFile=/etc/skd/env
|
EnvironmentFile=/etc/skd/env
|
||||||
|
EnvironmentFile=-/etc/skd/update.env
|
||||||
ExecStart=/opt/sk/.venv/bin/uvicorn backend.app:app --host 0.0.0.0 --port 80
|
ExecStart=/opt/sk/.venv/bin/uvicorn backend.app:app --host 0.0.0.0 --port 80
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=3
|
RestartSec=3
|
||||||
|
|||||||
Reference in New Issue
Block a user