diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 43dfd74008644d024cca7dd63bfe26a7943294cd..f491257f978982ff80001fd2e3a31e640dd89395 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,12 +29,13 @@ deploy_test: DOCKER_HOST: unix:///var/run/docker.sock script: - echo "deploying dev" + - mkdir -p /var/log/strudel2 - docker login -u $DOCKERHUBUSER -p $DOCKERHUBPASSWORD docker.io - docker stop strudel2_backend || echo "Failed to stop existing container" - docker ps -a -q | xargs -I{} docker rm {} || echo "No containers to remove" - docker images -q | xargs -I{} docker rmi {} || echo "No images to remove" - docker pull l1ll1/strudel2_backend:latest - - docker run -d -p 8080:8080 -p 8090:8090 --name strudel2_backend l1ll1/strudel2_backend:latest || echo "Unable to start image ... possibly the old wsgi process is still running?" + - docker run -d -p 8080:8080 -p 8090:8090 --name strudel2_backend --restart=always --mount type=bind,source=/var/log/strudel2,target=/var/log/strudel2 l1ll1/strudel2_backend:latest || echo "Unable to start image ... possibly the old wsgi process is still running?" dependencies: - build @@ -48,12 +49,13 @@ deploy_dev: DOCKER_HOST: unix:///var/run/docker.sock script: - echo "deploying dev" + - mkdir -p /var/log/strudel2 - docker login -u $DOCKERHUBUSER -p $DOCKERHUBPASSWORD docker.io - docker stop strudel2_backend || echo "Failed to stop existing container" - docker ps -a -q | xargs -I{} docker rm {} || echo "No containers to remove" - docker images -q | xargs -I{} docker rmi {} || echo "No images to remove" - docker pull l1ll1/strudel2_backend:latest - - docker run -d -p 8080:8080 -p 8090:8090 --name strudel2_backend l1ll1/strudel2_backend:latest || echo "Unable to start image ... possibly the old wsgi process is still running?" + - docker run -d -p 8080:8080 -p 8090:8090 --name strudel2_backend --restart=always --mount type=bind,source=/var/log/strudel2,target=/var/log/strudel2 l1ll1/strudel2_backend:latest || echo "Unable to start image ... possibly the old wsgi process is still running?" dependencies: - build @@ -67,11 +69,12 @@ deploy_dev_pawsey: DOCKER_HOST: unix:///var/run/docker.sock script: - echo "deploying dev" + - mkdir -p /var/log/strudel2 - docker login -u $DOCKERHUBUSER -p $DOCKERHUBPASSWORD docker.io - docker stop strudel2_backend || echo "Failed to stop existing container" - docker ps -a -q | xargs -I{} docker rm {} || echo "No containers to remove" - docker images -q | xargs -I{} docker rmi {} || echo "No images to remove" - docker pull l1ll1/strudel2_backend:latest - - docker run -d -p 8080:8080 -p 8090:8090 --name strudel2_backend l1ll1/strudel2_backend:latest || echo "Unable to start image ... possibly the old wsgi process is still running?" + - docker run -d -p 8080:8080 -p 8090:8090 --name strudel2_backend --restart=always --mount type=bind,source=/var/log/strudel2,target=/var/log/strudel2 l1ll1/strudel2_backend:latest || echo "Unable to start image ... possibly the old wsgi process is still running?" dependencies: - build diff --git a/Dockerfile b/Dockerfile index f684c00341f13de361b4c9e81d5ee29ad1d98412..1fecebeac4fa097b5c724cd3bcbf6ffd7a469ca8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ RUN apt update RUN apt install -y python3 gcc python3-pip RUN apt install -y openssh-client RUN pip3 install -r requirements.txt +RUN mkdir -p /var/log/strudel2 RUN pwd RUN ls RUN cd TES ; python3 ./setup.py install diff --git a/TES/tes/tes_wsgi.py b/TES/tes/tes_wsgi.py index 0e5c3cdb19e703667b760decec2d832d28ed7660..33f686d161d06712bd19f9f2f521c8deb99102b0 100644 --- a/TES/tes/tes_wsgi.py +++ b/TES/tes/tes_wsgi.py @@ -1,5 +1,5 @@ import logging -logging.basicConfig(filename="/var/log/tes.log",format="%(asctime)s %(levelname)s:%(process)s: %(message)s") +logging.basicConfig(filename="/var/log/strudel2/tes.log",format="%(asctime)s %(levelname)s:%(process)s: %(message)s") logger=logging.getLogger() logger.setLevel(logging.DEBUG) import argparse diff --git a/TWS/twsproxy/__init__.py b/TWS/twsproxy/__init__.py index 3fbe1c340b17d567806f40bea799aa3245de21f6..06cc96be2d877b640f2adfe1fc7c87dcb7ee846c 100644 --- a/TWS/twsproxy/__init__.py +++ b/TWS/twsproxy/__init__.py @@ -248,7 +248,7 @@ def main(): from . import server import logging import sys - logging.basicConfig(filename="/var/log/tws.log",format="%(asctime)s %(levelname)s:%(process)s: %(message)s") + logging.basicConfig(filename="/var/log/strudel2/tws.log",format="%(asctime)s %(levelname)s:%(process)s: %(message)s") logger = logging.getLogger() logger.setLevel(logging.DEBUG) logger.debug("starting TWS proxy")