diff --git a/apiserver/Dockerfile.api b/apiserver/Dockerfile.api index 0e4e0ac50..0150cc809 100644 --- a/apiserver/Dockerfile.api +++ b/apiserver/Dockerfile.api @@ -41,6 +41,7 @@ USER captain # Add in Django deps and generate Django's static files COPY manage.py manage.py +COPY server.py server.py COPY plane plane/ COPY templates templates/ COPY package.json package.json diff --git a/apiserver/bin/takeoff b/apiserver/bin/takeoff index efea53f87..81f26a6cf 100755 --- a/apiserver/bin/takeoff +++ b/apiserver/bin/takeoff @@ -28,4 +28,4 @@ python manage.py configure_instance # Create the default bucket python manage.py create_bucket -exec gunicorn -w $GUNICORN_WORKERS -k uvicorn.workers.UvicornWorker plane.asgi:application --bind 0.0.0.0:${PORT:-8000} --max-requests 1200 --max-requests-jitter 1000 --access-logfile - +python server.py diff --git a/apiserver/server.py b/apiserver/server.py new file mode 100644 index 000000000..84d25f2e4 --- /dev/null +++ b/apiserver/server.py @@ -0,0 +1,17 @@ +import os +import uvicorn + +if __name__ == "__main__": + os.environ.setdefault( + "DJANGO_SETTINGS_MODULE", "plane.settings.production" + ) + uvicorn.run( + "plane.asgi:application", + host=os.environ.get("HOST", "0.0.0.0"), + port=os.environ.get("PORT", 8000), + ws="auto", + workers=int(os.environ.get("GUNICORN_WORKERS", 1)), + log_level=os.environ.get("LOG_LEVEL", "info"), + lifespan="off", + access_log="on", + )