finish dockerization of all services

This commit is contained in:
MarcZierle 2022-10-31 11:55:04 +01:00
parent 28f27080fd
commit bcbd11a69e
8 changed files with 20 additions and 13 deletions

View File

@ -27,8 +27,9 @@ MSG_BROKER_URL=
MSG_BROKER_PREFIX=
# Celery task work directory to store temporary files
# use ./services_data/worker folder as absolute path: /home/user/app/worker
# use ./worker folder as absolute path: /home/app/worker
TASK_WORKER_DIR=
TASK_DEFAULT_QUEUE=
# Channels Layers Backend (Websocket)
# HOST and PORT of the Redis Backend

View File

@ -19,16 +19,21 @@ RUN python3 -m pip install --upgrade pip && \
COPY . .
RUN chown -R app:app /home/app
USER app
FROM builder AS backend
USER app
# run gunicorn
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000"]
FROM builder AS worker
# install worker dependencies
RUN apt-get install -y texlive-xetex
# run celery worker
USER app
CMD ["celery", "-A", "config", "worker", "-l", "info"]
FROM builder AS websocket
# run daphne server
USER app
CMD ["daphne", "-b", "0.0.0.0", "-p", "8001", "config.asgi:application"]

View File

@ -35,6 +35,7 @@ DEBUG = env('DEBUG')
ALLOWED_HOSTS = env('ALLOWED_HOSTS').split(',')
CORS_ALLOWED_ORIGINS = [ 'https://' + url for url in env('ALLOWED_HOSTS').split(',')]
CORS_ALLOWED_ORIGINS += [ 'http://' + url for url in env('ALLOWED_HOSTS').split(',')]
# Application definition
@ -211,13 +212,13 @@ CELERY_CACHE_BACKEND = 'default'
CELERY_WORK_DIR = env('TASK_WORKER_DIR')
CELERY_BROKER_URL = env.cache_url('MSG_BROKER_URL')
CELERY_RESULT_BACKEND = env.cache_url('MSG_BROKER_URL')
CELERY_BROKER_URL = env.cache_url('MSG_BROKER_URL')['LOCATION']
CELERY_RESULT_BACKEND = env.cache_url('MSG_BROKER_URL')['LOCATION']
CELERY_EVENT_QUEUE_PREFIX = env('MSG_BROKER_PREFIX')
CELERY_TIMEZONE = 'CET'
CELERY_TASK_DEFAULT_QUEUE = 'zierletraining_prod'
CELERY_TASK_DEFAULT_QUEUE = env('TASK_DEFAULT_QUEUE')
CELERY_BROKER_TRANSPORT_OPTIONS = {
'visibility_timeout': 300,
}
@ -228,8 +229,8 @@ CELERY_BROKER_TRANSPORT_OPTIONS = {
CACHES = {
'default': {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": env.cache_url('MSG_BROKER_URL'),
"BACKEND": env.cache_url('MSG_BROKER_URL')['BACKEND'],
"LOCATION": env.cache_url('MSG_BROKER_URL')['LOCATION'],
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
},

View File

@ -61,8 +61,8 @@ services:
env_file:
- .env
environment:
- MINIO_ROOT_USER=${S3_ACCESS_ID}
- MINIO_ROOT_PASSWORD=${S3_ACCESS_SECRET}
- MINIO_ROOT_USER=${S3_ROOT_USER}
- MINIO_ROOT_PASSWORD=${S3_ROOT_PASSWORD}
#- MINIO_SCHEME=http
volumes:
- s3:/data

View File

@ -5,7 +5,7 @@ import os
def generate_tex(title, date, render_date, start_slide_image, slides, id_to_name, work_dir):
log_start = "% !TEX program = xelatex\n\\documentclass[aspectratio=169]{beamer}\n\\usepackage{graphicx}\n\\usepackage{tikz}\n\\usepackage[absolute,overlay]{textpos}\n\\definecolor{gray1}{rgb}{0.85,0.85,0.85}\n\\definecolor{gray2}{rgb}{0.95,0.95,0.95}\n\\setbeamertemplate{background canvas}{%\n\\begin{tikzpicture}[remember picture,overlay]\n\\begin{scope}[xshift=0.55\\textwidth, yshift=-4.5cm]\n\\fill[even odd rule,inner color=gray2,outer color=gray1] (0,0) circle (10);\n\\node[inner sep=0pt] at (0.26,-4.02) {\\includegraphics[width=1.16\\textwidth]{wood_floor}};\n\\end{scope}\n\\end{tikzpicture}%\n}\n\\setbeamertemplate{navigation symbols}{}\n\\vfuzz=1000pt\n\\hfuzz=1000pt\n\\usepackage{fontspec}\n\\newfontfamily{\\gill} [ Path = "+str(settings.BASE_DIR)+"/static/photolog_assets/,UprightFont = * Medium,BoldFont = * Bold] {Gill Sans MT}\n\\definecolor{title_line_red}{rgb}{0.8,0.2,0.2}\n\\makeatletter\n\\let\\old@rule\\@rule\n\\def\\@rule[#1]#2#3{\\textcolor{title_line_red}{\\old@rule[#1]{#2}{#3}}}\n\\makeatother\n\\title{Fotoprotokoll}\n\\author{Antje Zierle-Kohlmorgen}\n\\institute{Zierle-Training}\n\\date{2022}\n\\begin{document}\n\\gill"
log_start = "% !TEX program = xelatex\n\\documentclass[aspectratio=169]{beamer}\n\\usepackage{graphicx}\n\\usepackage{tikz}\n\\usepackage[absolute,overlay]{textpos}\n\\definecolor{gray1}{rgb}{0.85,0.85,0.85}\n\\definecolor{gray2}{rgb}{0.95,0.95,0.95}\n\\setbeamertemplate{background canvas}{%\n\\begin{tikzpicture}[remember picture,overlay]\n\\begin{scope}[xshift=0.55\\textwidth, yshift=-4.5cm]\n\\fill[even odd rule,inner color=gray2,outer color=gray1] (0,0) circle (10);\n\\node[inner sep=0pt] at (0.26,-4.02) {\\includegraphics[width=1.16\\textwidth]{wood_floor}};\n\\end{scope}\n\\end{tikzpicture}%\n}\n\\setbeamertemplate{navigation symbols}{}\n\\vfuzz=1000pt\n\\hfuzz=1000pt\n\\usepackage{fontspec}\n\\newfontfamily{\\gill} [ Path = "+str(settings.CELERY_WORK_DIR)+"/photolog_assets/,UprightFont = * Medium,BoldFont = * Bold] {Gill Sans MT}\n\\definecolor{title_line_red}{rgb}{0.8,0.2,0.2}\n\\makeatletter\n\\let\\old@rule\\@rule\n\\def\\@rule[#1]#2#3{\\textcolor{title_line_red}{\\old@rule[#1]{#2}{#3}}}\n\\makeatother\n\\title{Fotoprotokoll}\n\\author{Antje Zierle-Kohlmorgen}\n\\institute{Zierle-Training}\n\\date{2022}\n\\begin{document}\n\\gill"
log_end = "\\begin{frame}\n\\begin{columns}\n\\begin{column}{0.6\\textwidth}\n\\begin{center}\n\\includegraphics[width=0.8\\textwidth]{smile}\n\\end{center}\n\\end{column}\n\\begin{column}{0.4\\textwidth}\n\\Huge{Viel Erfolg!}\n\\end{column}\n\\end{columns}\n\\end{frame}\n\\end{document}"
title_slide_start = "\\begin{frame}\n\\begin{textblock*}{13.0cm}(3cm,1.75cm)\n\\huge{"

View File

@ -88,3 +88,5 @@ wcwidth==0.2.5
wrapt==1.14.1
zope.interface==5.4.0
django-environ==0.9.0
djangorestframework-simplejwt
channels-redis

View File

@ -1 +0,0 @@
<h1>API</h1>

View File

@ -1 +0,0 @@
<h1>Scrapers Home</h1>