WIP: Docker enhancement
* reduce containers into a single one, holding nginx + celery + redis all at once
This commit is contained in:
		
							parent
							
								
									460011a5e8
								
							
						
					
					
						commit
						aa02dbab96
					
				@ -1,11 +1,11 @@
 | 
				
			|||||||
FROM python:3.7-slim
 | 
					FROM python:3.7
 | 
				
			||||||
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
 | 
					RUN apt install -y gdal-bin redis-server nginx
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Copy requirements file into workspace
 | 
					# Copy requirements file into workspace
 | 
				
			||||||
COPY ./requirements.txt /konova/
 | 
					COPY ./requirements.txt /konova/
 | 
				
			||||||
@ -13,6 +13,8 @@ RUN pip install --upgrade pip
 | 
				
			|||||||
RUN pip install -r requirements.txt
 | 
					RUN pip install -r requirements.txt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Copy rest of project into workspace
 | 
					# Copy rest of project into workspace
 | 
				
			||||||
 | 
					RUN rm /etc/nginx/sites-enabled/default
 | 
				
			||||||
 | 
					COPY ./nginx/nginx.conf /etc/nginx/conf.d
 | 
				
			||||||
COPY . /konova/
 | 
					COPY . /konova/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Move static files in designated folder
 | 
					# Move static files in designated folder
 | 
				
			||||||
 | 
				
			|||||||
@ -1,13 +1,13 @@
 | 
				
			|||||||
version: '3.3'
 | 
					version: '3.3'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
services:
 | 
					services:
 | 
				
			||||||
  redis:
 | 
					  #redis:
 | 
				
			||||||
    image: redis
 | 
					  #  image: redis
 | 
				
			||||||
    container_name: "konova-redis-cache"
 | 
					  #  container_name: "konova-redis-cache"
 | 
				
			||||||
    volumes:
 | 
					  #  volumes:
 | 
				
			||||||
      - /redis/data:/bitnami/redis/data
 | 
					  #    - /redis/data:/bitnami/redis/data
 | 
				
			||||||
    environment:
 | 
					  #  environment:
 | 
				
			||||||
      - REDIS_PASSWORD=CHANGE_ME
 | 
					  #    - REDIS_PASSWORD=CHANGE_ME
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  konova:
 | 
					  konova:
 | 
				
			||||||
    external_links:
 | 
					    external_links:
 | 
				
			||||||
@ -15,37 +15,37 @@ services:
 | 
				
			|||||||
      - arnova-nginx-server:arnova
 | 
					      - arnova-nginx-server:arnova
 | 
				
			||||||
    build: .
 | 
					    build: .
 | 
				
			||||||
    container_name: "konova-docker"
 | 
					    container_name: "konova-docker"
 | 
				
			||||||
    command: sh -c 'celery -A konova worker -l INFO --detach && gunicorn konova.wsgi:application --bind 0.0.0.0:8000'
 | 
					    command: sh -c 'service nginx start && service redis-server start && celery -A konova worker --detach && gunicorn konova.wsgi:application --bind 0.0.0.0:8000'
 | 
				
			||||||
    restart: always
 | 
					    restart: always
 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - .:/konova
 | 
					      - .:/konova
 | 
				
			||||||
      - /path/to/host/folder:/konova_uploaded_files
 | 
					      - /path/to/host/folder:/konova_uploaded_files
 | 
				
			||||||
      - static_file_volume:/konova/static  # Point to the volume for static files. Shared with nginx service
 | 
					      - static_file_volume:/konova/static  # Point to the volume for static files. Shared with nginx service
 | 
				
			||||||
    expose:
 | 
					    ports:
 | 
				
			||||||
      - 8000
 | 
					      - "1337:80"
 | 
				
			||||||
    depends_on:
 | 
					    #depends_on:
 | 
				
			||||||
      - redis
 | 
					    #  - 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=redis
 | 
					      - REDIS_HOST=localhost
 | 
				
			||||||
      - 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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  nginx:
 | 
					  #nginx:
 | 
				
			||||||
    build: ./nginx
 | 
					  #  build: ./nginx
 | 
				
			||||||
    container_name: "konova-nginx-server"
 | 
					  #  container_name: "konova-nginx-server"
 | 
				
			||||||
    ports:
 | 
					  #  ports:
 | 
				
			||||||
      - "1337:80"
 | 
					  #    - "1337:80"
 | 
				
			||||||
    depends_on:
 | 
					  #  depends_on:
 | 
				
			||||||
      - konova
 | 
					  #    - konova
 | 
				
			||||||
    volumes:
 | 
					  #  volumes:
 | 
				
			||||||
      - static_file_volume:/konova/static  # Point to the volume for static files. Shared with konova service
 | 
					  #    - 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
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
upstream konova {
 | 
					upstream konova {
 | 
				
			||||||
    server konova:8000;
 | 
					    server localhost:8000;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
server {
 | 
					server {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user