Compare commits

..

No commits in common. "a7b875211915f5e2c3cec07317c2894a71be15c9" and "4fc1ca9eedbf824cd82b980f49bed28b6cd32ba0" have entirely different histories.

5 changed files with 63 additions and 21 deletions

View File

@ -1,21 +1,17 @@
FROM python:3.9-slim FROM python:3.7-slim
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
WORKDIR /konova WORKDIR /konova
# Install some dependencies # Install some dependencies
RUN apt update RUN apt update
RUN apt install -y gdal-bin redis-server nginx RUN apt install -y gdal-bin
# Copy requirements file into workspace and install all dependencies # Copy requirements file into workspace
COPY ./requirements.txt /konova/ COPY ./requirements.txt /konova/
RUN pip install --upgrade pip RUN pip install --upgrade pip
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
# Remove nginx default configuration and replace with own configuration
RUN rm /etc/nginx/sites-enabled/default
COPY ./nginx.conf /etc/nginx/conf.d
# Copy rest of project into workspace # Copy rest of project into workspace
COPY . /konova/ COPY . /konova/

View File

@ -1,34 +1,83 @@
version: '3.3' version: '3.3'
services: services:
redis:
image: redis
container_name: "konova-redis-cache"
volumes:
- /redis/data:/bitnami/redis/data
environment:
- REDIS_PASSWORD=CHANGE_ME
konova: konova:
external_links: external_links:
- postgis:db - postgis:db
- arnova-nginx-server:arnova - arnova-nginx-server:arnova
build: . build: .
container_name: "konova-docker" container_name: "konova-docker"
command: ./docker-entrypoint.sh command: gunicorn konova.wsgi:application --bind 0.0.0.0:8000
restart: always
volumes: volumes:
- .:/konova - .:/konova
- /data/apps/konova/uploaded_files:/konova_uploaded_files - konova_uploaded_files:/konova_uploaded_files
ports: - static_file_volume:/konova/static # Point to the volume for static files. Shared with nginx service
- "1337:80" expose:
- 8000
depends_on:
- redis
environment: environment:
- POSTGRES_NAME=konova - POSTGRES_NAME=konova
- POSTGRES_PORT=5432 - POSTGRES_PORT=5432
- POSTGRES_PASSWORD=CHANGE_ME - POSTGRES_PASSWORD=CHANGE_ME
- POSTGRES_USER=konova - POSTGRES_USER=konova
- POSTGRES_HOST=db - POSTGRES_HOST=db
- REDIS_HOST=localhost - REDIS_HOST=redis
- SSO_HOST=CHANGE_ME_TO_SSO_HOST_URL - SSO_HOST=CHANGE_ME_TO_SSO_HOST_URL
- SMTP_HOST=172.17.0.1 - SMTP_HOST=172.17.0.1
- SMTP_PORT=25 - SMTP_PORT=25
- SMTP_REAL_REPLY_MAIL=ksp-servicestelle@sgdnord.rlp.de - SMTP_REAL_REPLY_MAIL=ksp-servicestelle@sgdnord.rlp.de
# To provide a celery worker instance, we need to add the celery worker as an own service
celery_worker:
external_links:
- postgis:db
- arnova-nginx-server:arnova
build: .
container_name: "konova-worker-docker"
command: celery -A konova worker -l INFO
volumes:
- .:/konova
- konova_uploaded_files:/konova_uploaded_files
depends_on:
- konova
environment:
- POSTGRES_NAME=konova
- POSTGRES_PORT=5432
- POSTGRES_PASSWORD=CHANGE_ME
- POSTGRES_USER=konova
- POSTGRES_HOST=db
- REDIS_HOST=redis
- SSO_HOST=CHANGE_ME_TO_SSO_HOST_URL
- SMTP_HOST=172.17.0.1
- SMTP_PORT=25
- SMTP_REAL_REPLY_MAIL=ksp-servicestelle@sgdnord.rlp.de
nginx:
build: ./nginx
container_name: "konova-nginx-server"
ports:
- "1337:80"
depends_on:
- konova
volumes:
- static_file_volume:/konova/static # Point to the volume for static files. Shared with konova service
# Instead of an own, new network, we need to connect to the existing one, which is provided by the postgis container # Instead of an own, new network, we need to connect to the existing one, which is provided by the postgis container
# NOTE: THIS NETWORK MUST EXIST # NOTE: THIS NETWORK MUST EXIST
networks: networks:
default: default:
external: external:
name: postgis_nat_it_backend name: postgis_nat_it_backend
volumes:
static_file_volume:
konova_uploaded_files:

View File

@ -1,7 +0,0 @@
#!/bin/bash
# Start all needed services once the container is fired up!
service nginx start
service redis-server start
celery -A konova worker --detach
# Rule of thumb: (2*CPU)+1 as worker_num -> Use 5 as default (matches a dual core)
gunicorn --workers=5 konova.wsgi:application --bind=0.0.0.0:8000

4
nginx/Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM nginx:alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d

View File

@ -1,5 +1,5 @@
upstream konova { upstream konova {
server localhost:8000; server konova:8000;
} }
server { server {