switch kubernetes deployment to daphne server

This commit is contained in:
Jens Langhammer 2019-04-10 22:38:25 +02:00
parent c9ac10f6f6
commit 11630c9a74
4 changed files with 18 additions and 3 deletions

View file

@ -6,7 +6,7 @@ COPY ./requirements.txt /app/
WORKDIR /app/ WORKDIR /app/
RUN apt-get update && apt-get install build-essential libssl-dev libffi-dev -y && \ RUN apt-get update && apt-get install build-essential libssl-dev libffi-dev libpq-dev -y && \
mkdir /app/static/ && \ mkdir /app/static/ && \
pip install -r requirements.txt && \ pip install -r requirements.txt && \
pip install psycopg2 && \ pip install psycopg2 && \
@ -23,7 +23,7 @@ COPY --from=build /app/static /app/static/
WORKDIR /app/ WORKDIR /app/
RUN apt-get update && apt-get install build-essential libssl-dev libffi-dev -y && \ RUN apt-get update && apt-get install build-essential libssl-dev libffi-dev libpq-dev -y && \
pip install -r requirements.txt && \ pip install -r requirements.txt && \
pip install psycopg2 && \ pip install psycopg2 && \
adduser --system --home /app/ passbook && \ adduser --system --home /app/ passbook && \

View file

@ -29,7 +29,7 @@ spec:
image: "docker.pkg.beryju.org/passbook:{{ .Values.image.tag }}" image: "docker.pkg.beryju.org/passbook:{{ .Values.image.tag }}"
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
command: ["/bin/sh","-c"] command: ["/bin/sh","-c"]
args: ["./manage.py migrate && ./manage.py web"] args: ["./manage.py migrate && daphne -p 8000 passbook.core.asgi:application"]
ports: ports:
- name: http - name: http
containerPort: 8000 containerPort: 8000

View file

@ -3,3 +3,5 @@ urllib3[secure]
channels channels
service_identity service_identity
websocket-client websocket-client
daphne<2.3.0
asgiref~=2.3

13
passbook/core/asgi.py Normal file
View file

@ -0,0 +1,13 @@
"""
ASGI entrypoint. Configures Django and then runs the application
defined in the ASGI_APPLICATION setting.
"""
import os
import django
from channels.routing import get_default_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "passbook.core.settings")
django.setup()
application = get_default_application()