Vorbereitungen fuer das Deployen in die Produktionsumgebung wurden getroffen. Unter anderen wurde eine zweites docker-compose.prod.yml File erstellt. Dieses sollte praktisch identisch mit docker-compose.yml sein. Aber das Haendling der Secrets erledigen. Lokal wird imer docker-compose.yml verwendet.

This commit is contained in:
huesser committed 2026-06-25 18:18:13 +02:00
1 parent 65a5f65511
commit d781745bd4
8 files changed
+96 -71

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
services:
logic-red:
build: ./logic
volumes:
- ./logic/node-red-data:/data
- ./shared_data:/data/results # Hier landen die JSON/SQLite Dateien
- ./logic/scripts:/data/scripts
environment:
- TZ=Europe/Zurich
- GROUPINFO_JSON_LNK_NAME=archivegroup_information.json
- GROUPINFO_JSON_LNK_NAME_WITH_PATH=/data/archivegroup_information.json
- NON_SPECIFIED_GROUPS=/data/non_specified_groups.csv
- BEGIN_NAME_GROUPINFO_JSON_FILE=size_by_ownergroup_and_number_of_copies_
- BEGIN_NAME_GROUPINFO_JSON_FILE_WITH_PATH=/data/size_by_ownergroup_and_number_of_copies_
- ERROR_LOGFILE=/data/logs/get_new_groupinfo_error.log
- JSON_CACHE=json_cache.json
- JSON_CACHE_WITH_PATH=/data/json_cache.json
- AD_SERVER=d.psi.ch
- AD_SEARCH_BASE=DC=d,DC=psi,DC=ch
- AD_USER=${AD_USER}
- AD_PASSWORD=${AD_PASSWORD}
- METABASE_API_KEY=${METABASE_API_KEY}
# Behalte size_by_ownergroup_and_number_of_copies_ Files juenger als CLEANUP_TIME Tage
- CLEANUP_TIME=20
# Ausfuehrungszeitpunkt fuer den Cleanup im Cron-Format (Minuten Stunden * * *)
- CLEANUP_CRON=0 7 * * *
# Pfad zum Cleanup-Skript
- CLEANUP_SCRIPT_PATH=/data/scripts/cleanup.sh
# Pfad zum Logfile des Cleanup-Skripts
- CLEANUP_LOGFILE_PATH=/data/logs/cleanup.log
# Ausfuehrungszeitpunkt fuer den Haupt-Workflow im Cron-Format
- MAIN_WORKFLOW_CRON=0 6 * * *
secrets:
- ad_user
- ad_password
- metabase_api_key
ports:
- "1880:1880"
# --- NEUER STREAMLIT CONTAINER ---
analytics-app:
build: ./analytics
ports:
- "8501:8501" # Standard-Port für Streamlit im Browser
volumes:
- ./analytics:/app # Mappt deinen Code, damit Änderungen live ohne Rebuild sichtbar sind
- ./shared_data:/data:ro # Bindet die JSON-Daten NUR LESEND unter /data ein
- ./analytics/config:/app/config # Mappt den config Ordner
- ./analytics/data:/app/data # Mappt den data Ordner
environment:
- TZ=Europe/Zurich
# Deklarieren, dass die Secrets von "außen" kommen
secrets:
ad_user:
external: true
ad_password:
external: true
metabase_api_key:
external: true
+3 -5
View File
@@ -39,9 +39,7 @@ services:
ports:
- "8501:8501" # Standard-Port für Streamlit im Browser
volumes:
- ./analytics:/app # Mappt deinen Code, damit Änderungen live ohne Rebuild sichtbar sind
- ./shared_data:/data:ro # Bindet die JSON-Daten NUR LESEND unter /data ein
- ./analytics/config:/app/config # Mappt den config Ordner
- ./analytics/data:/app/data # Mappt den data Ordner
- ./analytics:/app
- ./shared_data:/data:ro
environment:
- TZ=Europe/Zurich
- TZ=Europe/Zurich
-6
View File
@@ -1,6 +0,0 @@
# Wir nehmen einen einfachen, leichten Webserver
FROM nginx:alpine
# Kopiere alle Dateien aus dem lokalen frontend-Ordner
# in das Standard-Verzeichnis des Webservers
COPY . /usr/share/nginx/html
-58
View File
@@ -1,58 +0,0 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Archivkosten Abfrage</title>
<style>
body { font-family: sans-serif; margin: 40px; line-height: 1.6; background-color: #f4f4f9; }
.container { max-width: 600px; background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
h1 { color: #333; border-bottom: 2px solid #007bff; padding-bottom: 10px; }
.data-row { border-bottom: 1px solid #eee; padding: 10px 0; }
.label { font-weight: bold; color: #555; }
.error { color: red; font-style: italic; }
</style>
</head>
<body>
<div class="container">
<h1>Archivkosten Übersicht</h1>
<div id="content">
<p>Lade aktuelle Daten...</p>
</div>
</div>
<script>
// Pfad zur JSON-Datei, die von Node-RED im Shared Volume erstellt wird
// In der docker-compose Konfiguration ist dies unter /data/ erreichbar
const dataPath = './data/kosten_historie.json';
async function loadCosts() {
const contentDiv = document.getElementById('content');
try {
const response = await fetch(dataPath);
if (!response.ok) throw new Error('Datei nicht gefunden');
const data = await response.json();
// Falls die Daten ein Array sind (Historie), zeigen wir das letzte Element
const latest = Array.isArray(data) ? data[data.length - 1] : data;
contentDiv.innerHTML = `
<div class="data-row"><span class="label">Datum:</span> ${latest.datum || 'N/A'}</div>
<div class="data-row"><span class="label">Kunde:</span> ${latest.kunde || 'Unbekannt'}</div>
<div class="data-row"><span class="label">Volumen:</span> ${latest.volumen_gb || 0} GB</div>
<div class="data-row"><span class="label">Kosten:</span> CHF ${latest.kosten || 0}</div>
`;
} catch (error) {
contentDiv.innerHTML = `<p class="error">Noch keine aktuellen Daten verfügbar. (Warte auf tägliches Update von Node-RED)</p>`;
console.error('Fehler beim Laden:', error);
}
}
loadCosts();
</script>
</body>
</html>
+13
View File
@@ -31,3 +31,16 @@ USER node-red
# Node-RED Module installieren
RUN npm install node-red-contrib-moment node-red-contrib-cron-plus
# Wechsel zu root, um das Entrypoint-Skript zu kopieren und die Rechte zu setzen
USER root
# Kopiere unser neues Entrypoint-Skript
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# Setze unser Skript als den neuen Entrypoint
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
# Der ursprüngliche CMD des Node-RED-Images wird automatisch beibehalten und
# an unser Entrypoint-Skript als "$@" übergeben.
+18
View File
@@ -0,0 +1,18 @@
#!/bin/sh
# Setze Umgebungsvariablen aus Docker Secrets, falls die Dateien existieren
# Wir prüfen, ob die Secret-Dateien existieren, bevor wir sie lesen
if [ -f /run/secrets/ad_user ]; then
export AD_USER=$(cat /run/secrets/ad_user)
fi
if [ -f /run/secrets/ad_password ]; then
export AD_PASSWORD=$(cat /run/secrets/ad_password)
fi
if [ -f /run/secrets/metabase_api_key ]; then
export METABASE_API_KEY=$(cat /run/secrets/metabase_api_key)
fi
# Führe den ursprünglichen Entrypoint des Node-RED-Images aus.
# Der exec-Befehl ersetzt den aktuellen Prozess, was eine bewährte Praxis ist.
exec /usr/src/node-red/entrypoint.sh "$@"
@@ -1 +1 @@
size_by_ownergroup_and_number_of_copies_2026-06-25T14_49_44.json
size_by_ownergroup_and_number_of_copies_2026-06-25T17_25_58.json
+1 -1
View File
@@ -1,2 +1,2 @@
[{"ownerGroup": "p18419", "copies": "oneCopyBig", "size": "1.71048339017E11", "packedSize": "1.711597568E11", "beamline": "X11MA", "department": "6000"}, {"ownerGroup": "p17419", "copies": "twoCopiesBig", "size": "6.50031873453E11", "packedSize": "6.5003189248E11", "beamline": "X08SA", "department": "6000"}, {"ownerGroup": "p17555", "copies": "oneCopyBig", "size": "2.155842622917E12", "packedSize": "2.15587003392E12", "beamline": "X08SA", "department": "6000"}, {"ownerGroup": "p19200", "copies": "oneCopyBig", "size": "1.1864029844886E14", "packedSize": "1.1864037650432E14", "beamline": "SARESA", "department": "6000"}, {"ownerGroup": "p18240", "copies": "oneCopyBig", "size": "1.299103842243E12", "packedSize": "1.2991615488E12", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p16471", "copies": "oneCopySmall", "size": "319939", "packedSize": "327680", "beamline": "X09LA", "department": "6000"}, {"ownerGroup": "p22164", "copies": "oneCopyBig", "size": "4309720", "packedSize": "5140480", "beamline": "ZEBRA", "department": "3000"}, {"ownerGroup": "p21060", "copies": "oneCopyBig", "size": "19084781262", "packedSize": "19085987840", "beamline": "lem", "department": "3000"}, {"ownerGroup": "p21209", "copies": "oneCopyBig", "size": "5.569000528788E13", "packedSize": "5.569006183424E13", "beamline": "SARESA", "department": "6000"}, {"ownerGroup": "p17828", "copies": "oneCopyBig", "size": "4.45403665462E13", "packedSize": "4.454046472192E13", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p16634", "copies": "oneCopySmall", "size": "2393985", "packedSize": "2764800", "beamline": "X04DB", "department": "6000"}, {"ownerGroup": "p16738", "copies": "twoCopiesBig", "size": "2.932185502184E13", "packedSize": "2.932530755584E13", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p18905", "copies": "oneCopyBig", "size": "2.9848082645E10", "packedSize": "2.990030848E10", "beamline": "X11MA", "department": "6000"}, {"ownerGroup": "p16099", "copies": "oneCopyBig", "size": "2.45503897305E11", "packedSize": "2.455212032E11", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p22408", "copies": "oneCopyBig", "size": "23452047236", "packedSize": "23453757440", "beamline": "lem", "department": "3000"}, {"ownerGroup": "p22631", "copies": "oneCopyBig", "size": "1292216468", "packedSize": "1292482560", "beamline": "AMOR", "department": "3000"}, {"ownerGroup": "p18976", "copies": "oneCopyBig", "size": "589097159", "packedSize": "590120960", "beamline": "X11MA", "department": "6000"}, {"ownerGroup": "p20496", "copies": "oneCopyBig", "size": "2546068054", "packedSize": "2548992000", "beamline": "gpd", "department": "3000"}, {"ownerGroup": "p21905", "copies": "oneCopySmall", "size": "48552", "packedSize": "61440", "beamline": "CAMEA", "department": "3000"}, {"ownerGroup": "p12202", "copies": "twoCopiesBig", "size": "3.96492613255E11", "packedSize": "3.9649275904E11", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p22057", "copies": "oneCopyBig", "size": "18319205106", "packedSize": "18320035840", "beamline": "lem", "department": "3000"}, {"ownerGroup": "p22318", "copies": "oneCopyBig", "size": "388597565", "packedSize": "389355520", "beamline": "FOCUS", "department": "3000"}, {"ownerGroup": "p14196", "copies": "oneCopyBig", "size": "1.0357826237E10", "packedSize": "1.039229952E10", "beamline": "X11MA", "department": "6000"}, {"ownerGroup": "p18741", "copies": "oneCopySmall", "size": "7140935", "packedSize": "10434560", "beamline": "SARESA", "department": "6000"}, {"ownerGroup": "p19898", "copies": "oneCopyBig", "size": "458567543", "packedSize": "459018240", "beamline": "dolly", "department": "3000"}, {"ownerGroup": "p20566", "copies": "oneCopyBig", "size": "4.9832807703365E13", "packedSize": "4.983314065408E13", "beamline": "X06SA", "department": "6000"}, {"ownerGroup": "p22124", "copies": "oneCopyBig", "size": "134335306", "packedSize": "134420480", "beamline": "FOCUS", "department": "3000"}, {"ownerGroup": "p21923", "copies": "oneCopyBig", "size": "1652082", "packedSize": "2037760", "beamline": "EIGER", "department": "3000"}, {"ownerGroup": "p19824", "copies": "oneCopyBig", "size": "451330271", "packedSize": "451850240", "beamline": "gps", "department": "3000"}, {"ownerGroup": "p18167", "copies": "twoCopiesBig", "size": "2.08150370826E11", "packedSize": "2.0818541568E11", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p15923", "copies": "oneCopySmall", "size": "721", "packedSize": "949", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p20507", "copies": "oneCopyBig", "size": "2129523728", "packedSize": "2130821120", "beamline": "hal-9500", "department": "3000"}, {"ownerGroup": "p18990", "copies": "oneCopyBig", "size": "701483011", "packedSize": "702259200", "beamline": "dolly", "department": "3000"}, {"ownerGroup": "p19000", "copies": "oneCopyBig", "size": "466433016", "packedSize": "467015680", "beamline": "dolly", "department": "3000"}, {"ownerGroup": "p1Line truncated
[{"ownerGroup": "p19115", "copies": "oneCopyBig", "size": "1408838635", "packedSize": "1409863680", "beamline": "gps", "department": "3000"}, {"ownerGroup": "p20594", "copies": "oneCopyBig", "size": "3.374955020141E12", "packedSize": "3.3749684736E12", "beamline": "X08SA", "department": "6000"}, {"ownerGroup": "p22825", "copies": "oneCopyBig", "size": "21472794478", "packedSize": "21474785280", "beamline": "lem", "department": "3000"}, {"ownerGroup": "a-35263", "copies": "oneCopyBig", "size": "3.32676583329685E14", "packedSize": "3.3268744358912E14", "department": "2000"}, {"ownerGroup": "p15673", "copies": "oneCopySmall", "size": "947", "packedSize": "10240", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p20455", "copies": "oneCopyBig", "size": "2128538037", "packedSize": "2130155520", "beamline": "gps", "department": "3000"}, {"ownerGroup": "p21699", "copies": "oneCopyBig", "size": "3916825633", "packedSize": "3918909440", "beamline": "hal-9500", "department": "3000"}, {"ownerGroup": "p19097", "copies": "oneCopyBig", "size": "1148395627", "packedSize": "1148866560", "beamline": "gps", "department": "3000"}, {"ownerGroup": "p19539", "copies": "oneCopyBig", "size": "2.2447987101E10", "packedSize": "2.245650432E10", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p21273", "copies": "oneCopyBig", "size": "3.87448161E9", "packedSize": "3.87462144E9", "beamline": "AMOR", "department": "3000"}, {"ownerGroup": "p21080", "copies": "oneCopyBig", "size": "1837742857", "packedSize": "1839042560", "beamline": "flame", "department": "3000"}, {"ownerGroup": "p17519", "copies": "oneCopyBig", "size": "1.9757726115E10", "packedSize": "1.984349184E10", "beamline": "X11MA", "department": "6000"}, {"ownerGroup": "a-35430", "copies": "twoCopiesBig", "size": "1.1991759763E10", "packedSize": "1.199177728E10", "department": "6000"}, {"ownerGroup": "p16446", "copies": "oneCopySmall", "size": "2257", "packedSize": "20480", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p18102", "copies": "oneCopySmall", "size": "1324635", "packedSize": "1423360", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p13269", "copies": "oneCopySmall", "size": "3578376", "packedSize": "5980160", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p17960", "copies": "oneCopyBig", "size": "3.6866980823E11", "packedSize": "3.6865547264E11", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p20329", "copies": "oneCopyBig", "size": "489996862", "packedSize": "490188800", "beamline": "FOCUS", "department": "3000"}, {"ownerGroup": "p18635", "copies": "oneCopyBig", "size": "3.38859342823E11", "packedSize": "3.3885976576E11", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p19768", "copies": "oneCopySmall", "size": "184275", "packedSize": "194560", "beamline": "lem", "department": "3000"}, {"ownerGroup": "p22653", "copies": "oneCopySmall", "size": "7756909", "packedSize": "7895040", "beamline": "DMC", "department": "3000"}, {"ownerGroup": "p21603", "copies": "oneCopySmall", "size": "1662874", "packedSize": "2068480", "beamline": "ZEBRA", "department": "3000"}, {"ownerGroup": "p22511", "copies": "oneCopySmall", "size": "1765726", "packedSize": "1863680", "beamline": "HRPT", "department": "3000"}, {"ownerGroup": "p16635", "copies": "oneCopySmall", "size": "531749", "packedSize": "901120", "beamline": "X04DB", "department": "6000"}, {"ownerGroup": "p18610", "copies": "oneCopyBig", "size": "2.614371118688E12", "packedSize": "2.61437869056E12", "beamline": "X04SA", "department": "6000"}, {"ownerGroup": "p21778", "copies": "oneCopySmall", "size": "4744579", "packedSize": "4833280", "beamline": "DMC", "department": "3000"}, {"ownerGroup": "p19336", "copies": "oneCopyBig", "size": "3.7610534981458E13", "packedSize": "3.761053821952E13", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p22231", "copies": "oneCopyBig", "size": "1709579213", "packedSize": "1710725120", "beamline": "flame", "department": "3000"}, {"ownerGroup": "p22717", "copies": "oneCopyBig", "size": "1985058249", "packedSize": "2021089280", "beamline": "SANS-I", "department": "3000"}, {"ownerGroup": "p20615", "copies": "oneCopyBig", "size": "2.641689030422E12", "packedSize": "2.64169194496E12", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p21786", "copies": "oneCopySmall", "size": "67409277", "packedSize": "69130240", "beamline": "DMC", "department": "3000"}, {"ownerGroup": "p19043", "copies": "oneCopyBig", "size": "2581619188", "packedSize": "2582732800", "beamline": "hal-9500", "department": "3000"}, {"ownerGroup": "p19535", "copies": "oneCopyBig", "size": "6.62969376868E11", "packedSize": "6.6308801536E11", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p19859", "copies": "oneCopySmall", "size": "896226", "packedSize": "911360", "beamline": "lem", "department": "3000"}, {"ownerGroup": "p21886", "copies": "oneCopyBig", "size": "60747413", "packedSize": "60856320", "beamline": "ZEBRA", "Line truncated