Compare commits

..

3 Commits

Author SHA1 Message Date
27e78d6f39 New images in Dockerfile
Some checks failed
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 6s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 6s
SonarQube Scan / SonarQube Trigger (push) Failing after 9s
2026-02-05 12:41:29 +01:00
ad9d55e986 Version tag now pulled from configmap
Some checks failed
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 30s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 8s
SonarQube Scan / SonarQube Trigger (push) Failing after 12s
2026-01-27 13:11:51 +01:00
996ea628c7 Another attempt at serving media files 2026-01-27 13:03:54 +01:00
8 changed files with 45 additions and 6 deletions

View File

@@ -1,13 +1,17 @@
FROM python:3.15-rc-trixie AS baustelle
FROM python:3.15.0a5-trixie AS baustelle
RUN mkdir /app
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
RUN pip install --upgrade pip
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt && \
apt-get update && \
apt-get install -y curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
FROM python:3.15-rc-slim-trixie
FROM python:3.15.0a5-slim-trixie
RUN useradd -m -r -u 99 appuser && \
mkdir /app && \
chown -R appuser /app
@@ -35,5 +39,8 @@ RUN rm -rvf /app/Dockerfile* \
/app/scripts \
/app/test_*.py && \
python3 /app/manage.py collectstatic --noinput
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/ || exit 1
CMD ["gunicorn","--bind","0.0.0.0:8000","--workers","3","VorgabenUI.wsgi:application"]

View File

@@ -0,0 +1,5 @@
from django.conf import settings
def version(request):
return {'version': settings.VERSION}

View File

@@ -23,6 +23,9 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.environ.get('DEBUG', 'True').lower() in ('true', '1', 'yes', 'on')
# Application version (from ConfigMap)
VERSION = os.environ.get('VERSION', '0.0.0')
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get('VORGABENUI_SECRET')
if not SECRET_KEY:
@@ -94,6 +97,7 @@ TEMPLATES = [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'VorgabenUI.context_processors.version',
],
},
},

View File

@@ -41,7 +41,12 @@ urlpatterns = [
]
# Serve media files (including cached diagrams)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# django.conf.urls.static.static() is a no-op when DEBUG=False,
# so we wire up the serve view directly for media files.
from django.views.static import serve
urlpatterns += [
re_path(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}),
]
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

View File

@@ -13,9 +13,12 @@ data:
LANGUAGE_CODE: "de-ch"
TIME_ZONE: "UTC"
# Static and Media Configuration
# Static and Media Configuration
STATIC_URL: "/static/"
MEDIA_URL: "/media/"
# Application Version
VERSION: "0.987"
# Database Configuration (for future use)
# DATABASE_ENGINE: "django.db.backends.sqlite3"

View File

@@ -27,7 +27,7 @@ spec:
mountPath: /data
containers:
- name: web
image: git.baumann.gr/adebaumann/vui:0.986
image: git.baumann.gr/adebaumann/vui:0.987
imagePullPolicy: Always
securityContext:
runAsUser: 99
@@ -54,6 +54,11 @@ spec:
configMapKeyRef:
name: django-config
key: DJANGO_SETTINGS_MODULE
- name: VERSION
valueFrom:
configMapKeyRef:
name: django-config
key: VERSION
ports:
- containerPort: 8000
volumeMounts:

View File

@@ -36,10 +36,15 @@ NEW_MAIN_VERSION=$(echo "$MAIN_VERSION + 0.001" | bc | sed 's/^\./0./')
sed -i "s|image: git.baumann.gr/adebaumann/labhelper-data-loader:$LOADER_VERSION|image: git.baumann.gr/adebaumann/labhelper-data-loader:$NEW_LOADER_VERSION|" "$DEPLOYMENT_FILE"
sed -i "s|image: git.baumann.gr/adebaumann/labhelper:$MAIN_VERSION|image: git.baumann.gr/adebaumann/labhelper:$NEW_MAIN_VERSION|" "$DEPLOYMENT_FILE"
# Update the configmap version to match the main container
CONFIGMAP_FILE="argocd/configmap.yaml"
sed -i "s|VERSION: \"$MAIN_VERSION\"|VERSION: \"$NEW_MAIN_VERSION\"|" "$CONFIGMAP_FILE"
# Copy database
cp "$DB_SOURCE" "$DB_DEST"
echo "Full deployment prepared:"
echo " Data loader: $LOADER_VERSION -> $NEW_LOADER_VERSION"
echo " Main container: $MAIN_VERSION -> $NEW_MAIN_VERSION"
echo " ConfigMap VERSION: $NEW_MAIN_VERSION"
echo " Database copied to $DB_DEST"

View File

@@ -23,5 +23,10 @@ NEW_VERSION=$(echo "$CURRENT_VERSION + 0.001" | bc | sed 's/^\./0./')
# Update the deployment file (only the main container, not the data-loader)
sed -i "s|image: git.baumann.gr/adebaumann/vui:$CURRENT_VERSION|image: git.baumann.gr/adebaumann/vui:$NEW_VERSION|" "$DEPLOYMENT_FILE"
# Update the configmap version to match the main container
CONFIGMAP_FILE="argocd/configmap.yaml"
sed -i "s|VERSION: \"$CURRENT_VERSION\"|VERSION: \"$NEW_VERSION\"|" "$CONFIGMAP_FILE"
echo "Partial deployment prepared:"
echo " Main container: $CURRENT_VERSION -> $NEW_VERSION"
echo " ConfigMap VERSION: $NEW_VERSION"