diff --git a/VRE/requirements.txt b/VRE/requirements.txt index c048df6..28f579b 100644 --- a/VRE/requirements.txt +++ b/VRE/requirements.txt @@ -7,6 +7,7 @@ psycopg2-binary==2.9.2 # Tasks redis==4.0.0 +hiredis==2.0.0 huey==2.4.1 # Django Rest Framework diff --git a/docker-compose.yaml b/docker-compose.yaml index cdd9b50..bfd0709 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -40,7 +40,7 @@ services: # DOCKER_CACHE: registry.webhosting.rug.nl/cache/library/ dockerfile: ./docker/Dockerfile.api args: - DEBUG: true + DEBUG: "False" command: gunicorn VRE.wsgi:application --bind 0.0.0.0:8000 --workers=4 ports: - 8000:8000 @@ -87,6 +87,8 @@ services: # args: # DOCKER_CACHE: registry.webhosting.rug.nl/cache/library/ dockerfile: ./docker/Dockerfile.scheduler + args: + DEBUG: "False" command: python manage.py run_huey depends_on: - broker-api @@ -94,7 +96,7 @@ services: - redis volumes: - postgres-data: - redis-data: - staticfiles: - mediafiles: \ No newline at end of file + postgres-data: null + redis-data: null + staticfiles: null + mediafiles: null diff --git a/docker/Dockerfile.api b/docker/Dockerfile.api index 3577624..56d86bb 100644 --- a/docker/Dockerfile.api +++ b/docker/Dockerfile.api @@ -7,15 +7,19 @@ FROM ${DOCKER_CACHE}python:3.8 ENV PYTHONUNBUFFERED 1 ENV PYTHONDONTWRITEBYTECODE 1 +ENV DEBIAN_FRONTEND=noninteractive + +ENV APP_HOME=/opt/VRE +ENV VIRTUAL_ENV=/opt/venv +RUN python3 -m venv $VIRTUAL_ENV +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + # Update packages and install nc for database up detection RUN apt-get update && apt-get -y full-upgrade && apt-get install -y netcat -ARG DEBUG=false -RUN if [ "$DEBUG" = "true" ] ; then apt-get install -y graphviz libgraphviz-dev; fi - -# Create an app user in the app group. -RUN useradd --user-group --create-home --no-log-init --shell /bin/bash app -ENV APP_HOME=/home/app/web +ARG DEBUG="False" +ENV DEBUG="${DEBUG}" +RUN if [ "$DEBUG" = "True" ] ; then apt-get install -y graphviz libgraphviz-dev; fi # Create a logfile dir... not sure if this is the right way RUN mkdir -p ${APP_HOME}/../log @@ -37,18 +41,13 @@ RUN pip install --upgrade pip wheel # Install the requirements. RUN pip install --no-cache-dir -r requirements.txt +RUN if [ "$DEBUG" = "True" ] ; then pip install --no-cache-dir -r requirements-dev.txt; fi # Startup script when the image is starting up with COPY ./docker/entrypoint.api.sh ${APP_HOME}/entrypoint.api.sh RUN chmod +x ${APP_HOME}/entrypoint.api.sh -# fix file rights -RUN chown -R app:app $APP_HOME/../ - -# Run as user (this will not work with Drones testing) -#USER app:app - # ENTRYPOINT does not work with variables..?? (${APP_HOME}) -ENTRYPOINT ["/home/app/web/entrypoint.api.sh"] +ENTRYPOINT ["/opt/VRE/entrypoint.api.sh"] # Strange exit errors.... #ENTRYPOINT ["sh","-c","${APP_HOME}/entrypoint.api.sh"] \ No newline at end of file diff --git a/docker/Dockerfile.scheduler b/docker/Dockerfile.scheduler index cfcb6ae..3127358 100644 --- a/docker/Dockerfile.scheduler +++ b/docker/Dockerfile.scheduler @@ -7,12 +7,19 @@ FROM ${DOCKER_CACHE}python:3.8 ENV PYTHONUNBUFFERED 1 ENV PYTHONDONTWRITEBYTECODE 1 +ENV DEBIAN_FRONTEND=noninteractive + +ENV APP_HOME=/opt/VRE +ENV VIRTUAL_ENV=/opt/venv +RUN python3 -m venv $VIRTUAL_ENV +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + # Update packages and install nc for database up detection RUN apt-get update && apt-get -y full-upgrade -# Create an app user in the app group. -RUN useradd --user-group --create-home --no-log-init --shell /bin/bash app -ENV APP_HOME=/home/app/web +ARG DEBUG="False" +ENV DEBUG="${DEBUG}" +RUN if [ "$DEBUG" = "True" ] ; then apt-get install -y graphviz libgraphviz-dev; fi # Create a logfile dir... not sure if this is the right way RUN mkdir -p ${APP_HOME}/../log @@ -28,9 +35,4 @@ RUN pip install --upgrade pip wheel # Install the requirements. RUN pip install --no-cache-dir -r requirements.txt - -# fix file rights -RUN chown -R app:app $APP_HOME/../ - -# Run as user (this will not work with Drones testing) -#USER app:app \ No newline at end of file +RUN if [ "$DEBUG" = "True" ] ; then pip install --no-cache-dir -r requirements-dev.txt; fi diff --git a/docker/project.example.env b/docker/project.example.env index f609c9e..228e999 100644 --- a/docker/project.example.env +++ b/docker/project.example.env @@ -27,7 +27,7 @@ SECRET_KEY=@wb=#(f4uc0l%e!5*eo+aoflnxb(@!l9!=c5w=4b+x$=!8&vy%' # Disable debug in production # https://docs.djangoproject.com/en/dev/ref/settings/#debug -DEBUG=True +DEBUG=False # Allowed hosts that Django does server. Use comma separated list Take care when NGINX is proxying in front of Django # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts