Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit da604c0e authored by Jon Yu's avatar Jon Yu
Browse files

Switch to uvicorn deployment

parent 2b70b9ee
Pipeline #69159 passed with stage
in 6 seconds
......@@ -12,7 +12,7 @@ services:
volumes:
- ./src:/usr/src/app
entrypoint: ./docker-entrypoint.sh
command: "python3 manage.py runserver 0.0.0.0:${APP_PORT:-8000} --nostatic"
command: "uvicorn {{ project_name }}.asgi:application --reload --host 0.0.0.0 --port ${APP_PORT:-8000}"
depends_on:
- db
db:
......
......@@ -5,9 +5,12 @@ ARG ENVIRONMENT="PRODUCTION"
ENV GUNICORN_WORKERS=2 \
GUNICORN_THREADS=4 \
PYTHONUNBUFFERED=1 \
WEB_CONCURRENCY=5 \
PIP_DISABLE_PIP_VERSION_CHECK=1
RUN apt-get -y update && apt-get install -y libpq-dev gcc
RUN apt-get -y update && apt-get install -y \
libpq-dev \
gcc
WORKDIR /usr/src/app
......@@ -31,4 +34,4 @@ EXPOSE 8000
ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"]
CMD ["sh", "-c", "gunicorn --bind=0.0.0.0:8000 --workers=${GUNICORN_WORKERS} --threads=${GUNICORN_THREADS} --access-logfile=- --log-file=- {{ project_name }}.wsgi"]
CMD ["sh", "-c", "gunicorn {{ project_name }}.asgi:application --host=0.0.0.0:8000 -w=${GUNICORN_WORKERS} --threads=${GUNICORN_THREADS} -k uvicorn.workers.UvicornWorker""]
......@@ -2,10 +2,13 @@ asgiref==3.4.1
certifi==2021.5.30
cffi==1.14.6
charset-normalizer==2.0.3
click==8.0.1
cryptography==3.4.7
dj-database-url==0.5.0
Django==3.2.5
gunicorn==20.1.0
h11==0.12.0
httptools==0.2.0
idna==3.2
josepy==1.8.0
mozilla-django-oidc==1.2.4
......@@ -13,9 +16,15 @@ psycopg2==2.9.1
pycparser==2.20
pyOpenSSL==20.0.1
python-decouple==3.4
python-dotenv==0.19.0
pytz==2021.1
PyYAML==5.4.1
requests==2.26.0
six==1.16.0
sqlparse==0.4.1
urllib3==1.26.6
uvicorn==0.14.0
uvloop==0.15.3
watchgod==0.7
websockets==9.1
whitenoise==5.3.0
......@@ -4,4 +4,5 @@ gunicorn~=20.1
mozilla-django-oidc~=1.2
dj-database-url~=0.5.0
psycopg2~=2.9
python-decouple~=3.4
\ No newline at end of file
python-decouple~=3.4
uvicorn[standard]~=0.14
\ No newline at end of file
......@@ -27,6 +27,6 @@ set -eE
docker run --rm -d -t -v "$OUTPUT_PATH":"$CONTAINER_OUTPUT_DIR":z -v "$(pwd)":"$CONTAINER_BASE_TEMPLATE_DIR":ro --name $CONTAINER_NAME --entrypoint /bin/bash $IMAGE_TAG
docker exec -t $CONTAINER_NAME python -m pip install django
docker exec -t $CONTAINER_NAME django-admin startproject --template=$CONTAINER_BASE_TEMPLATE_DIR --name=Dockerfile,README.md "$PROJECT_NAME" "$CONTAINER_OUTPUT_DIR"
docker exec -t $CONTAINER_NAME django-admin startproject --template=$CONTAINER_BASE_TEMPLATE_DIR --name=Dockerfile,docker-compose.yml,README.md "$PROJECT_NAME" "$CONTAINER_OUTPUT_DIR"
echo "Done! Change dir to $OUTPUT_PATH and run docker-compose up --build to start the project"
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment