Skip to content

Commit 9ce9ad9

Browse files
Number of main server processes now configurable with env variable.
1 parent 17490fc commit 9ce9ad9

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ENV TZ Europe/Berlin
1212

1313
COPY backend/conda_env.yml /app_setup/env.yml
1414
RUN conda env create -f /app_setup/env.yml; conda clean --all
15-
ENV CONDA_DIR=/opt/conda/envs/GitInsight/bin
15+
ENV CONDA_DIR /opt/conda/envs/GitInsight/bin
1616

1717

1818
FROM app_base as app_full
@@ -21,5 +21,6 @@ COPY backend /app/backend
2121
COPY version.txt /app/
2222
COPY --from=frontend_builder /workspace/frontend/dist /app/frontend/dist
2323
EXPOSE 80
24+
ENV N_WORKERS 4
2425

2526
ENTRYPOINT $CONDA_DIR/python /app/backend/main.py

backend/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from multiprocessing import Process
23

34
import uvicorn
@@ -9,7 +10,8 @@
910
class Services:
1011
@staticmethod
1112
def run_main():
12-
uvicorn.run('server.main_server:app', host='0.0.0.0', port=MAIN_SERVICE_PORT, workers=4)
13+
n_workers = int(os.environ.get('N_WORKERS', 4))
14+
uvicorn.run('server.main_server:app', host='0.0.0.0', port=MAIN_SERVICE_PORT, workers=n_workers)
1315

1416
@staticmethod
1517
def run_crawler():

example_deployment/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ services:
1515
image: nobisindustries/gitinsight:latest
1616
container_name: gitinsight_main
1717
restart: always
18+
environment:
19+
- N_WORKERS=4
1820
expose:
1921
- 80
2022
volumes:

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.8.2
1+
0.8.3

0 commit comments

Comments
 (0)