Skip to content

Commit

Permalink
Try using supervisor to start processes
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasrenault committed Jun 27, 2024
1 parent 491a660 commit 5b98702
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:

- name: Login to GHCR
# if: github.event_name != 'pull_request'
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v3
with:
registry: ghcr.io
Expand Down
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ RUN poetry install --no-interaction --no-ansi --without dev --with models
FROM python:3.11-slim

### instal JRE
RUN apt-get update && apt-get -y --no-install-recommends install openjdk-17-jre
RUN apt-get update && apt-get -y --no-install-recommends install openjdk-17-jre supervisor
RUN mkdir -p /var/log

### COPY supervisord.conf
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

### COPY /cprex
WORKDIR /cprex
Expand All @@ -133,5 +137,4 @@ EXPOSE 8501

HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

ENTRYPOINT [ "./.venv/bin/python"]
CMD ["-m", "streamlit", "run", "cprex/ui/streamlit.py", "--server.port=8501", "--server.address=0.0.0.0"]
CMD ["/usr/bin/supervisord"]
61 changes: 61 additions & 0 deletions supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[supervisord]
logfile=/dev/null ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=0 ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=0 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
;pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=true ; (start in foreground if true;default false)

; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=http://127.0.0.1:9001

[inet_http_server]
port = 127.0.0.1:9001

[program:streamlit]
command=./.venv/bin/python -m streamlit run cprex/ui/streamlit.py --server.port 8501 --server.address=0.0.0.0
directory=/cprex
autostart=true
autorestart=true
startretries=10
user=root
redirect_stderr=true
# stdout_logfile=/var/log/streamlit.log
# stdout_logfile_maxbytes=10MB
# stdout_logfile_backups=10
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0

[program:grobid]
command=./grobid-service/bin/grobid-service
directory=/root/.cprex/grobid
autostart=true
autorestart=true
startretries=10
user=root
redirect_stderr=true
# stdout_logfile=/var/log/grobid.log
# stdout_logfile_maxbytes=10MB
# stdout_logfile_backups=10
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0

[program:grobid-quantities]
command=./bin/grobid-quantities server resources/config/config.yml
directory=/root/.cprex/grobid/grobid-quantities
autostart=true
autorestart=true
startretries=10
user=root
redirect_stderr=true
# stdout_logfile=/var/log/grobid.log
# stdout_logfile_maxbytes=10MB
# stdout_logfile_backups=10
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0

0 comments on commit 5b98702

Please sign in to comment.