From 49fda3601248d939b0cfff1bff5a18800e498bdc Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Wed, 11 Oct 2017 19:39:04 -0400 Subject: The HTML is kind of jank --- bin/web | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 bin/web (limited to 'bin') diff --git a/bin/web b/bin/web new file mode 100755 index 0000000..3d96f71 --- /dev/null +++ b/bin/web @@ -0,0 +1,67 @@ +#!/bin/bash -e + +# See "Running in Production" in the API Star documentation at +# + +# In development, gunicorn can automatically reload code as you edit it. To +# enable this feature, export `GUNICORN_CMD_ARGS='--reload'` before running +# this script. +# +# See: +# * +# * + +# If the `PORT` environment variable is set, we're probably running on a +# platform like Heroku that expects the application to bind to it. Otherwise, +# default to port 5000. gunicorn will print the value on startup either way, +# allowing administrators and developers to determine the server's base URL. +# +# See: +# * +# * + +PORT=${PORT:-5000} + +# Run the application with gunicorn. Note that the API Star documentation +# recommends setting `--workers`. We omit this option: on our target platform, +# this is controlled automatically using the `WEB_CONCURRENCY` environment +# variable, which has a computed default based on the resources available at +# runtime. Falling back to gunicorn's default configuration is safe enough, as +# an administrator who discovers this is the wrong configuration can easily set +# `WEB_CONCURRENCY` to override it. +# +# See: +# * +# * +# +# The API Star documentation also recommends the Meinheld worker type. However, +# deploying Meinheld to Heroku causes the application to fail on startup: +# +# Error: class uri 'meinheld.gmeinheld.MeinheldWorker' invalid or not found: +# [Traceback (most recent call last): +# File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 134, in load_class +# File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module +# mod = import_module('.'.join(components)) +# return _bootstrap._gcd_import(name[level:], package, level) +# File "", line 978, in _gcd_import +# File "", line 936, in _find_and_load_unlocked +# File "", line 961, in _find_and_load +# File "", line 205, in _call_with_frames_removed +# File "", line 950, in _find_and_load_unlocked +# File "", line 655, in _load_unlocked +# File "", line 205, in _call_with_frames_removed +# File "", line 678, in exec_module +# File "/app/.heroku/python/lib/python3.6/site-packages/meinheld/__init__.py", line 1, in +# from meinheld.server import * +# File "", line 978, in _gcd_import +# File "", line 961, in _find_and_load +# ImportError: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory +# ] +# +# The `libpython3.6m.so` library does not appear to be present. As we don't need +# to squeeze every ounce of performance out of this application, I've removed +# the Meinheld worker and opened a support ticket to get an explanation from +# Heroku. + +exec gunicorn app:app \ + --bind="0.0.0.0:${PORT}" -- cgit v1.2.3