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/
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/ && \
pip install -r requirements.txt && \
pip install psycopg2 && \
@ -23,7 +23,7 @@ COPY --from=build /app/static /app/static/
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 psycopg2 && \
adduser --system --home /app/ passbook && \

View File

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

View File

@ -3,3 +3,5 @@ urllib3[secure]
channels
service_identity
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()