Ajoute le déploiement continu sur prism-test
Deploy test / deploy (push) Failing after 1m13s

- .gitea/workflows/deploy-test.yaml : à chaque push sur main, publie
  les images sur Harbor, met à jour les pods du namespace prism-test
  (kubectl set image), attend le rollout et contrôle le site
- settings : base de données via DB_* (à défaut de DATABASE_URL),
  fichiers statiques servis par WhiteNoise, HTTPS derrière le proxy
- Dockerfile : collectstatic à la construction de l'image
- dépendance whitenoise, README : section Déploiement

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
boris.waaubandClaude Sonnet 5.5 committed 2026-11-24 16:24:26 +01:00
1 parent 73e67b9fde
commit b552b9240f
6 files changed
+157 -1

No files matched your search

+4
View File
@@ -17,6 +17,10 @@ RUN uv sync --locked $UV_SYNC_ARGS
COPY . .
# Fichiers statiques (admin Django, schéma OpenAPI) servis par WhiteNoise.
RUN SECRET_KEY=build DEBUG=False ALLOWED_HOSTS=localhost CSRF_TRUSTED_ORIGINS=http://localhost \
DATABASE_URL=sqlite:////tmp/build.db python manage.py collectstatic --noinput
RUN useradd --system --uid 1000 prism && chown -R prism /app
USER prism
+22 -1
View File
@@ -40,6 +40,7 @@ INSTALLED_APPS = [
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
@@ -68,7 +69,20 @@ TEMPLATES = [
},
]
DATABASES = {"default": env.db("DATABASE_URL")}
# DATABASE_URL (développement, tests) ou, à défaut, les variables DB_* du déploiement.
if env("DATABASE_URL", default=""):
DATABASES = {"default": env.db("DATABASE_URL")}
else:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": env("DB_NAME"),
"USER": env("DB_USER"),
"PASSWORD": env("DB_PASSWORD"),
"HOST": env("DB_HOST"),
"PORT": env("DB_PORT", default="5432"),
}
}
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
# Authentification -----------------------------------------------------------
@@ -124,6 +138,13 @@ USE_TZ = True
STATIC_URL = "static/"
STATIC_ROOT = BASE_DIR / "staticfiles"
STORAGES = {
"default": {"BACKEND": "django.core.files.storage.FileSystemStorage"},
"staticfiles": {"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage"},
}
# Derrière l'Ingress et nginx : le schéma d'origine arrive dans X-Forwarded-Proto.
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
# E-mails --------------------------------------------------------------------
+2
View File
@@ -17,6 +17,7 @@ dependencies = [
"django-simple-history~=3.8",
"httpx~=0.28",
"gunicorn~=23.0",
"whitenoise~=6.9",
]
[dependency-groups]
@@ -48,3 +49,4 @@ DJANGO_SETTINGS_MODULE = "config.settings"
testpaths = ["tests"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
filterwarnings = ["ignore:No directory at:UserWarning"]
+11
View File
@@ -330,6 +330,7 @@ dependencies = [
{ name = "httpx" },
{ name = "psycopg", extra = ["binary"] },
{ name = "qrcode" },
{ name = "whitenoise" },
]
[package.dev-dependencies]
@@ -354,6 +355,7 @@ requires-dist = [
{ name = "httpx", specifier = "~=0.28" },
{ name = "psycopg", extras = ["binary"], specifier = "~=3.2" },
{ name = "qrcode", specifier = "~=8.0" },
{ name = "whitenoise", specifier = "~=6.9" },
]
[package.metadata.requires-dev]
@@ -610,3 +612,12 @@ sdist = { url = "https://files.pythonhosted.org/packages/98/60/f174043244c5306c9
wheels = [
{ url = "https://files.pythonhosted.org/packages/a9/99/3ae339466c9183ea5b8ae87b34c0b897eda475d2aec2307cae60e5cd4f29/uritemplate-4.2.0-py3-none-any.whl", hash = "sha256:962201ba1c4edcab02e60f9a0d3821e82dfc5d2d6662a21abd533879bdb8a686", size = 11488, upload-time = "2025-06-02T15:12:03.405Z" },
]
[[package]]
name = "whitenoise"
version = "6.12.0"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/cb/2a/55b3f3a4ec326cd077c1c3defeee656b9298372a69229134d930151acd01/whitenoise-6.12.0.tar.gz", hash = "sha256:f723ebb76a112e98816ff80fcea0a6c9b8ecde835f8ddda25df7a30a3c2db6ad", size = 26841, upload-time = "2026-02-27T00:05:42.028Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/db/eb/d5583a11486211f3ebd4b385545ae787f32363d453c19fffd81106c9c138/whitenoise-6.12.0-py3-none-any.whl", hash = "sha256:fc5e8c572e33ebf24795b47b6a7da8da3c00cff2349f5b04c02f28d0cc5a3cc2", size = 20302, upload-time = "2026-02-27T00:05:40.086Z" },
]