Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare upgrade to Django 4.2 #362

Merged
merged 15 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ COPY --from=backend-build /usr/local/bin/uwsgi /usr/local/bin/uwsgi
# Stage 3.2 - Copy source code
WORKDIR /app
COPY ./bin/docker_start.sh /start.sh
COPY ./bin/celery_worker.sh /celery_worker.sh
RUN mkdir /app/log /app/config

# copy frontend build statics
Expand Down
23 changes: 23 additions & 0 deletions bin/celery_worker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

LOGLEVEL=${CELERY_LOGLEVEL:-INFO}
CONCURRENCY=${CELERY_WORKER_CONCURRENCY:-1}

QUEUE=${1:-${CELERY_WORKER_QUEUE:=celery}}
WORKER_NAME=${2:-${CELERY_WORKER_NAME:="${QUEUE}"@%n}}

_binary=$(which celery)

if [[ "$ENABLE_COVERAGE" ]]; then
_binary="coverage run $_binary"
fi

echo "Starting celery worker $WORKER_NAME with queue $QUEUE"
exec $_binary --workdir src --app objects.celery worker \
-Q $QUEUE \
-n $WORKER_NAME \
-l $LOGLEVEL \
-O fair \
-c $CONCURRENCY
21 changes: 18 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ services:
- POSTGRES_USER=${DB_USER:-objects}
- POSTGRES_PASSWORD=${DB_PASSWORD:-objects}

redis:
image: redis:7
command: ["redis-server", "--appendonly", "yes"]

web:
build: .
environment:
build: &web_build
context: .
environment: &web_env
- DJANGO_SETTINGS_MODULE=objects.conf.docker
- SECRET_KEY=${SECRET_KEY:-1(@f(-6s_u(5fd&1sg^uvu2s(c-9sapw)1era8q&)g)h@cwxxg}
- OBJECTS_SUPERUSER_USERNAME=admin
Expand All @@ -22,8 +27,18 @@ services:
- 8000:8000
depends_on:
- db
volumes:
- redis
annashamray marked this conversation as resolved.
Show resolved Hide resolved
volumes: &web_volumes
- media:/app/media # Shared media volume to get access to saved OAS files

celery:
build: *web_build
environment: *web_env
command: /celery_worker.sh
depends_on:
- db
- redis
volumes: *web_volumes

volumes:
media:
6 changes: 0 additions & 6 deletions docs/installation/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ Other settings
sent to the Notificaties API for operations on the Object endpoint.
Defaults to ``True`` for the ``dev`` environment, otherwise defaults to ``False``.

* ``TWO_FACTOR_FORCE_OTP_ADMIN``: Enforce 2 Factor Authentication in the admin or not.
Viicos marked this conversation as resolved.
Show resolved Hide resolved
Default ``True``. You'll probably want to disable this when using OIDC.

* ``TWO_FACTOR_PATCH_ADMIN``: Whether to use the 2 Factor Authentication login flow for
the admin or not. Default ``True``. You'll probably want to disable this when using OIDC.

Viicos marked this conversation as resolved.
Show resolved Hide resolved
* ``USE_X_FORWARDED_HOST``: whether to grab the domain/host from the ``X-Forwarded-Host``
header or not. This header is typically set by reverse proxies (such as nginx,
traefik, Apache...). Default ``False`` - this is a header that can be spoofed and you
Expand Down
9 changes: 5 additions & 4 deletions requirements/base.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Core python libraries
celery
glom # data represenation based on spec
Pillow # handle images
psycopg2 # database driver
Expand All @@ -8,13 +9,12 @@ python-decouple # processing of envvar configs
jsonschema

# Framework libraries
django~=3.2
django~=4.2
django-admin-index
django-axes
django-redis
django-rosetta
maykin-django-two-factor-auth
maykin-django-two-factor-auth[phonenumbers]
maykin-2fa
mozilla-django-oidc-db

# API libraries
Expand All @@ -30,5 +30,6 @@ sentry-sdk # error monitoring
elastic-apm # Elastic APM integration

# Common ground libraries
vng-api-common[markdown_docs]>=1.6.4
notifications-api-common
commonground-api-common[markdown_docs]
annashamray marked this conversation as resolved.
Show resolved Hide resolved
zgw-consumers # external api auths
Loading
Loading