-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(gunicorn): Add config #3894
base: master
Are you sure you want to change the base?
Changes from 4 commits
4b0de33
59836f8
b498272
a73b778
a4ab6a1
fad47ab
383eb73
47be686
8f1cb1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,29 @@ | ||
FROM docker.io/library/python:3.11-slim-bullseye | ||
|
||
ENV GUNICORN_WORKERS=1 | ||
ENV GUNICORN_THREADS=1 | ||
ENV GUNICORN_BIND="0.0.0.0:8000" | ||
ENV GUNICORN_TIMEOUT=400 | ||
|
||
|
||
ENV CG_SQL_DATABASE_URI="sqlite:///:memory:" | ||
ENV CG_SECRET_KEY="key" | ||
Check warning on line 4 in Dockerfile GitHub Actions / docker-image-pushSensitive data should not be used in the ARG or ENV commands
|
||
|
||
ENV LIMS_HOST="mocklims.scilifelab.se" | ||
ENV LIMS_USERNAME="limsadmin" | ||
ENV LIMS_PASSWORD="limsadminpassword" | ||
Check warning on line 8 in Dockerfile GitHub Actions / docker-image-pushSensitive data should not be used in the ARG or ENV commands
|
||
|
||
ENV MAIL_CONTAINER_URI="http://127.0.0.1:port/container" | ||
|
||
ENV OSTICKET_EMAIL="[email protected]" | ||
ENV OSTICKET_API_KEY=None | ||
Check warning on line 13 in Dockerfile GitHub Actions / docker-image-pushSensitive data should not be used in the ARG or ENV commands
|
||
ENV OSTICKET_DOMAIN=None | ||
ENV OSTICKET_TIMEOUT="1" | ||
|
||
ENV GOOGLE_OAUTH_CLIENT_ID="1" | ||
ENV GOOGLE_OAUTH_CLIENT_SECRET="1" | ||
Check warning on line 18 in Dockerfile GitHub Actions / docker-image-pushSensitive data should not be used in the ARG or ENV commands
|
||
|
||
ENV TRAILBLAZER_HOST="host" | ||
ENV TRAILBLAZER_SERVICE_ACCOUNT="service_account" | ||
ENV TRAILBLAZER_SERVICE_ACCOUNT_AUTH_FILE="auth_file" | ||
Check warning on line 22 in Dockerfile GitHub Actions / docker-image-pushSensitive data should not be used in the ARG or ENV commands
|
||
|
||
|
||
WORKDIR /home/src/app | ||
COPY pyproject.toml poetry.lock ./ | ||
COPY pyproject.toml poetry.lock gunicorn.conf.py ./ | ||
|
||
RUN pip install --no-cache-dir poetry \ | ||
&& poetry config virtualenvs.create false \ | ||
|
@@ -37,15 +31,6 @@ | |
|
||
COPY cg ./cg | ||
|
||
CMD gunicorn \ | ||
Check warning on line 34 in Dockerfile GitHub Actions / docker-image-pushJSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals
|
||
--workers=$GUNICORN_WORKERS \ | ||
--bind=$GUNICORN_BIND \ | ||
--threads=$GUNICORN_THREADS \ | ||
--timeout=$GUNICORN_TIMEOUT \ | ||
--proxy-protocol \ | ||
--forwarded-allow-ips="10.0.2.100,127.0.0.1" \ | ||
--log-syslog \ | ||
--access-logfile - \ | ||
--error-logfile - \ | ||
--log-level="debug" \ | ||
cg.server.auto:app | ||
--config gunicorn.conf.py \ | ||
cg.server.auto:app |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
bind = "0.0.0.0:8000" | ||
threads = 4 | ||
timeout = 400 | ||
loglevel = "debug" | ||
protocol = "proxy" | ||
syslog = True | ||
forwarded_allow_ips = "10.0.2.100,127.0.0.1" | ||
accesslog = "-" | ||
workers = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forwarded_allow_ips = "127.0.0.1"
I would suggest having deployment-specific configurations in their respective repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, but in a specific future PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But should not the configuration of gunicorn be handled in servers rather than be dictated by code in the repo? If we want to increase the number of workers we shouldn't have to make a PR to cg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be a even bigger change. And I do not know if it would make sense to move it away from the actual app. Either way it is definitively out of scope.
If you agree - could you approve this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ahdamin @Vince-janv Bump!