Added gunicorn support & stress test docs

This commit is contained in:
nise.moe 2024-03-04 13:48:48 +01:00
parent f4ea501fa6
commit 8ca3fa70b6
4 changed files with 16 additions and 3 deletions

View File

@ -12,7 +12,7 @@ COPY requirements.txt ./requirements.txt
RUN pip3 install --upgrade pip && \
pip3 install -r requirements.txt
# This is *reall* bad, but I'd rather get this working rather than forking packages and re-publishing them.
# This is *really* bad, but I'd rather get this working rather than forking packages and re-publishing them.
# It'll probably break some day.
RUN sed -i 's/events: List\[Event\] = Field(deserialize_type=List\[_Event\])/events: List\[_Event\] = Field(deserialize_type=List\[_Event\])/' /usr/local/lib/python3.11/site-packages/ossapi/models.py && \
sed -i 's/self\._conn = sqlite3.connect(str(cache_path))/self._conn = sqlite3.connect(str(cache_path), check_same_thread=False)/' /usr/local/lib/python3.11/site-packages/circleguard/loader.py && \
@ -22,4 +22,7 @@ RUN sed -i '238s|return \[x for x in arr if lower_limit < x < upper_limit\]|arr_
COPY ./src/ ./src/
CMD ["python", "src/main.py"]
ENV GUNICORN_CMD_ARGS="--bind=0.0.0.0:5000 --workers=6"
# Run gunicorn with the application
CMD ["gunicorn", "--chdir", "src", "main:app"]

View File

@ -2,3 +2,4 @@ ossapi==3.4.3
circleguard==5.4.1
flask==3.0.2
brparser==1.0.4
gunicorn==21.2.0

View File

@ -0,0 +1,5 @@
Example command:
```bash
ab -n 5000 -c 10 -p sample.json -T application/json http://localhost:5000/replay
```

File diff suppressed because one or more lines are too long