Commit 8498e546 by Chif Gergő

Run asgi in a different container in production

parent f1869ef5
......@@ -9,8 +9,8 @@ EXPOSE 8000/tcp
COPY Pipfile* .env ./
# This env variable needed to pipenv find .env file
ENV PIPENV_DOTENV_LOCATION=/usr/cloud/portal/.env
# Install dependencies
RUN pipenv install
# Install dependencies
RUN pipenv install -d
# Copy sources
COPY ./recircle ./recircle
# Set working dir where the manage.py found
......
......@@ -10,7 +10,7 @@ COPY Pipfile* .env ./
# This env variable needed to pipenv find .env file
ENV PIPENV_DOTENV_LOCATION=/usr/cloud/portal/.env
# Install dependencies
RUN pipenv install -d
RUN pipenv install
# Copy sources
COPY ./recircle ./recircle
# Set working dir where the manage.py found
......
......@@ -2,6 +2,10 @@ upstream recircle {
server backend:8000;
}
upstream wsbackend {
server daphne-server:8001;
}
server {
listen 80;
......@@ -20,6 +24,14 @@ server {
proxy_redirect off;
}
location /ws/ {
proxy_pass http://wsbackend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
location /static/ {
alias /static/;
......
......@@ -54,5 +54,19 @@ services:
- db
- redis
daphne-server:
build:
context: .
dockerfile: ./Dockerfile.prod
command: pipenv run daphne -b 0.0.0.0 -p 8001 recircle.asgi:application
expose:
- "8001"
networks:
- backend
depends_on:
- backend
- db
- redis
networks:
backend:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment