Skip to content

Commit

Permalink
Update granian and use new of configuration via env vars (#1931)
Browse files Browse the repository at this point in the history
  • Loading branch information
dekkers authored Oct 18, 2023
1 parent 83eb460 commit 13a25a7
Show file tree
Hide file tree
Showing 9 changed files with 533 additions and 333 deletions.
1 change: 0 additions & 1 deletion docs/source/release_notes/1.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ If you want to switch to Granian you can create the directory
[Service]
ExecStart=
ExecStart=/opt/venvs/kat-rocky/bin/granian --interface wsgi rocky.wsgi:application
ExecStart=/opt/venvs/kat-rocky/bin/granian --workers \$GRANIAN_WORKERS --threads \$GRANIAN_THREADS --host \$GRANIAN_HOST --port \$GRANIAN_PORT --interface wsgi \$GRANIAN_OPTIONS rocky.wsgi:application
Type=simple
This file is also used by the packagings scripts in new installations to have
Expand Down
10 changes: 6 additions & 4 deletions docs/source/technical_design/debianinstall.rst
Original file line number Diff line number Diff line change
Expand Up @@ -309,21 +309,23 @@ Configure reverse proxy

OpenKAT listens on 127.0.0.1 port 8000 by default. We recommend that you access
OpenKAT through a reverse proxy. If you already have a reverse proxy on a
different host then you need to change ``GRANIAN_HOST`` to be able to access
OpenKAT from the reverse proxy:
different host then you need to change ``GRANIAN_HOST`` in rocky.conf to be able
to access OpenKAT from the reverse proxy:

.. code-block:: sh
GRANIAN_HOST=0.0.0.0
If you want to use https between the reverse proxy and OpenKAT you can do that
by setting also setting GRANIAN_PORT and GRANIAN_OPTIONS:
by setting also setting ``GRANIAN_PORT``, ``GRANIAN_SSL_KEYFILE`` and
``GRANIAN_SSL_CERTIFICATE`` in rocky.conf:

.. code-block:: sh
GRANIAN_HOST=0.0.0.0
GRANIAN_PORT=8443
GRANIAN_OPTIONS=--ssl-keyfile /path/to/key --ssl-certificate /path/to/cert
GRANIAN_SSL_KEYFILE=/path/to/key
GRANIAN_SSL_CERTIFICATE=/path/to/cert
See also the `Granian documentation
<https://github.com/emmett-framework/granian/blob/master/README.md>`_ for more
Expand Down
2 changes: 1 addition & 1 deletion rocky/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [ "$1" = "configure" ]; then
# Do not customize this file because it will be automatically removed in the next release
[Service]
ExecStart=
ExecStart=/opt/venvs/kat-rocky/bin/granian --workers \$GRANIAN_WORKERS --threads \$GRANIAN_THREADS --host \$GRANIAN_HOST --port \$GRANIAN_PORT --interface wsgi \$GRANIAN_OPTIONS rocky.wsgi:application
ExecStart=/opt/venvs/kat-rocky/bin/granian --interface wsgi rocky.wsgi:application
Type=simple
EOF
fi
Expand Down
2 changes: 1 addition & 1 deletion rocky/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ "$DATABASE_MIGRATION" = "1" ] || [[ $DATABASE_MIGRATION == "true" ]]; then
fi

if [ "$1" == "uwsgi" ] && { [ "$USE_GRANIAN" = "1" ] || [[ $USE_GRANIAN == "true" ]]; }; then
exec granian --workers "$GRANIAN_WORKERS" --threads "$GRANIAN_THREADS" --interface wsgi rocky.wsgi:application --host 0.0.0.0
exec granian --interface wsgi rocky.wsgi:application --host 0.0.0.0
else
exec "$@"
fi
2 changes: 0 additions & 2 deletions rocky/packaging/deb/data/usr/lib/kat/rocky.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ BYTES_API=http://localhost:8002
STATIC_ROOT=/usr/share/kat-rocky/static
GRANIAN_WORKERS=2
GRANIAN_THREADS=4
GRANIAN_HOST=127.0.0.1
GRANIAN_PORT=8000
305 changes: 186 additions & 119 deletions rocky/poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion rocky/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ opentelemetry-instrumentation-requests = "^0.41b0"
whitenoise = {extras = ["brotli"], version = "^6.5.0"}
opentelemetry-instrumentation = "^0.41b0"
opentelemetry-instrumentation-fastapi = "^0.41b0"
granian = "^0.6.0"
granian = "^0.7.0"


[tool.poetry.group.dev.dependencies]
Expand Down
271 changes: 169 additions & 102 deletions rocky/requirements-dev.txt

Large diffs are not rendered by default.

271 changes: 169 additions & 102 deletions rocky/requirements.txt

Large diffs are not rendered by default.

0 comments on commit 13a25a7

Please sign in to comment.