working healthcheck (ready to merge)

This commit is contained in:
Jakub Kropáček 2025-03-03 22:20:55 +01:00
parent b09e1b556b
commit 2707655815
4 changed files with 19 additions and 3 deletions

View file

@ -17,6 +17,7 @@ RUN : \
gnupg \ gnupg \
wget \ wget \
gettext \ gettext \
curl \
&& rm -rf /var/lib/apt/lists* \ && rm -rf /var/lib/apt/lists* \
&& : && :

View file

@ -34,16 +34,27 @@ services:
backend: backend:
<<: *x-django <<: *x-django
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8000/healthz/"]
interval: 5s
timeout: 2s
retries: 10
start_interval: 10s
ports: ports:
- "8000:8000" - "8000:8000"
dramatiq: dramatiq:
<<: *x-django <<: *x-django
command: ["/app/scripts/run-dramatiq.sh"] command: ["/app/scripts/run-dramatiq.sh"]
depends_on:
backend:
condition: service_healthy
scheduler: scheduler:
<<: *x-django <<: *x-django
command: [ "/app/scripts/run-scheduler.sh" ] command: [ "/app/scripts/run-scheduler.sh" ]
depends_on:
- dramatiq
gotenberg: gotenberg:
image: gotenberg/gotenberg:8 image: gotenberg/gotenberg:8

View file

@ -2,6 +2,7 @@ from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin from django.contrib import admin
from django.http import HttpRequest from django.http import HttpRequest
from django.http import HttpResponse from django.http import HttpResponse
from django.http import JsonResponse
from django.shortcuts import render from django.shortcuts import render
from django.urls import include from django.urls import include
from django.urls import path from django.urls import path
@ -11,7 +12,7 @@ def landing_page(req: HttpRequest) -> HttpResponse:
return render(req, 'facturio/index.html') return render(req, 'facturio/index.html')
urlpatterns = i18n_patterns( app_patterns = i18n_patterns(
path('', landing_page, name='main-page'), path('', landing_page, name='main-page'),
path('accounts/', include('accounts.urls')), path('accounts/', include('accounts.urls')),
path('subjects/', include('subjects.urls')), path('subjects/', include('subjects.urls')),
@ -19,3 +20,6 @@ urlpatterns = i18n_patterns(
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
prefix_default_language=False, prefix_default_language=False,
) )
urlpatterns = [
path('healthz/', lambda _: JsonResponse(dict(status='Alive'))),
] + app_patterns

View file

@ -11,8 +11,8 @@ echo "Compiling messages..."
echo "Migrating..." echo "Migrating..."
./manage.py migrate --no-input ./manage.py migrate --no-input
#echo "Checking for errors..." echo "Checking for errors..."
#./manage.py check --deploy --fail-level WARNING ./manage.py check --deploy --fail-level WARNING
uvicorn \ uvicorn \
--host 0.0.0.0 \ --host 0.0.0.0 \