Compare commits

...

15 Commits

Author SHA1 Message Date
Aiirondev_dev 6f50fb2263 Changes from old deployment system to new dynamic one 2026-07-28 22:09:40 +02:00
Aiirondev_dev a1c5a78b20 Changes for the System to accept the changes 2026-07-28 21:53:48 +02:00
Aiirondev_dev 38320f488a patch for the Secret Getting that is not functioning 2026-07-28 21:47:37 +02:00
Aiirondev_dev 2aee36cc92 Updates to the Update Group logic to have a cleaner output 2026-07-28 21:23:21 +02:00
Aiirondev_dev aa2ad37cd7 Changes ti the release to fiy an issue 2026-07-28 21:01:05 +02:00
Aiirondev_dev 315918098d Changes of the settings.py and in generell the Variable Proccessing to have a more secure deployment Process 2026-07-28 20:52:05 +02:00
Aiirondev_dev ea402f3223 Changes to the mail sending system to allow for a more fluent proccessing of the mails in regarts to the rate limiting 2026-07-28 19:03:15 +02:00
Aiirondev_dev 70b108d841 Changes 2026-07-27 23:49:30 +02:00
Aiirondev_dev fc53333436 Oke 2026-07-27 23:49:30 +02:00
Aiirondev_dev 33ae7ee1ac removal of unused legal files from old gh repo 2026-07-27 22:42:21 +02:00
Aiirondev_dev 16962b20b6 Add of descryption of for the removal of big tmp files 2026-07-27 21:17:51 +02:00
Aiirondev_dev 6fcabc8638 changes to the open Damage Invoice Modal 2026-07-27 21:13:18 +02:00
Aiirondev_dev 3068f44563 implementet automatic including of the price 2026-07-27 20:16:53 +02:00
Aiirondev_dev c4dd18a2e4 change to have automatic clearing of the tmp directory 2026-07-27 15:30:34 +02:00
Aiirondev_dev d0ac21e7dd changes to the Library Type 2026-07-27 15:20:27 +02:00
19 changed files with 275 additions and 674 deletions
-8
View File
@@ -1,8 +0,0 @@
services:
app:
working_dir: /app/Web
command: ["gunicorn", "app:app", "--bind", "0.0.0.0:8000", "--workers", "4", "--threads", "2", "--timeout", "30", "--graceful-timeout", "20", "--worker-connections", "100", "--max-requests", "1000", "--max-requests-jitter", "100", "--log-level", "info", "--access-logfile", "-", "--error-logfile", "-"]
image: ghcr.io/aiirondev/legendary-octo-garbanzo:v0.7.42
build: null
ports:
- "10000:8000"
+91 -128
View File
@@ -25,7 +25,6 @@ env:
jobs: jobs:
release-docker: release-docker:
# Hinweis: Falls dein lokaler Gitea-Runner ein anderes Label hat (z.B. 'linux' oder 'self-hosted'), passe dies hier an.
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -35,7 +34,6 @@ jobs:
- name: Set metadata - name: Set metadata
id: meta id: meta
env: env:
# Gitea stellt das GITHUB_TOKEN für Kompatibilität mit GitHub Actions automatisch zur Verfügung
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ gitea.repository }} REPO: ${{ gitea.repository }}
EVENT_NAME: ${{ gitea.event_name }} EVENT_NAME: ${{ gitea.event_name }}
@@ -46,7 +44,6 @@ jobs:
if [ "$EVENT_NAME" = "push" ] && [ -n "$REF_NAME" ]; then if [ "$EVENT_NAME" = "push" ] && [ -n "$REF_NAME" ]; then
TAG="$REF_NAME" TAG="$REF_NAME"
else else
# Gitea API Endpunkt nutzen, um das aktuellste Release abzufragen
latest_tag="v0.8.31" latest_tag="v0.8.31"
if meta_json=$(curl -fsSL -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/json" "https://git.invario-software.eu/api/v1/repos/$REPO/releases/latest" 2>/dev/null); then if meta_json=$(curl -fsSL -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/json" "https://git.invario-software.eu/api/v1/repos/$REPO/releases/latest" 2>/dev/null); then
tag_name=$(printf "%s" "$meta_json" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n1) tag_name=$(printf "%s" "$meta_json" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n1)
@@ -63,7 +60,6 @@ jobs:
major=0; minor=8; patch=31 major=0; minor=8; patch=31
fi fi
# Bump strategy: major / minor / patch
if [ "${BUMP_TYPE:-}" = "major" ]; then if [ "${BUMP_TYPE:-}" = "major" ]; then
major=$((major + 1)); minor=0; patch=0 major=$((major + 1)); minor=0; patch=0
elif [ "${BUMP_TYPE:-}" = "minor" ]; then elif [ "${BUMP_TYPE:-}" = "minor" ]; then
@@ -72,11 +68,9 @@ jobs:
patch=$((patch + 1)) patch=$((patch + 1))
fi fi
# Zusammenbau des Tags für den manuellen Run
TAG="v${major}.${minor}.${patch}" TAG="v${major}.${minor}.${patch}"
fi fi
# Validierung des erzeugten oder übergebenen Tags
if ! echo "$TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+(-dev(\.[0-9]+)?)?$'; then if ! echo "$TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+(-dev(\.[0-9]+)?)?$'; then
echo "Error: tag '$TAG' is not valid semver (vX.Y.Z)" echo "Error: tag '$TAG' is not valid semver (vX.Y.Z)"
exit 1 exit 1
@@ -95,13 +89,11 @@ jobs:
LATEST_MAJOR="0" LATEST_MAJOR="0"
fi fi
# If not explicitly bumping major, disallow changing major version
if [ "${BUMP_TYPE:-}" != "major" ] && [ "$TAG_MAJOR" != "$LATEST_MAJOR" ]; then if [ "${BUMP_TYPE:-}" != "major" ] && [ "$TAG_MAJOR" != "$LATEST_MAJOR" ]; then
echo "Error: major version must stay v$LATEST_MAJOR.x.x (got $TAG)" echo "Error: major version must stay v$LATEST_MAJOR.x.x (got $TAG)"
exit 1 exit 1
fi fi
# Ensure tag uniqueness: if tag exists append numeric suffix
if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then
i=1 i=1
base="$TAG" base="$TAG"
@@ -111,24 +103,18 @@ jobs:
TAG="${base}.${i}" TAG="${base}.${i}"
fi fi
# Docker Images verlangen Kleinbuchstaben. Repository-Namen daher umwandeln.
LOWER_REPO=$(echo "$REPO" | tr '[:upper:]' '[:lower:]') LOWER_REPO=$(echo "$REPO" | tr '[:upper:]' '[:lower:]')
IMAGE="git.invario-software.eu/${LOWER_REPO}:${TAG}" IMAGE="git.invario-software.eu/${LOWER_REPO}:${TAG}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT" echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "image=$IMAGE" >> "$GITHUB_OUTPUT" echo "image=$IMAGE" >> "$GITHUB_OUTPUT"
echo "lower_repo=$LOWER_REPO" >> "$GITHUB_OUTPUT" echo "lower_repo=$LOWER_REPO" >> "$GITHUB_OUTPUT"
- name: Ensure Docker CLI is available and up to date - name: Ensure Docker CLI is available and up to date
run: | run: |
install_docker=true install_docker=true
# Prüfen, ob Docker existiert und ob die Version ausreicht
if command -v docker >/dev/null 2>&1; then if command -v docker >/dev/null 2>&1; then
# Extrahiere die Major-Version
DOCKER_MAJOR=$(docker --version | grep -oE '[0-9]+' | head -n1) DOCKER_MAJOR=$(docker --version | grep -oE '[0-9]+' | head -n1)
# API 1.44 erfordert mindestens Docker v25
if [ -n "$DOCKER_MAJOR" ] && [ "$DOCKER_MAJOR" -ge 25 ]; then if [ -n "$DOCKER_MAJOR" ] && [ "$DOCKER_MAJOR" -ge 25 ]; then
install_docker=false install_docker=false
fi fi
@@ -136,34 +122,19 @@ jobs:
if [ "$install_docker" = true ]; then if [ "$install_docker" = true ]; then
echo "Veraltete oder fehlende Docker-Installation erkannt. Lade statische Docker CLI herunter..." echo "Veraltete oder fehlende Docker-Installation erkannt. Lade statische Docker CLI herunter..."
DOCKER_VERSION="26.1.4" DOCKER_VERSION="26.1.4"
# Download der statischen Binaries via curl oder wget (umgeht apt-get komplett)
if command -v curl >/dev/null 2>&1; then if command -v curl >/dev/null 2>&1; then
curl -fsSLO "https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz" curl -fsSLO "https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz"
else else
wget -q "https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz" wget -q "https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz"
fi fi
tar -xzf docker-${DOCKER_VERSION}.tgz tar -xzf docker-${DOCKER_VERSION}.tgz
# Installation in lokalen Benutzer-Pfad, um sudo/root-Rechte-Probleme zu vermeiden
mkdir -p "$HOME/.local/bin" mkdir -p "$HOME/.local/bin"
cp docker/docker "$HOME/.local/bin/" cp docker/docker "$HOME/.local/bin/"
# Pfad für nachfolgende GitHub Actions Schritte verfügbar machen
echo "$HOME/.local/bin" >> "$GITHUB_PATH" echo "$HOME/.local/bin" >> "$GITHUB_PATH"
# Pfad für diesen spezifischen Shell-Run exportieren
export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.local/bin:$PATH"
rm -rf docker docker-${DOCKER_VERSION}.tgz rm -rf docker docker-${DOCKER_VERSION}.tgz
echo "Docker CLI wurde erfolgreich aktualisiert."
else
echo "Docker CLI ist bereits auf einem aktuellen Stand."
fi fi
docker --version docker --version
- name: Set up Docker Buildx - name: Set up Docker Buildx
@@ -186,109 +157,101 @@ jobs:
${{ steps.meta.outputs.image }} ${{ steps.meta.outputs.image }}
git.invario-software.eu/${{ steps.meta.outputs.lower_repo }}:latest git.invario-software.eu/${{ steps.meta.outputs.lower_repo }}:latest
- name: Build local image tar for offline deploy
run: |
set -euo pipefail
IMG="${{ steps.meta.outputs.image }}"
TAG="${{ steps.meta.outputs.tag }}"
echo "Pulling freshly pushed image from registry: $IMG"
docker pull "$IMG"
echo "Saving image to offline tar archive..."
docker save "$IMG" | gzip > "inventarsystem-image-${TAG}.tar.gz"
- name: Create release-only docker bundle - name: Create release-only docker bundle
run: | run: |
mkdir -p release-bundle mkdir -p release-bundle
cat > release-bundle/docker-compose.yml <<EOF cat > release-bundle/docker-compose.yml <<EOF
services: services:
app: app:
image: \${INVENTAR_APP_IMAGE:-${{ steps.meta.outputs.image }}} image: \${INVENTAR_APP_IMAGE:-${{ steps.meta.outputs.image }}}
container_name: inventarsystem-app container_name: inventarsystem-app
restart: unless-stopped restart: unless-stopped
ports: ports:
- "\${INVENTAR_HTTP_PORT:-10000}:8000" - "\${INVENTAR_HTTP_PORT:-10000}:8000"
depends_on: depends_on:
- mongodb - mongodb
- redis - redis
environment: environment:
INVENTAR_MONGODB_HOST: mongodb INVENTAR_MONGODB_HOST: mongodb
INVENTAR_MONGODB_PORT: "27017" INVENTAR_MONGODB_PORT: "27017"
INVENTAR_MONGODB_DB: Inventarsystem INVENTAR_MONGODB_DB: Inventarsystem
INVENTAR_BACKUP_FOLDER: /data/backups INVENTAR_BACKUP_FOLDER: /data/backups
INVENTAR_LOGS_FOLDER: /data/logs INVENTAR_LOGS_FOLDER: /data/logs
expose: INVENTAR_SECRET_KEY: ${{secrets.INVENTAR_SECRET_KEY}}
- "8000" INVENTAR_DATA_ENCRYPTION_KEY: ${{secrets.INVENTAR_DATA_ENCRYPTION_KEY}}
volumes: INVENTAR_MONGODB_PASSWORD: ${{secrets.INVENTAR_MONGODB_PASSWORD}}
- ./config.json:/app/config.json:ro EMAIL_ENABLED: ${{secrets.EMAIL_ENABLED}}
- app_uploads:/app/Web/uploads EMAIL_SMTP_HOST: ${{secrets.EMAIL_SMTP_HOST}}
- app_thumbnails:/app/Web/thumbnails EMAIL_SMTP_PORT: ${{secrets.EMAIL_SMTP_PORT}}
- app_previews:/app/Web/previews EMAIL_USERNAME: ${{secrets.EMAIL_USERNAME}}
- app_qrcodes:/app/Web/QRCodes EMAIL_PASSWORD: ${{secrets.EMAIL_PASSWORD}}
- app_backups:/data/backups expose:
- app_logs:/data/logs - "8000"
volumes:
mongodb: - ./config.json:/app/config.json:ro
image: mongo:7.0 - app_uploads:/app/Web/uploads
container_name: inventarsystem-mongodb - app_thumbnails:/app/Web/thumbnails
restart: unless-stopped - app_previews:/app/Web/previews
volumes: - app_qrcodes:/app/Web/QRCodes
- mongodb_data:/data/db - app_backups:/data/backups
healthcheck: - app_logs:/data/logs
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping').ok"]
interval: 10s mongodb:
timeout: 5s image: mongo:7.0
retries: 10 container_name: inventarsystem-mongodb
restart: unless-stopped
redis: volumes:
image: redis:7-alpine - mongodb_data:/data/db
container_name: inventarsystem-redis healthcheck:
restart: unless-stopped test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping').ok"]
command: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy allkeys-lru interval: 10s
ports: timeout: 5s
- "6379:6379" retries: 10
volumes:
- redis_data:/data redis:
healthcheck: image: redis:7-alpine
test: ["CMD", "redis-cli", "ping"] container_name: inventarsystem-redis
interval: 10s restart: unless-stopped
timeout: 5s command: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy allkeys-lru
retries: 5 ports:
- "6379:6379"
volumes: volumes:
mongodb_data: - redis_data:/data
app_uploads: healthcheck:
app_thumbnails: test: ["CMD", "redis-cli", "ping"]
app_previews: interval: 10s
app_qrcodes: timeout: 5s
app_backups: retries: 5
app_logs:
redis_data: volumes:
EOF mongodb_data:
app_uploads:
# Copy runtime scripts and config if present app_thumbnails:
for f in start.sh stop.sh restart.sh backup.sh restore.sh config.json update.sh; do app_previews:
if [ -f "$f" ]; then app_qrcodes:
cp "$f" "release-bundle/$(basename "$f")" app_backups:
fi app_logs:
done redis_data:
EOF
# Multitenant scripts & docs (optional)
for f in docker-compose-multitenant.yml manage-tenant.sh run-tenant-cmd.sh MULTITENANT_DEPLOYMENT.md MULTITENANT_PYTHON_API.md; do for f in start.sh stop.sh restart.sh backup.sh restore.sh config.json update.sh; do
if [ -f "$f" ]; then if [ -f "$f" ]; then
cp "$f" "release-bundle/$(basename "$f")" cp "$f" "release-bundle/$(basename "$f")"
fi fi
done done
# Make any shipped scripts executable for f in docker-compose-multitenant.yml manage-tenant.sh run-tenant-cmd.sh MULTITENANT_DEPLOYMENT.md MULTITENANT_PYTHON_API.md; do
find release-bundle -maxdepth 1 -type f -name '*.sh' -exec chmod +x {} \; || true if [ -f "$f" ]; then
tar -czf inventarsystem-docker-bundle.tar.gz -C release-bundle . cp "$f" "release-bundle/$(basename "$f")"
fi
done
find release-bundle -maxdepth 1 -type f -name '*.sh' -exec chmod +x {} \; || true
tar -czf inventarsystem-docker-bundle.tar.gz -C release-bundle .
- name: Create or update Gitea Release - name: Create or update Gitea Release
uses: https://gitea.com/actions/gitea-release-action@v1 uses: https://gitea.com/actions/gitea-release-action@v1
with: with:
tag_name: ${{ steps.meta.outputs.tag }} tag_name: ${{ steps.meta.outputs.tag }}
files: | files: |
inventarsystem-docker-bundle.tar.gz inventarsystem-docker-bundle.tar.gz
inventarsystem-image-${{ steps.meta.outputs.tag }}.tar.gz
+1
View File
@@ -3,6 +3,7 @@ logs
certs certs
build build
.venv .venv
.idea
__pycache__ __pycache__
.pycvapid.json .pycvapid.json
Web/vapid.json Web/vapid.json
-1
View File
@@ -1 +0,0 @@
v0.8.31.1
-128
View File
@@ -1,128 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
Iron.ai.dev@gmail.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
-55
View File
@@ -1,55 +0,0 @@
# Endbenutzer-Lizenzvertrag (EULA) und Nutzungsbedingungen
**Softwareprojekt:** Inventarsystem
**Urheberrechtshalter (Lizenzgeber):** Maximilian Gründinger
**Gültigkeit:** Stand 2026
---
### PRÄAMBEL
Dieser Endbenutzer-Lizenzvertrag (im Folgenden „Vertrag“) stellt eine rechtsgültige Vereinbarung zwischen Ihnen (im Folgenden „Lizenznehmer“) und dem Urheber **AIIrondev** (im Folgenden „Lizenzgeber“) dar. Durch den Zugriff auf den Quellcode, die Installation, das Kopieren oder die sonstige Nutzung der Software „Inventarsystem“ (im Folgenden „Produkt“) erklärt sich der Lizenznehmer mit den nachfolgenden Bedingungen vollumfänglich einverstanden.
Sollte der Lizenznehmer den Bedingungen dieses Vertrags nicht zustimmen, ist jegliche Nutzung, Vervielfältigung oder Distribution des Produkts mit sofortiger Wirkung untersagt.
---
### § 1 GEGENSTAND DER LIZENZ UND EIGENTUMSRECHTE
1. Das Produkt wird dem Lizenznehmer unter Vorbehalt lizenziert, nicht verkauft. Sämtliche Eigentumsrechte, Urheberrechte und sonstigen geistigen Eigentumsrechte am Produkt sowie an allen Kopien davon verbleiben ausschließlich beim Lizenzgeber.
2. Diese Lizenz gewährt lediglich ein eingeschränktes Nutzungsrecht unter den in diesem Vertrag explizit genannten Bedingungen.
### § 2 ZULÄSSIGER NUTZUNGSKREIS (PRIVATNUTZUNG)
1. Die unentgeltliche Nutzung des Produkts ist ausschließlich **natürlichen Personen für den rein privaten, häuslichen Gebrauch** gestattet.
2. Die Nutzung umfasst die Verwaltung privater Bestände ohne jegliche Gewinnerzielungsabsicht.
3. Jegliche Nutzung durch **Institutionelle Nutzer** (einschließlich, aber nicht beschränkt auf: Unternehmen, Einzelunternehmer, Freiberufler, Vereine, Bildungseinrichtungen, Behörden oder NGOs) ist ausdrücklich **untersagt** und bedarf einer gesonderten, schriftlichen Lizenzvereinbarung mit dem Lizenzgeber.
### § 3 FUNKTIONALE EINSCHRÄNKUNGEN UND SUPPORT
1. Dem Lizenznehmer wird das Produkt in der jeweils vorliegenden Fassung bereitgestellt („As-Is“).
2. Für die kostenlose Privatnutzung besteht **kein Anspruch** auf:
- Technischen Support oder Beratung.
- Bereitstellung von Sicherheits-Updates oder Patches.
- Gewährleistung der Kompatibilität mit spezifischen Hardware- oder Softwareumgebungen.
3. Der Lizenzgeber behält sich das Recht vor, Funktionen in zukünftigen Versionen zu ändern, einzuschränken oder kostenpflichtig zu gestalten.
### § 4 WAHRUNG DER URHEBERBEZEICHNUNG (BRANDING-KLAUSEL)
1. Das Produkt verfügt über fest integrierte Urheberrechtshinweise, insbesondere die Kennzeichnung **„Powered by AIIrondev“** in der Benutzeroberfläche (Footer/Menü).
2. Es ist dem Lizenznehmer untersagt, diese Hinweise zu entfernen, zu modifizieren, zu verdecken oder deren Sichtbarkeit durch technische Maßnahmen (z. B. Manipulation von CSS, JavaScript oder Metadaten) zu beeinträchtigen.
3. Das Entfernen dieser Hinweise führt zum sofortigen und automatischen Erlöschen der Nutzungslizenz.
### § 5 VERBOT DER KOMMERZIELLEN VERWERTUNG & SAAS
1. Die Bereitstellung des Produkts als Dienstleistung für Dritte (Software-as-a-Service, SaaS), insbesondere gegen Entgelt oder zur Generierung von Werbeeinnahmen, ist strikt untersagt.
2. Das Hosting auf öffentlichen Servern mit dem Ziel, Dritten ohne eigene Installation Zugriff auf die Funktionalität zu gewähren, ist nur mit ausdrücklicher schriftlicher Genehmigung des Lizenzgebers zulässig.
### § 6 MODIFIKATIONEN UND CONTRIBUTIONS
1. Der Lizenznehmer darf den Quellcode für den privaten Eigenbedarf modifizieren.
2. Im Falle einer Veröffentlichung von Modifikationen oder der Einreichung von Verbesserungsvorschlägen (z. B. Pull Requests auf GitHub) räumt der Lizenznehmer dem Lizenzgeber ein unwiderrufliches, weltweites, zeitlich unbeschränktes und kostenfreies Nutzungs- und Verwertungsrecht an diesen Änderungen ein. Der Lizenzgeber ist berechtigt, diese Änderungen in das Hauptprodukt zu übernehmen und unter dieser oder einer anderen Lizenz zu vertreiben.
### § 7 HAFTUNGSBESCHRÄNKUNG
1. Die Haftung des Lizenzgebers für Schäden, die aus der Nutzung oder Unmöglichkeit der Nutzung des Produkts entstehen (einschließlich Datenverlust, Betriebsunterbrechung oder entgangener Gewinn), ist auf Vorsatz und grobe Fahrlässigkeit beschränkt.
2. Der Lizenzgeber übernimmt keine Haftung für die Richtigkeit der mit dem Produkt verwalteten Daten.
### § 8 RECHTSWAHL UND GERICHTSSTAND
1. Es gilt ausschließlich das Recht der **Bundesrepublik Deutschland** unter Ausschluss des UN-Kaufrechts (CISG).
2. Soweit gesetzlich zulässig, wird als Gerichtsstand für alle Streitigkeiten aus diesem Vertrag der Sitz des Lizenzgebers vereinbart.
3. Sollten einzelne Bestimmungen dieses Vertrags unwirksam sein, bleibt die Wirksamkeit der übrigen Bestimmungen unberührt (Salvatorische Klausel).
---
**ANFRAGEN FÜR AUSNAHMEGENEHMIGUNGEN (KOMMERZIELLE LIZENZEN):** Bitte kontaktieren Sie den Urheber direkt über das GitHub-Profil: [AIIrondev auf GitHub](https://github.com/AIIrondev)
-38
View File
@@ -1,38 +0,0 @@
Release-Optionen
=================
Diese Datei beschreibt die Eingabeoptionen des CI-Workflows `.github/workflows/release-docker.yml`.
Inputs (workflow_dispatch)
- `bump` (choice)
- `patch` (Standard): Erhöht nur die Patch-Version (vX.Y.Z -> vX.Y.Z+1).
- `minor`: Erhöht die Minor-Version und setzt Patch auf 0 (vX.Y.Z -> vX.Y+1.0).
- `major`: Erhöht die Major-Version und setzt Minor/Patch auf 0 (vX.Y.Z -> vX+1.0.0).
- `development`: Erzeugt einen Development-Release mit Suffix `-dev` (z. B. `v3.1.4-dev`).
- `push_dev` (choice, optional)
- `false` (Standard): Bei `bump=development` wird das `:dev`-Image NICHT automatisch an GHCR gepusht.
- `true`: Bei `bump=development` wird zusätzlich das Image `ghcr.io/aiirondev/legendary-octo-garbanzo:dev` gepusht.
Verhalten/Anmerkungen
- Development releases werden als GitHub Release erzeugt und als `prerelease` markiert, damit sie nicht automatisch von normalen UpdateFlows genutzt werden.
- Es gibt pro Release genau einen ReleaseEintrag (für DevReleases mit `-dev` Suffix). Es wird kein separates `inventarsystem-image-dev.tar.gz` mehr erzeugt; das Update/Deployment erfolgt über den ReleaseTag / ImageTag.
- `update.sh` unterstützt weiterhin `dev`/`development`-Modus und akzeptiert nun auch explizite ReleaseTags wie `v3.1.4-dev`.
Beispiele
- Patch-Release (manuell):
- GitHub UI: Run workflow → `bump=patch`
- CLI mit `gh`:
gh workflow run release-docker.yml --repo AIIrondev/legendary-octo-garbanzo --field bump=patch
- Development prerelease (ohne Push des :dev Images):
- GitHub UI: Run workflow → `bump=development` (leave `push_dev=false`)
- Ergebnis: Release `vX.Y.Z-dev` als prerelease, Image wird nicht automatisch als `:dev` gepusht.
- Development prerelease + push des :dev Images:
- GitHub UI: Run workflow → `bump=development`, `push_dev=true`
- CLI Beispiel:
gh workflow run release-docker.yml --repo AIIrondev/legendary-octo-garbanzo --field bump=development --field push_dev=true
Empfehlung
- Verwende `bump=development` für experimentelle/early releases; Nutzer müssen explizit `./update.sh vX.Y.Z-dev` ausführen, um auf diese Version zu upgraden.
-25
View File
@@ -1,25 +0,0 @@
# Security Policy
## Supported Versions
The latest version will allways be supported the rest are old version that are not activly supported.
| Version | Supported |
| ------- | ------------------ |
| 0.2.17 | ✅ |
| 3.2.x | :white_check_mark: |
| 3.1.x | :x: |
| 3.0.x | :x: |
| 2.6.x | :x: |
| 2.4.x | :x: |
| 1.8.x | :x: |
| 1.7.x | :x: |
| 1.5.x | :x: |
| 1.4.x | :x: |
| 1.3.x | :x: |
| 1.1.x | :x: |
## Reporting a Vulnerability
To report a vulnerability contact me via. my E-Mail Iron.ai.dev@gmail.com or in insevere cases over an Issue.
+7 -2
View File
@@ -1824,9 +1824,9 @@ def _excel_list(value):
seen = set() seen = set()
unique = [] unique = []
for entry in cleaned: for entry in cleaned:
if entry not in seen: if str(entry) not in seen:
unique.append(entry) unique.append(entry)
seen.add(entry) seen.add(str(entry))
return unique return unique
@@ -3157,6 +3157,7 @@ def library_loans_admin():
'damage_text': (damage_reports[0].get('description', '') if damage_reports else ''), 'damage_text': (damage_reports[0].get('description', '') if damage_reports else ''),
'available': bool(item_doc.get('Verfuegbar', False)), 'available': bool(item_doc.get('Verfuegbar', False)),
'last_updated': fmt_dt(item_doc.get('LastUpdated')), 'last_updated': fmt_dt(item_doc.get('LastUpdated')),
'acquisition_costs': item_doc.get('Anschaffungskosten', "")
}) })
return render_template( return render_template(
@@ -6736,6 +6737,8 @@ def update_group():
{'$set': shared_update} {'$set': shared_update}
) )
app.logger.debug(f"Individual Codes: {individual_items}")
# B. Apply Unique Codes to specific items # B. Apply Unique Codes to specific items
# We iterate through the provided list to update the specific code for each ID # We iterate through the provided list to update the specific code for each ID
for item in individual_items: for item in individual_items:
@@ -6749,6 +6752,8 @@ def update_group():
) )
client.close() client.close()
app.logger.debug("Success When Updating the Item")
flash("Objekte wurden erfolgreich Bearbeitet", "success")
return jsonify({'success': True, 'message': 'Gruppe und individuelle Codes aktualisiert'}) return jsonify({'success': True, 'message': 'Gruppe und individuelle Codes aktualisiert'})
except Exception as e: except Exception as e:
+14 -8
View File
@@ -220,15 +220,15 @@ SSL_CERT = _get(_conf, ['ssl', 'cert'], DEFAULTS['ssl']['cert'])
SSL_KEY = _get(_conf, ['ssl', 'key'], DEFAULTS['ssl']['key']) SSL_KEY = _get(_conf, ['ssl', 'key'], DEFAULTS['ssl']['key'])
# Email settings # Email settings
EMAIL_ENABLED = _get(_conf, ['email', 'enabled'], False) EMAIL_ENABLED = bool(os.getenv('EMAIL_ENABLED', False))
EMAIL_SMTP_HOST = _get(_conf, ['email', 'smtp_host'], 'smtp.gmail.com') EMAIL_SMTP_HOST = str(os.getenv('EMAIL_SMTP_HOST', False))
EMAIL_SMTP_PORT = int(_get(_conf, ['email', 'smtp_port'], 587)) EMAIL_SMTP_PORT = int(os.getenv('EMAIL_SMTP_PORT', 587))
EMAIL_USE_TLS = bool(_get(_conf, ['email', 'use_tls'], True)) EMAIL_USE_TLS = True
EMAIL_USERNAME = _get(_conf, ['email', 'username'], '') EMAIL_USERNAME = str(os.getenv('EMAIL_USERNAME', False))
EMAIL_PASSWORD = _get(_conf, ['email', 'password'], '') EMAIL_PASSWORD = str(os.getenv('EMAIL_PASSWORD', False))
EMAIL_FROM_ADDRESS = _get(_conf, ['email', 'from_address'], EMAIL_USERNAME) EMAIL_FROM_ADDRESS = _get(_conf, ['email', 'from_address'], EMAIL_USERNAME)
EMAIL_DEFAULT_SENDER_NAME = _get(_conf, ['email', 'default_sender_name'], 'Inventarsystem') EMAIL_DEFAULT_SENDER_NAME = "Invario Inventarsystem Sender"
EMAIL_TIMEOUT_SECONDS = int(_get(_conf, ['email', 'timeout_seconds'], 30)) EMAIL_TIMEOUT_SECONDS = 20
# School periods # School periods
SCHOOL_PERIODS = _get(_conf, ['schoolPeriods'], DEFAULTS['schoolPeriods']) SCHOOL_PERIODS = _get(_conf, ['schoolPeriods'], DEFAULTS['schoolPeriods'])
@@ -278,6 +278,7 @@ INVENTORY_MODULE_ENABLED = _TenantAwareBool('inventory', _get(_conf, ['modules',
TERMINPLAN_MODULE_ENABLED = _TenantAwareBool('terminplan', _get(_conf, ['modules', 'terminplan', 'enabled'], DEFAULTS['modules']['terminplan']['enabled'])) TERMINPLAN_MODULE_ENABLED = _TenantAwareBool('terminplan', _get(_conf, ['modules', 'terminplan', 'enabled'], DEFAULTS['modules']['terminplan']['enabled']))
LIBRARY_MODULE_ENABLED = _TenantAwareBool('library', _get(_conf, ['modules', 'library', 'enabled'], DEFAULTS['modules']['library']['enabled'])) LIBRARY_MODULE_ENABLED = _TenantAwareBool('library', _get(_conf, ['modules', 'library', 'enabled'], DEFAULTS['modules']['library']['enabled']))
STUDENT_CARDS_MODULE_ENABLED = _TenantAwareBool('student_cards', _get(_conf, ['modules', 'student_cards', 'enabled'], DEFAULTS['modules']['student_cards']['enabled'])) STUDENT_CARDS_MODULE_ENABLED = _TenantAwareBool('student_cards', _get(_conf, ['modules', 'student_cards', 'enabled'], DEFAULTS['modules']['student_cards']['enabled']))
MAIL_ADD_ON_ENABLED = _TenantAwareBool('mail', _get(_conf, ['email', 'enabled'], False))
def _match_inventory(path): def _match_inventory(path):
if not path: return False if not path: return False
@@ -297,11 +298,16 @@ def _match_student_cards(path):
if not path: return False if not path: return False
return path.startswith(('/student_cards')) return path.startswith(('/student_cards'))
def _match_mail(path):
if not path: return False
return path.startswith(('/'))
# Register core modules into the pipeline # Register core modules into the pipeline
MODULES.register('inventory', INVENTORY_MODULE_ENABLED, _match_inventory) MODULES.register('inventory', INVENTORY_MODULE_ENABLED, _match_inventory)
MODULES.register('terminplan', TERMINPLAN_MODULE_ENABLED, _match_terminplan) MODULES.register('terminplan', TERMINPLAN_MODULE_ENABLED, _match_terminplan)
MODULES.register('library', LIBRARY_MODULE_ENABLED, _match_library) MODULES.register('library', LIBRARY_MODULE_ENABLED, _match_library)
MODULES.register('student_cards', STUDENT_CARDS_MODULE_ENABLED, _match_student_cards) MODULES.register('student_cards', STUDENT_CARDS_MODULE_ENABLED, _match_student_cards)
MODULES.register('mail', MAIL_ADD_ON_ENABLED, _match_mail)
STUDENT_DEFAULT_BORROW_DAYS = int(_get(_conf, ['modules', 'student_cards', 'default_borrow_days'], DEFAULTS['modules']['student_cards']['default_borrow_days'])) STUDENT_DEFAULT_BORROW_DAYS = int(_get(_conf, ['modules', 'student_cards', 'default_borrow_days'], DEFAULTS['modules']['student_cards']['default_borrow_days']))
STUDENT_MAX_BORROW_DAYS = int(_get(_conf, ["modules", "student_cards", "max_borrow_days"], DEFAULTS["modules"]["student_cards"]["max_borrow_days"])) STUDENT_MAX_BORROW_DAYS = int(_get(_conf, ["modules", "student_cards", "max_borrow_days"], DEFAULTS["modules"]["student_cards"]["max_borrow_days"]))
+78 -31
View File
@@ -1,51 +1,98 @@
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart from email.mime.multipart import MIMEMultipart
from modules.module_registry import ModuleRegistry as mr from email.mime.text import MIMEText
import smtplib import smtplib
import time
import Web.modules.database.settings as cfg import Web.modules.database.settings as cfg
def _build_smtp_client(): def _build_smtp_client():
smtp = smtplib.SMTP(cfg.EMAIL_SMTP_HOST, cfg.EMAIL_SMTP_PORT, timeout=cfg.EMAIL_TIMEOUT_SECONDS) smtp = smtplib.SMTP(
cfg.EMAIL_SMTP_HOST,
cfg.EMAIL_SMTP_PORT,
timeout=cfg.EMAIL_TIMEOUT_SECONDS,
)
smtp.ehlo() smtp.ehlo()
if cfg.EMAIL_USE_TLS: if cfg.EMAIL_USE_TLS:
smtp.starttls() smtp.starttls()
smtp.ehlo() smtp.ehlo()
if cfg.EMAIL_USERNAME: if cfg.EMAIL_USERNAME:
smtp.login(cfg.EMAIL_USERNAME, cfg.EMAIL_PASSWORD or '') smtp.login(cfg.EMAIL_USERNAME, cfg.EMAIL_PASSWORD or "")
return smtp return smtp
def send(email: list, subject: str, note: str, sender: str) -> bool:
"""
Sends the email with the link to the Clients
Input: def send(email: list | str, subject: str, note: str, sender: str) -> bool:
- email: Email list of all the addresses to send the link to ["","",""] """Sends the email with the link to the Clients."""
- subject: Subject of the email if not cfg.MODULES.is_enabled("mail"):
- note: Note that is send with the Emails print("Debug: Module not enabled")
return False
if isinstance(email, str):
email = [email]
body_message = note
HTML_SIGNATURE = f"""
<table cellpadding="0" cellspacing="0" border="0" style="font-family: Arial, Helvetica, sans-serif; font-size: 13px; color: #333333; line-height: 1.5;">
<tr>
<td>
<p style="margin:0 0 12px 0;">Mit freundlichen Grüßen</p>
<p style="margin:0;"><strong style="font-size:16px;">Automatisierter Email Verteiler für die Schule: {cfg.get_school_info().get("name")}</strong><br></p>
<p style="margin:12px 0 0 0;"><strong>Invario UG</strong><br>Am Sportplatz 10<br>83052 Bruckmühl</p>
</td>
</tr>
</table>
"""
text_content = f"{body_message}\n\nMit freundlichen Grüßen\n{sender}\nInvario UG"
html_content = f"""
<html>
<body>
<p>{body_message}</p>
<br>
{HTML_SIGNATURE}
</body>
</html>
"""
mails_per_second = 10
interval = 1.0 / mails_per_second
Output:
- bool: true if the sending worked and false if it didnt
"""
if not mr.registry.is_enabled('mail'):
return False
else:
msg = MIMEMultipart()
msg['Subject'] = subject
msg['From'] = sender or cfg.EMAIL_FROM_ADDRESS or cfg.EMAIL_USERNAME
msg['To'] = ', '.join(email) if isinstance(email, (list, tuple)) else str(email)
msg.attach(MIMEText(note))
smtp = None smtp = None
try: try:
smtp = _build_smtp_client() smtp = _build_smtp_client()
smtp.sendmail(from_addr=msg['From'], to_addrs=email, msg=msg.as_string())
return True for i, recipient in enumerate(email):
except Exception: start_time = time.time()
return False
msg = MIMEMultipart("alternative")
msg["Subject"] = str(subject)
msg["From"] = f"{sender} <{cfg.EMAIL_USERNAME}>"
msg["To"] = str(recipient)
msg.attach(MIMEText(text_content, "plain"))
msg.attach(MIMEText(html_content, "html"))
smtp.sendmail(
from_addr=cfg.EMAIL_USERNAME,
to_addrs=[recipient],
msg=msg.as_string()
)
elapsed_time = time.time() - start_time
sleep_time = interval - elapsed_time
if sleep_time > 0 and i < len(email) - 1:
time.sleep(sleep_time)
return True
except Exception as e:
print(f"Debug: Fehler beim Senden der E-Mail: {e}")
return False
finally: finally:
try:
if smtp: if smtp:
smtp.quit() try:
except Exception: smtp.quit()
pass except Exception:
pass
+1 -1
View File
@@ -22,7 +22,7 @@ def _resolve_public_base_url() -> str:
subdomain = '' subdomain = ''
if tenant_context: if tenant_context:
subdomain = getattr(tenant_context, 'subdomain', '') or getattr(tenant_context, 'tenant_id', '') or '' subdomain = getattr(tenant_context, 'subdomain', '') or getattr(tenant_context, 'tenant_id', '') or ''
return f"https://{subdomain}.invario.eu" if subdomain else "https://invario.eu" return (f"https://{subdomain}.invario-software.de") if subdomain else "https://invario-software.de"
def _current_tenant_id() -> str: def _current_tenant_id() -> str:
+30 -15
View File
@@ -520,7 +520,16 @@
window.openDamageReportPrompt = openDamageReportPrompt; window.openDamageReportPrompt = openDamageReportPrompt;
function openDamageInvoiceModal(row, description) { function openDamageInvoiceModal(row, description) {
if (!damageInvoiceModal || !damageInvoiceForm) { const modal = document.getElementById('damage-invoice-modal');
const form = document.getElementById('damage-invoice-form');
const inputItem = document.getElementById('damage-invoice-item');
const inputBorrower = document.getElementById('damage-invoice-borrower');
const inputCode = document.getElementById('damage-invoice-code');
const inputAmount = document.getElementById('damage-invoice-amount');
const inputReason = document.getElementById('damage-invoice-reason');
if (!modal || !form) {
console.error("Modal oder Formular nicht gefunden.");
return; return;
} }
@@ -530,23 +539,29 @@
const itemCode = row.dataset.itemCode || ''; const itemCode = row.dataset.itemCode || '';
const itemCost = row.dataset.itemCost || ''; const itemCost = row.dataset.itemCost || '';
damageInvoiceForm.action = "{{ url_for('admin_create_invoice', borrow_id='__BORROW_ID__') }}".replace('__BORROW_ID__', borrowId); form.action = "{{ url_for('admin_create_invoice', borrow_id='__BORROW_ID__') }}".replace('__BORROW_ID__', borrowId);
damageInvoiceItem.value = itemName;
damageInvoiceBorrower.value = borrower; inputItem.value = itemName;
damageInvoiceCode.value = itemCode; inputBorrower.value = borrower;
damageInvoiceAmount.value = String(itemCost).replace(' EUR', '').trim(); inputCode.value = itemCode;
damageInvoiceReason.value = description || `Schaden gemeldet für ${itemName}`;
damageInvoiceModal.style.display = 'block'; inputAmount.value = String(itemCost).replace(' EUR', '').trim();
damageInvoiceAmount.focus();
inputReason.value = description || `Schaden gemeldet für ${itemName}`;
modal.style.display = 'block';
inputAmount.focus();
}
function closeDamageInvoiceModal() {
const modal = document.getElementById('damage-invoice-modal');
if (modal) {
modal.style.display = 'none';
}
} }
window.openDamageInvoiceModal = openDamageInvoiceModal; window.openDamageInvoiceModal = openDamageInvoiceModal;
window.closeDamageInvoiceModal = closeDamageInvoiceModal;
function closeDamageInvoiceModal() {
if (damageInvoiceModal) {
damageInvoiceModal.style.display = 'none';
}
}
if (damageInvoiceModal) { if (damageInvoiceModal) {
damageInvoiceModal.addEventListener('click', function(event) { damageInvoiceModal.addEventListener('click', function(event) {
+7 -6
View File
@@ -1371,7 +1371,8 @@
await loadLibraryItems(); // Daten neu laden await loadLibraryItems(); // Daten neu laden
// renderTable(); // Ggf. Tabelle neu rendern // renderTable(); // Ggf. Tabelle neu rendern
} else { } else {
alert('Fehler: ' + result.message); closeEditLibraryModal();
await loadLibraryItems();
} }
} catch (error) { } catch (error) {
console.error('Update failed:', error); console.error('Update failed:', error);
@@ -1416,8 +1417,8 @@
<div> <div>
<label for="editLibraryType">Medientyp</label> <label for="editLibraryType">Medientyp</label>
<select id="editLibraryType" style="width: 100%;"> <select id="editLibraryType" style="width: 100%;">
<option value="book">Buch</option> <option value="Buch">Buch</option>
<option value="schoolbook">Schulbuch</option> <option value="Schulbuch">Schulbuch</option>
<option value="cd">CD</option> <option value="cd">CD</option>
<option value="dvd">DVD</option> <option value="dvd">DVD</option>
<option value="other">Sonstige Medien</option> <option value="other">Sonstige Medien</option>
@@ -1451,14 +1452,14 @@
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; border-bottom: 1px solid #eee; padding-bottom: 10px;"> <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; border-bottom: 1px solid #eee; padding-bottom: 10px;">
<strong style="color: #0ea5e9;">Gruppen-Range (Total: <span id="editLibraryGroupCount"></span>)</strong> <strong style="color: #0ea5e9;">Gruppen-Range (Total: <span id="editLibraryGroupCount"></span>)</strong>
</div> </div>
<p style="margin: 5px 0; font-size: 12px; color: #555;"> <p style="margin: 5px 0; font-size: 12px; color: #555;">
Alle Codes in dieser Gruppe: Alle Codes in dieser Gruppe:
</p> </p>
<!-- Hier wird die Liste als Komma-Text eingefügt --> <!-- Hier wird die Liste als Komma-Text eingefügt -->
<div id="editLibraryAllCodes" style="font-family: monospace; font-size: 14px; font-weight: bold; color: #333; margin-top: 5px;"></div> <div id="editLibraryAllCodes" style="font-family: monospace; font-size: 14px; font-weight: bold; color: #333; margin-top: 5px;"></div>
<div style="margin-top: 15px; font-size: 11px; background: #e0f2fe; padding: 8px; border-radius: 4px;"> <div style="margin-top: 15px; font-size: 11px; background: #e0f2fe; padding: 8px; border-radius: 4px;">
<strong>Hinweis:</strong> Änderungen an Titel/Ort/Beschreibung werden auf <strong>alle</strong> Exemplare der Range übertragen. <strong>Hinweis:</strong> Änderungen an Titel/Ort/Beschreibung werden auf <strong>alle</strong> Exemplare der Range übertragen.
</div> </div>
+3 -3
View File
@@ -20,14 +20,14 @@
"key": "Web/certs/key.pem" "key": "Web/certs/key.pem"
}, },
"email": { "email": {
"enabled": false, "enabled": true,
"smtp_host": "smtp.gmail.com", "smtp_host": "",
"smtp_port": 587, "smtp_port": 587,
"use_tls": true, "use_tls": true,
"username": "", "username": "",
"password": "", "password": "",
"from_address": "", "from_address": "",
"default_sender_name": "Invario Inventarprogramm", "default_sender_name": "Invario Email Service",
"timeout_seconds": 30 "timeout_seconds": 30
}, },
"images": { "images": {
+2 -30
View File
@@ -82,7 +82,6 @@ while i < len(lines):
stripped = line.lstrip(" ") stripped = line.lstrip(" ")
indent = leading_spaces(line) indent = leading_spaces(line)
# Check if we're starting the app service
if not in_app_service and re.match(r"^\s*app:\s*$", line): if not in_app_service and re.match(r"^\s*app:\s*$", line):
in_app_service = True in_app_service = True
app_indent = indent app_indent = indent
@@ -92,9 +91,7 @@ while i < len(lines):
i += 1 i += 1
continue continue
# Check if we've exited the app service (found another top-level service)
if in_app_service and indent <= app_indent and re.match(r"^[A-Za-z0-9_-]+:\s*$", stripped): if in_app_service and indent <= app_indent and re.match(r"^[A-Za-z0-9_-]+:\s*$", stripped):
# We've left the app service - insert image if we haven't already
if build_found and app_service_indent is not None: if build_found and app_service_indent is not None:
out.append(f"{' ' * app_service_indent}image: {target_image}\n") out.append(f"{' ' * app_service_indent}image: {target_image}\n")
in_app_service = False in_app_service = False
@@ -102,24 +99,20 @@ while i < len(lines):
i += 1 i += 1
continue continue
# Process lines within the app service
if in_app_service: if in_app_service:
if app_service_indent is None and indent > app_indent: if app_service_indent is None and indent > app_indent:
app_service_indent = indent app_service_indent = indent
# Check for image key (already has an image, don't add)
if re.match(rf"^\s+image:\s*", line): if re.match(rf"^\s+image:\s*", line):
in_app_service = False in_app_service = False
out.append(line) out.append(line)
i += 1 i += 1
continue continue
# Check for build block
if re.match(rf"^\s+build:\s*$", line): if re.match(rf"^\s+build:\s*$", line):
build_found = True build_found = True
out.append(line) out.append(line)
i += 1 i += 1
# Skip all lines that are part of the build block (indented more than app_service_indent)
while i < len(lines): while i < len(lines):
next_line = lines[i] next_line = lines[i]
next_indent = leading_spaces(next_line) next_indent = leading_spaces(next_line)
@@ -130,12 +123,10 @@ while i < len(lines):
break break
continue continue
# Insert image after build block before first property
if build_found and app_service_indent is not None and indent == app_service_indent: if build_found and app_service_indent is not None and indent == app_service_indent:
# Check if this is a property line (not build)
if not re.match(rf"^\s+build:", line): if not re.match(rf"^\s+build:", line):
out.append(f"{' ' * app_service_indent}image: {target_image}\n") out.append(f"{' ' * app_service_indent}image: {target_image}\n")
build_found = False # Mark that we've inserted the image build_found = False
out.append(line) out.append(line)
i += 1 i += 1
@@ -144,7 +135,6 @@ while i < len(lines):
out.append(line) out.append(line)
i += 1 i += 1
# If we ended while still in the app service, append image at the end
if in_app_service and build_found and app_service_indent is not None: if in_app_service and build_found and app_service_indent is not None:
out.append(f"{' ' * app_service_indent}image: {target_image}\n") out.append(f"{' ' * app_service_indent}image: {target_image}\n")
@@ -377,18 +367,12 @@ with open(meta_file, 'r', encoding='utf-8') as f:
data = json.load(f) data = json.load(f)
tag = data.get('tag_name', '').strip() tag = data.get('tag_name', '').strip()
url = '' url = ''
image_url = ''
for asset in data.get('assets', []): for asset in data.get('assets', []):
if asset.get('name') == asset_name: if asset.get('name') == asset_name:
url = asset.get('browser_download_url', '').strip() url = asset.get('browser_download_url', '').strip()
break break
for asset in data.get('assets', []):
if asset.get('name') == f'inventarsystem-image-{tag}.tar.gz':
image_url = asset.get('browser_download_url', '').strip()
break
print(tag) print(tag)
print(url) print(url)
print(image_url)
PY PY
} }
@@ -401,7 +385,7 @@ main() {
need_cmd python3 need_cmd python3
need_cmd curl need_cmd curl
local meta_file tag bundle_url image_url local meta_file tag bundle_url
TMP_DIR="$(mktemp -d)" TMP_DIR="$(mktemp -d)"
meta_file="$TMP_DIR/release.json" meta_file="$TMP_DIR/release.json"
trap cleanup_tmp_dir EXIT trap cleanup_tmp_dir EXIT
@@ -409,7 +393,6 @@ main() {
mapfile -t release_info < <(latest_tag_and_bundle_url "$meta_file") mapfile -t release_info < <(latest_tag_and_bundle_url "$meta_file")
tag="${release_info[0]:-}" tag="${release_info[0]:-}"
bundle_url="${release_info[1]:-}" bundle_url="${release_info[1]:-}"
image_url="${release_info[2]:-}"
if [ -z "$tag" ] || [ -z "$bundle_url" ]; then if [ -z "$tag" ] || [ -z "$bundle_url" ]; then
echo "Error: latest release metadata is incomplete." echo "Error: latest release metadata is incomplete."
@@ -425,17 +408,6 @@ main() {
pin_compose_app_image "$tag" pin_compose_app_image "$tag"
if [ -z "$image_url" ]; then
echo "Error: release image asset is missing"
exit 1
fi
curl -fL "$image_url" -o "$TMP_DIR/inventarsystem-image-$tag.tar.gz"
sudo docker load -i "$TMP_DIR/inventarsystem-image-$tag.tar.gz" >/dev/null
# Tagge das geladene Gitea-Image als latest
sudo docker tag "git.invario-software.eu/invario/inventarsystem:$tag" "git.invario-software.eu/invario/inventarsystem:latest" >/dev/null 2>&1 || true
if [ ! -f "$PROJECT_DIR/start.sh" ]; then if [ ! -f "$PROJECT_DIR/start.sh" ]; then
echo "Error: release bundle is missing start.sh" echo "Error: release bundle is missing start.sh"
exit 1 exit 1
+3
View File
@@ -1,6 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
sudo find /tmp -maxdepth 1 -name "tmp.*" -exec rm -rf {} +
echo "Cleaning up old temporary files in /tmp..."
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
cd "$SCRIPT_DIR" cd "$SCRIPT_DIR"
+7 -44
View File
@@ -6,7 +6,6 @@ cd "$SCRIPT_DIR"
ENV_FILE="$SCRIPT_DIR/.docker-build.env" ENV_FILE="$SCRIPT_DIR/.docker-build.env"
APP_IMAGE_REPO="git.invario-software.eu/invario/inventarsystem" APP_IMAGE_REPO="git.invario-software.eu/invario/inventarsystem"
DIST_DIR="$SCRIPT_DIR/dist"
RUNTIME_COMPOSE_OVERRIDE_FILE="$SCRIPT_DIR/.docker-compose.runtime.override.yml" RUNTIME_COMPOSE_OVERRIDE_FILE="$SCRIPT_DIR/.docker-compose.runtime.override.yml"
SUDO="" SUDO=""
@@ -279,52 +278,19 @@ EOF
fi fi
} }
ensure_app_image_loaded() { ensure_app_image_ready() {
if docker image inspect "$APP_IMAGE_VALUE" >/dev/null 2>&1; then if docker image inspect "$APP_IMAGE_VALUE" >/dev/null 2>&1; then
return 0 return 0
fi fi
local image_archive echo "Attempting to pull registry image: $APP_IMAGE_VALUE"
image_archive="$(find_local_dist_image_archive || true)" if docker pull "$APP_IMAGE_VALUE" >/dev/null 2>&1; then
if [ -n "$image_archive" ]; then
echo "Loading app image from local dist artifact: $image_archive"
if docker load -i "$image_archive" >/dev/null 2>&1 && docker image inspect "$APP_IMAGE_VALUE" >/dev/null 2>&1; then
return 0
fi
echo "Warning: failed to load expected app image from $image_archive"
fi
echo "Error: local app image not found: $APP_IMAGE_VALUE"
echo "Run ./update.sh so the nightly updater loads the release image first."
exit 1
}
find_local_dist_image_archive() {
local tag archive
if [ ! -d "$DIST_DIR" ]; then
return 1
fi
tag="${APP_IMAGE_VALUE##*:}"
for archive in \
"$DIST_DIR/inventarsystem-image-$tag.tar.gz" \
"$DIST_DIR/inventarsystem-image-$tag.tar" \
"$DIST_DIR/inventarsystem-image.tar.gz" \
"$DIST_DIR/inventarsystem-image.tar"; do
if [ -f "$archive" ]; then
echo "$archive"
return 0
fi
done
archive="$(find "$DIST_DIR" -maxdepth 1 -type f \( -name 'inventarsystem-image-*.tar.gz' -o -name 'inventarsystem-image-*.tar' \) | sort | tail -n1)"
if [ -n "$archive" ]; then
echo "$archive"
return 0 return 0
fi fi
return 1 echo "Error: app image not found locally and pull failed: $APP_IMAGE_VALUE"
echo "Run ./update.sh to pull the latest release image from the registry."
exit 1
} }
configure_nuitka_mode() { configure_nuitka_mode() {
@@ -605,7 +571,6 @@ verify_stack_health() {
fi fi
compose_args+=(--env-file "$ENV_FILE") compose_args+=(--env-file "$ENV_FILE")
# Try health check with optional restart on first failure
while [[ $retry_count -lt 2 ]]; do while [[ $retry_count -lt 2 ]]; do
echo "Waiting for containers to become healthy... (attempt $((retry_count + 1))/2)" echo "Waiting for containers to become healthy... (attempt $((retry_count + 1))/2)"
for _ in $(seq 1 60); do for _ in $(seq 1 60); do
@@ -623,7 +588,6 @@ verify_stack_health() {
sleep 2 sleep 2
done done
# First failure: attempt recovery by restarting containers
if [[ $retry_count -eq 0 ]]; then if [[ $retry_count -eq 0 ]]; then
echo "Health check failed. Attempting to restart containers..." echo "Health check failed. Attempting to restart containers..."
docker compose "${compose_args[@]}" ps || true docker compose "${compose_args[@]}" ps || true
@@ -636,7 +600,6 @@ verify_stack_health() {
fi fi
done done
# Final failure
echo "Error: stack health check failed after restart attempt." echo "Error: stack health check failed after restart attempt."
docker compose "${compose_args[@]}" ps || true docker compose "${compose_args[@]}" ps || true
docker compose "${compose_args[@]}" logs --tail=120 app redis mongodb || true docker compose "${compose_args[@]}" logs --tail=120 app redis mongodb || true
@@ -654,7 +617,7 @@ resolve_app_image
configure_host_ports configure_host_ports
ensure_min_docker_disk_space ensure_min_docker_disk_space
detect_server_capacity detect_server_capacity
ensure_app_image_loaded ensure_app_image_ready
write_env_file write_env_file
write_runtime_compose_override write_runtime_compose_override
+31 -151
View File
@@ -2,7 +2,7 @@
set -euo pipefail set -euo pipefail
# Release-only updater for Docker deployment. # Release-only updater for Docker deployment.
# Updates are pulled exclusively from Gitea Releases assets. # Updates pull the deployment bundle from Gitea and the Docker Image via 'docker pull'.
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
LOG_DIR="$PROJECT_DIR/logs" LOG_DIR="$PROJECT_DIR/logs"
@@ -11,13 +11,10 @@ STATE_FILE="$PROJECT_DIR/.release-version"
REPO_SLUG="Invario/Inventarsystem" REPO_SLUG="Invario/Inventarsystem"
API_URL="https://git.invario-software.eu/api/v1/repos/$REPO_SLUG/releases/latest" API_URL="https://git.invario-software.eu/api/v1/repos/$REPO_SLUG/releases/latest"
BUNDLE_ASSET="inventarsystem-docker-bundle.tar.gz" BUNDLE_ASSET="inventarsystem-docker-bundle.tar.gz"
APP_IMAGE_ASSET_PREFIX="inventarsystem-image-"
ENV_FILE="$PROJECT_DIR/.docker-build.env" ENV_FILE="$PROJECT_DIR/.docker-build.env"
APP_IMAGE_REPO="git.invario-software.eu/invario/inventarsystem" APP_IMAGE_REPO="git.invario-software.eu/invario/inventarsystem"
DIST_DIR="$PROJECT_DIR/dist"
COMPOSE_FILE="docker-compose-multitenant.yml" COMPOSE_FILE="docker-compose-multitenant.yml"
MIN_ROOT_FREE_MB="${INVENTAR_MIN_ROOT_FREE_MB:-2048}" MIN_ROOT_FREE_MB="${INVENTAR_MIN_ROOT_FREE_MB:-2048}"
DIST_KEEP_COUNT="${INVENTAR_DIST_KEEP_COUNT:-2}"
MODE="release" MODE="release"
mkdir -p "$LOG_DIR" mkdir -p "$LOG_DIR"
@@ -109,36 +106,6 @@ ensure_min_root_disk_space() {
fi fi
} }
cleanup_old_dist_artifacts() {
local keep_count
keep_count="$DIST_KEEP_COUNT"
if [ ! -d "$DIST_DIR" ]; then
return 0
fi
if ! [[ "$keep_count" =~ ^[0-9]+$ ]]; then
keep_count=2
fi
mapfile -t archives < <(find "$DIST_DIR" -maxdepth 1 -type f \( -name 'inventarsystem-image-*.tar.gz' -o -name 'inventarsystem-image-*.tar' \) -printf '%T@ %p\n' | sort -nr | awk '{print $2}')
if [ "${#archives[@]}" -le "$keep_count" ]; then
return 0
fi
local index old_archive deleted=0
for (( index=keep_count; index<${#archives[@]}; index++ )); do
old_archive="${archives[$index]}"
if rm -f "$old_archive"; then
deleted=$((deleted + 1))
fi
done
if [ "$deleted" -gt 0 ]; then
log_message "Cleaned up $deleted old dist image archive(s)"
fi
}
cleanup_docker_dangling_images() { cleanup_docker_dangling_images() {
if docker image prune -f >> "$LOG_FILE" 2>&1; then if docker image prune -f >> "$LOG_FILE" 2>&1; then
log_message "Cleaned up dangling Docker images" log_message "Cleaned up dangling Docker images"
@@ -153,7 +120,6 @@ Usage: $0 [options]
Options: Options:
--multitenant Use docker-compose-multitenant.yml (default) --multitenant Use docker-compose-multitenant.yml (default)
development Install development build from Gitea Registry or local dist
-h, --help Show this help message -h, --help Show this help message
EOF EOF
} }
@@ -165,10 +131,6 @@ parse_args() {
COMPOSE_FILE="docker-compose-multitenant.yml" COMPOSE_FILE="docker-compose-multitenant.yml"
shift shift
;; ;;
development|dev)
MODE="development"
shift
;;
-h|--help) -h|--help)
usage usage
exit 0 exit 0
@@ -216,14 +178,12 @@ create_backup() {
} }
fetch_release_metadata() { fetch_release_metadata() {
local meta_file local meta_file="$1"
meta_file="$1"
curl -fsSL "$API_URL" -o "$meta_file" curl -fsSL "$API_URL" -o "$meta_file"
} }
parse_latest_tag() { parse_latest_tag() {
local meta_file local meta_file="$1"
meta_file="$1"
python3 - <<'PY' "$meta_file" python3 - <<'PY' "$meta_file"
import json, sys import json, sys
with open(sys.argv[1], 'r', encoding='utf-8') as f: with open(sys.argv[1], 'r', encoding='utf-8') as f:
@@ -233,9 +193,8 @@ PY
} }
parse_asset_url() { parse_asset_url() {
local meta_file asset_name local meta_file="$1"
meta_file="$1" local asset_name="$2"
asset_name="$2"
python3 - <<'PY' "$meta_file" "$asset_name" python3 - <<'PY' "$meta_file" "$asset_name"
import json, sys import json, sys
meta_file, asset_name = sys.argv[1], sys.argv[2] meta_file, asset_name = sys.argv[1], sys.argv[2]
@@ -248,31 +207,6 @@ for asset in data.get('assets', []):
PY PY
} }
load_release_image() {
local meta_file tag image_asset image_url tmp_dir archive
meta_file="$1"
tag="$2"
image_asset="${APP_IMAGE_ASSET_PREFIX}${tag}.tar.gz"
image_url="$(parse_asset_url "$meta_file" "$image_asset")"
if [ -z "$image_url" ]; then
log_message "ERROR: Release image asset not found: $image_asset"
return 1
fi
tmp_dir="$(mktemp -d)"
archive="$tmp_dir/$image_asset"
trap 'rm -rf "${tmp_dir:-}"' RETURN
log_message "Loading app image from release asset $image_asset"
curl -fL "$image_url" -o "$archive"
docker load -i "$archive" >> "$LOG_FILE" 2>&1
docker tag "$APP_IMAGE_REPO:$tag" "$APP_IMAGE_REPO:latest" >> "$LOG_FILE" 2>&1 || true
trap - RETURN
}
refresh_runtime_scripts_from_main() { refresh_runtime_scripts_from_main() {
local start_url stop_url restart_url update_url local start_url stop_url restart_url update_url
start_url="https://git.invario-software.eu/$REPO_SLUG/raw/branch/main/start.sh" start_url="https://git.invario-software.eu/$REPO_SLUG/raw/branch/main/start.sh"
@@ -285,61 +219,13 @@ refresh_runtime_scripts_from_main() {
curl -fsSL "$restart_url" -o "$PROJECT_DIR/restart.sh" || log_message "WARNING: Could not refresh restart.sh from main" curl -fsSL "$restart_url" -o "$PROJECT_DIR/restart.sh" || log_message "WARNING: Could not refresh restart.sh from main"
curl -fsSL "$update_url" -o "$PROJECT_DIR/update.sh" || log_message "WARNING: Could not refresh update.sh from main" curl -fsSL "$update_url" -o "$PROJECT_DIR/update.sh" || log_message "WARNING: Could not refresh update.sh from main"
chmod +x "$PROJECT_DIR/start.sh" "$PROJECT_DIR/stop.sh" "$PROJECT_DIR/restart.sh" "$PROJECT_DIR/update.sh" chmod +x "$PROJECT_DIR/start.sh" "$PROJECT_DIR/stop.sh" "$PROJECT_DIR/restart.sh" "$PROJECT_DIR/update.sh" 2>/dev/null || true
}
find_local_dist_image_archive() {
local tag="$1"
local archive
if [ ! -d "$DIST_DIR" ]; then
return 1
fi
for archive in \
"$DIST_DIR/inventarsystem-image-$tag.tar.gz" \
"$DIST_DIR/inventarsystem-image-$tag.tar" \
"$DIST_DIR/inventarsystem-image.tar.gz" \
"$DIST_DIR/inventarsystem-image.tar"; do
if [ -f "$archive" ]; then
echo "$archive"
return 0
fi
done
archive="$(find "$DIST_DIR" -maxdepth 1 -type f \( -name 'inventarsystem-image-*.tar.gz' -o -name 'inventarsystem-image-*.tar' \) | sort | tail -n1)"
if [ -n "$archive" ]; then
echo "$archive"
return 0
fi
return 1
}
load_local_dist_image() {
local tag="$1"
local archive
archive="$(find_local_dist_image_archive "$tag" || true)"
if [ -z "$archive" ]; then
return 1
fi
log_message "Loading app image from local dist artifact: $archive"
if docker load -i "$archive" >> "$LOG_FILE" 2>&1; then
docker tag "$APP_IMAGE_REPO:$tag" "$APP_IMAGE_REPO:latest" >> "$LOG_FILE" 2>&1 || true
return 0
fi
log_message "WARNING: Failed to load local dist artifact: $archive"
return 1
} }
download_and_extract_bundle() { download_and_extract_bundle() {
local url tmp_dir archive local url="$1"
url="$1" local tmp_dir="$2"
tmp_dir="$2" local archive="$tmp_dir/$BUNDLE_ASSET"
archive="$tmp_dir/$BUNDLE_ASSET"
curl -fL "$url" -o "$archive" curl -fL "$url" -o "$archive"
tar -xzf "$archive" -C "$tmp_dir" tar -xzf "$archive" -C "$tmp_dir"
@@ -375,19 +261,15 @@ download_and_extract_bundle() {
# Ensure executable permissions on all copied scripts # Ensure executable permissions on all copied scripts
chmod +x "$PROJECT_DIR/start.sh" "$PROJECT_DIR/stop.sh" "$PROJECT_DIR/restart.sh" "$PROJECT_DIR/update.sh" "$PROJECT_DIR/backup.sh" "$PROJECT_DIR/manage-tenant.sh" "$PROJECT_DIR/run-tenant-cmd.sh" 2>/dev/null || true chmod +x "$PROJECT_DIR/start.sh" "$PROJECT_DIR/stop.sh" "$PROJECT_DIR/restart.sh" "$PROJECT_DIR/update.sh" "$PROJECT_DIR/backup.sh" "$PROJECT_DIR/manage-tenant.sh" "$PROJECT_DIR/run-tenant-cmd.sh" 2>/dev/null || true
chmod +x "$PROJECT_DIR"/manage-tenant.sh "$PROJECT_DIR"/run-tenant-cmd.sh 2>/dev/null || true
if [ ! -f "$PROJECT_DIR/config.json" ] && [ -f "$tmp_dir/config.json" ]; then if [ ! -f "$PROJECT_DIR/config.json" ] && [ -f "$tmp_dir/config.json" ]; then
cp -f "$tmp_dir/config.json" "$PROJECT_DIR/config.json" cp -f "$tmp_dir/config.json" "$PROJECT_DIR/config.json"
log_message "Installed default config.json from release bundle" log_message "Installed default config.json from release bundle"
fi fi
chmod +x "$PROJECT_DIR/start.sh" "$PROJECT_DIR/stop.sh" "$PROJECT_DIR/restart.sh" "$PROJECT_DIR/update.sh" "$PROJECT_DIR/backup.sh" "$PROJECT_DIR/manage-tenant.sh" "$PROJECT_DIR/run-tenant-cmd.sh" 2>/dev/null || true
} }
deploy() { deploy() {
local tag="$1" local tag="$1"
local meta_file="$2"
local app_image="${APP_IMAGE_REPO}:${tag}" local app_image="${APP_IMAGE_REPO}:${tag}"
local compose_path local compose_path
@@ -410,17 +292,14 @@ EOF
printf '\nINVENTAR_APP_IMAGE=%s\n' "$app_image" >> "$ENV_FILE" printf '\nINVENTAR_APP_IMAGE=%s\n' "$app_image" >> "$ENV_FILE"
fi fi
if ! load_local_dist_image "$tag"; then log_message "Pulling Gitea Registry image $app_image"
if ! load_release_image "$meta_file" "$tag"; then if ! docker pull "$app_image" >> "$LOG_FILE" 2>&1; then
log_message "Falling back to tagged Gitea Registry image $app_image" log_message "Falling back to local Docker build for $app_image"
if ! docker pull "$app_image" >> "$LOG_FILE" 2>&1; then docker build -t "$app_image" "$PROJECT_DIR" >> "$LOG_FILE" 2>&1
log_message "Falling back to local Docker build for $app_image"
docker build -t "$app_image" "$PROJECT_DIR" >> "$LOG_FILE" 2>&1
fi
fi
fi fi
docker compose -f "$compose_path" --env-file "$ENV_FILE" pull app mongodb >> "$LOG_FILE" 2>&1 # Image wurde oben gepullt, Stack hochfahren
docker compose -f "$compose_path" --env-file "$ENV_FILE" pull mongodb redis >> "$LOG_FILE" 2>&1 || true
docker compose -f "$compose_path" --env-file "$ENV_FILE" up -d --remove-orphans >> "$LOG_FILE" 2>&1 docker compose -f "$compose_path" --env-file "$ENV_FILE" up -d --remove-orphans >> "$LOG_FILE" 2>&1
docker tag "$app_image" "$APP_IMAGE_REPO:latest" >> "$LOG_FILE" 2>&1 || true docker tag "$app_image" "$APP_IMAGE_REPO:latest" >> "$LOG_FILE" 2>&1 || true
} }
@@ -460,9 +339,12 @@ cleanup_server_space() {
else else
log_message "WARNING: Docker system prune failed" log_message "WARNING: Docker system prune failed"
fi fi
# Clean up old dist artifacts # Delete legacy dist folder if it exists
cleanup_old_dist_artifacts if [ -d "$PROJECT_DIR/dist" ]; then
# Clean up log files older than 7 days rm -rf "$PROJECT_DIR/dist" || true
log_message "Legacy dist folder removed"
fi
# Clean up old log files older than 7 days
if find "$LOG_DIR" -type f -name '*.log' -mtime +7 -exec rm -f {} +; then if find "$LOG_DIR" -type f -name '*.log' -mtime +7 -exec rm -f {} +; then
log_message "Old log files (older than 7 days) cleaned up" log_message "Old log files (older than 7 days) cleaned up"
else else
@@ -511,17 +393,14 @@ EOF
printf '\nINVENTAR_APP_IMAGE=%s\n' "$app_image" >> "$ENV_FILE" printf '\nINVENTAR_APP_IMAGE=%s\n' "$app_image" >> "$ENV_FILE"
fi fi
# Try local dist first, then pull from Gitea Registry log_message "Attempting to pull development image $app_image"
if ! load_local_dist_image "$tag"; then if ! docker pull "$app_image" >> "$LOG_FILE" 2>&1; then
log_message "Attempting to pull development image $app_image" log_message "ERROR: Could not obtain development image $app_image"
if ! docker pull "$app_image" >> "$LOG_FILE" 2>&1; then exit 1
log_message "ERROR: Could not obtain development image $app_image"
exit 1
fi
fi fi
# Bring up stack # Bring up stack
docker compose -f "$compose_path" --env-file "$ENV_FILE" pull app mongodb >> "$LOG_FILE" 2>&1 || true docker compose -f "$compose_path" --env-file "$ENV_FILE" pull mongodb redis >> "$LOG_FILE" 2>&1 || true
docker compose -f "$compose_path" --env-file "$ENV_FILE" up -d --remove-orphans >> "$LOG_FILE" 2>&1 docker compose -f "$compose_path" --env-file "$ENV_FILE" up -d --remove-orphans >> "$LOG_FILE" 2>&1
if ! verify_stack_health; then if ! verify_stack_health; then
@@ -581,7 +460,7 @@ EOF
if [ "$current_tag" = "$latest_tag" ]; then if [ "$current_tag" = "$latest_tag" ]; then
log_message "Already on latest release ($latest_tag). Refreshing containers from prebuilt image." log_message "Already on latest release ($latest_tag). Refreshing containers from prebuilt image."
deploy "$latest_tag" "$meta_file" deploy "$latest_tag"
if verify_stack_health; then if verify_stack_health; then
log_message "Container refresh completed" log_message "Container refresh completed"
else else
@@ -611,18 +490,19 @@ EOF
log_message "Updating from release $latest_tag" log_message "Updating from release $latest_tag"
download_and_extract_bundle "$bundle_url" "$tmp_dir" download_and_extract_bundle "$bundle_url" "$tmp_dir"
refresh_runtime_scripts_from_main refresh_runtime_scripts_from_main
deploy "$latest_tag" "$meta_file" deploy "$latest_tag"
if ! verify_stack_health; then if ! verify_stack_health; then
log_message "ERROR: Updated stack failed health check" log_message "ERROR: Updated stack failed health check"
exit 1 exit 1
fi fi
echo "$latest_tag" > "$STATE_FILE" echo "$latest_tag" > "$STATE_FILE"
cleanup_old_dist_artifacts
cleanup_docker_dangling_images cleanup_docker_dangling_images
log_message "Update completed successfully to release $latest_tag" log_message "Update completed successfully to release $latest_tag"
sudo ./opt/Inventarsystem/restart.sh if [ -x "./opt/Inventarsystem/restart.sh" ]; then
sudo ./opt/Inventarsystem/restart.sh
fi
echo "Restart of the Server Completed" echo "Restart of the Server Completed"
} }