Skip to content

Commit

Permalink
Merge pull request #16 from arXiv/ntai/http2-support
Browse files Browse the repository at this point in the history
Support HTTP/2.
  • Loading branch information
ntai-arxiv authored Apr 4, 2024
2 parents 45c2f11 + 970340b commit e0ac079
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 479 deletions.
5 changes: 3 additions & 2 deletions tex2pdf_service/Appliance.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ RUN . venv/bin/activate && \
venv/bin/poetry install ; exit 0
RUN mkdir -p texlive/2023
RUN tlmgr info --json --verify-repo=none > texlive/2023/tlmgr-info.json; exit 0
COPY app-logging.conf .
COPY app-logging.json .
#
RUN tlmgr update --self; exit 0
# RUN tlmgr update --all; exit 0
Expand All @@ -49,5 +47,8 @@ RUN mktexlsr; exit 0
COPY tex2pdf/ ./tex2pdf/
ENV TEXMFHOME /usr/local/texlive/2023
ENV PYTHONPATH /home/worker
COPY app-logging.conf .
COPY app-logging.json .
COPY hypercorn-config.toml ./hypercorn-config.toml
COPY app.sh ./app.sh
CMD ["/bin/bash", "app.sh"]
38 changes: 22 additions & 16 deletions tex2pdf_service/app-logging.conf
Original file line number Diff line number Diff line change
@@ -1,40 +1,46 @@
[loggers]
keys=root, uvicorn, gunicorn, tex2pdf
keys=root, tex2pdf, uvicorn, granian, hypercorn

[handlers]
keys=access_handler

[formatters]
keys=json

[formatter_json]
class=tex2pdf.CustomJsonFormatter
format=%(asctime)s %(name)s %(levelname)s %(message)s %(process)d %(threadName)s

[handler_access_handler]
class=logging.StreamHandler
formatter=json
args=()

[logger_root]
level=INFO
handlers=access_handler
propagate=1
propagate=0

[logger_gunicorn]
level=INFO
[logger_tex2pdf]
level=DEBUG
handlers=access_handler
propagate=0
qualname=gunicorn
qualname=tex2pdf

[logger_uvicorn]
level=INFO
handlers=access_handler
propagate=0
qualname=uvicorn

[logger_tex2pdf]
level=DEBUG
[logger_granian]
level=INFO
handlers=access_handler
propagate=0
qualname=tex2pdf

[handler_access_handler]
class=logging.StreamHandler
formatter=json
args=()
qualname=granian

[formatter_json]
class=tex2pdf.CustomJsonFormatter
format=%(asctime)s %(name)s %(levelname)s %(message)s %(process)d %(threadName)s
[logger_hypercorn]
level=INFO
handlers=access_handler
propagate=0
qualname=hcorn
6 changes: 6 additions & 0 deletions tex2pdf_service/app-logging.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
"propagate": false,
"qualname": "granian"
},
"hypercorn": {
"level": "INFO",
"handlers": ["access_handler"],
"propagate": false,
"qualname": "hcorn"
},
"tex2pdf": {
"level": "DEBUG",
"handlers": ["access_handler"],
Expand Down
5 changes: 3 additions & 2 deletions tex2pdf_service/app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ fi
export PORT
export TEXMFHOME=/usr/local/texlive/2023
. /home/worker/venv/bin/activate
uvicorn --host 0.0.0.0 --port $PORT --log-config app-logging.conf --workers $WORKERS tex2pdf.tex2pdf_api:app
# granian --interface asgi --host 0.0.0.0 --port $PORT --log-config app-logging.json --workers $WORKERS tex2pdf.tex2pdf_api:app
# uvicorn --host 0.0.0.0 --port $PORT --log-config app-logging.conf --workers $WORKERS tex2pdf.tex2pdf_api:app
# granian --http 2 --interface asgi --no-ws --host 0.0.0.0 --port $PORT --log-config app-logging.json --workers $WORKERS tex2pdf.tex2pdf_api:app
hypercorn --config hypercorn-config.toml --bind 0.0.0.0:$PORT --log-config app-logging.conf --workers $WORKERS tex2pdf.tex2pdf_api:app
Loading

0 comments on commit e0ac079

Please sign in to comment.