Commit 8498e546 by Chif Gergő

Run asgi in a different container in production

parent f1869ef5
...@@ -9,8 +9,8 @@ EXPOSE 8000/tcp ...@@ -9,8 +9,8 @@ EXPOSE 8000/tcp
COPY Pipfile* .env ./ COPY Pipfile* .env ./
# This env variable needed to pipenv find .env file # This env variable needed to pipenv find .env file
ENV PIPENV_DOTENV_LOCATION=/usr/cloud/portal/.env ENV PIPENV_DOTENV_LOCATION=/usr/cloud/portal/.env
# Install dependencies # Install dependencies
RUN pipenv install RUN pipenv install -d
# Copy sources # Copy sources
COPY ./recircle ./recircle COPY ./recircle ./recircle
# Set working dir where the manage.py found # Set working dir where the manage.py found
......
...@@ -10,7 +10,7 @@ COPY Pipfile* .env ./ ...@@ -10,7 +10,7 @@ COPY Pipfile* .env ./
# This env variable needed to pipenv find .env file # This env variable needed to pipenv find .env file
ENV PIPENV_DOTENV_LOCATION=/usr/cloud/portal/.env ENV PIPENV_DOTENV_LOCATION=/usr/cloud/portal/.env
# Install dependencies # Install dependencies
RUN pipenv install -d RUN pipenv install
# Copy sources # Copy sources
COPY ./recircle ./recircle COPY ./recircle ./recircle
# Set working dir where the manage.py found # Set working dir where the manage.py found
......
...@@ -2,6 +2,10 @@ upstream recircle { ...@@ -2,6 +2,10 @@ upstream recircle {
server backend:8000; server backend:8000;
} }
upstream wsbackend {
server daphne-server:8001;
}
server { server {
listen 80; listen 80;
...@@ -20,6 +24,14 @@ server { ...@@ -20,6 +24,14 @@ server {
proxy_redirect off; 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/ { location /static/ {
alias /static/; alias /static/;
......
...@@ -54,5 +54,19 @@ services: ...@@ -54,5 +54,19 @@ services:
- db - db
- redis - 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: networks:
backend: 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