From d7856ba3ea9eeb7481d5110fcf4f6ab1558ca9a1 Mon Sep 17 00:00:00 2001 From: Phillip Chlap Date: Tue, 15 Aug 2023 15:55:06 +1000 Subject: [PATCH] Add entrypoint file for total segmentator service --- services/totalsegmentator/entrypoint.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 services/totalsegmentator/entrypoint.sh diff --git a/services/totalsegmentator/entrypoint.sh b/services/totalsegmentator/entrypoint.sh new file mode 100644 index 00000000..40f814ca --- /dev/null +++ b/services/totalsegmentator/entrypoint.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# Run redis-server +redis-server --daemonize yes + +# Run celery beat and worker +celery --app=service:celery beat --loglevel=INFO & +celery --app=service:celery worker --loglevel=INFO & + +# Start the DICOM listener for the service +celery --app=service:celery call platipy.backend.tasks.run_dicom_listener + +# Run the gunicorn server +CERT_FILE=service.crt +KEY_FILE=service.key +if [ -f "$CERT_FILE" ]; then + echo "SSL Certificates Found. Will serve over HTTPS." + exec gunicorn -b :8000 --certfile=service.crt --keyfile=service.key --timeout 300 --graceful-timeout 60 --access-logfile - --error-logfile - service:app +else + echo "WARNING: No SSL certificates found. Generate them with 'manage ssl'." + echo "Running without SSL, not suitable for production use." + exec gunicorn -b :8000 --timeout 300 --graceful-timeout 60 --access-logfile - --error-logfile - service:app +fi