Skip to content

Commit

Permalink
append .py extension for gunicorn configuration (pypi#7137)
Browse files Browse the repository at this point in the history
* append .py extension for gunicorn configuration

as of gunicorn 20.x:

  > The configuration file should be a valid Python source file with a python extension (e.g. gunicorn.conf.py).

this complies, and silences warning at boot

* if its a .py, lint it and black it

* licenses for py files
  • Loading branch information
ewdurbin authored Dec 31, 2019
1 parent 2acb5d2 commit 84a8f90
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 41 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ static_tests:


reformat: .state/env/pyvenv.cfg
$(BINDIR)/isort -rc warehouse/ tests/
$(BINDIR)/black warehouse/ tests/
$(BINDIR)/isort -rc *.py warehouse/ tests/
$(BINDIR)/black *.py warehouse/ tests/

lint: .state/env/pyvenv.cfg
$(BINDIR)/flake8 .
$(BINDIR)/black --check warehouse/ tests/
$(BINDIR)/isort -rc -c warehouse/ tests/
$(BINDIR)/black --check *.py warehouse/ tests/
$(BINDIR)/isort -rc -c *.py warehouse/ tests/
$(BINDIR)/doc8 --allow-long-titles README.rst CONTRIBUTING.rst docs/ --ignore-path docs/_build/
# TODO: Figure out a solution to https://github.com/deezer/template-remover/issues/1
# so we can remove extra_whitespace from below.
Expand Down
4 changes: 2 additions & 2 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
release: bin/release
web: bin/start-web python -m gunicorn.app.wsgiapp -c gunicorn.conf warehouse.wsgi:application
web-uploads: bin/start-web python -m gunicorn.app.wsgiapp -c gunicorn-uploads.conf warehouse.wsgi:application
web: bin/start-web python -m gunicorn.app.wsgiapp -c gunicorn.conf.py warehouse.wsgi:application
web-uploads: bin/start-web python -m gunicorn.app.wsgiapp -c gunicorn-uploads.conf.py warehouse.wsgi:application
worker: bin/start-worker celery -A warehouse worker -l info --max-tasks-per-child 32
worker-beat: bin/start-worker celery -A warehouse beat -S redbeat.RedBeatScheduler -l info
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ services:
# working on pypi-theme, this is a private repository due to the fact
# that other people's IP is contained in it.
#THEME_REPO:
command: hupper -w 'warehouse/locale/**/*.mo' -m gunicorn.app.wsgiapp -b 0.0.0.0:8000 -c gunicorn.conf warehouse.wsgi:application
command: hupper -w 'warehouse/locale/**/*.mo' -m gunicorn.app.wsgiapp -b 0.0.0.0:8000 -c gunicorn.conf.py warehouse.wsgi:application
env_file: dev/environment
volumes:
# We specify all of these directories instead of just . because we want to
Expand Down
17 changes: 0 additions & 17 deletions gunicorn-uploads.conf

This file was deleted.

30 changes: 30 additions & 0 deletions gunicorn-uploads.conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

bind = "unix:/var/run/cabotage/cabotage.sock"
backlog = 512
preload_app = True
max_requests = 32
max_requests_jitter = 8

worker_connections = 256
timeout = 240
keepalive = 2

errorlog = "-"
loglevel = "info"
accesslog = "-"
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'


def when_ready(server):
open("/tmp/app-initialized", "w").close()
17 changes: 0 additions & 17 deletions gunicorn.conf

This file was deleted.

30 changes: 30 additions & 0 deletions gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

bind = "unix:/var/run/cabotage/cabotage.sock"
backlog = 2048
preload_app = True
max_requests = 2048
max_requests_jitter = 128

worker_connections = 1000
timeout = 60
keepalive = 2

errorlog = "-"
loglevel = "info"
accesslog = "-"
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'


def when_ready(server):
open("/tmp/app-initialized", "w").close()

0 comments on commit 84a8f90

Please sign in to comment.