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 \
wget \
gettext \
curl \
&& rm -rf /var/lib/apt/lists* \
&& :

View file

@ -34,16 +34,27 @@ services:
backend:
<<: *x-django
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8000/healthz/"]
interval: 5s
timeout: 2s
retries: 10
start_interval: 10s
ports:
- "8000:8000"
dramatiq:
<<: *x-django
command: ["/app/scripts/run-dramatiq.sh"]
depends_on:
backend:
condition: service_healthy
scheduler:
<<: *x-django
command: [ "/app/scripts/run-scheduler.sh" ]
depends_on:
- dramatiq
gotenberg:
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.http import HttpRequest
from django.http import HttpResponse
from django.http import JsonResponse
from django.shortcuts import render
from django.urls import include
from django.urls import path
@ -11,7 +12,7 @@ def landing_page(req: HttpRequest) -> HttpResponse:
return render(req, 'facturio/index.html')
urlpatterns = i18n_patterns(
app_patterns = i18n_patterns(
path('', landing_page, name='main-page'),
path('accounts/', include('accounts.urls')),
path('subjects/', include('subjects.urls')),
@ -19,3 +20,6 @@ urlpatterns = i18n_patterns(
path('admin/', admin.site.urls),
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..."
./manage.py migrate --no-input
#echo "Checking for errors..."
#./manage.py check --deploy --fail-level WARNING
echo "Checking for errors..."
./manage.py check --deploy --fail-level WARNING
uvicorn \
--host 0.0.0.0 \