Skip to content

Commit

Permalink
add the scalability for the docker image (#452)
Browse files Browse the repository at this point in the history
Co-authored-by: Tobias Allweier <[email protected]>
  • Loading branch information
Blubern and Tobias Allweier committed Jan 23, 2024
1 parent 9a0a8fc commit 654953b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,18 @@ See the [Oryx documentation](https://github.com/microsoft/Oryx/blob/main/doc/con

After adding the settings, be sure to save the configuration and then restart your app.

For apps published with `One click Azure deployment` you can increase your app's ability to handle concurrent requests from multiple users with the following steps:
1. Upgrade your App Service plan tier to a higher tier, for example tiers with more than one vCPU.

2. Configure the following app settings on your App Service in the Azure Portal:
- `UWSGI_PROCESSES`: 5 (may be higher or lower depending on your App Service Plan tier)
- `UWSGI_THREADS`: 5 (may be higher or lower depending on your App Service Plan tier)

After adding the settings, be sure to save the configuration and then restart your app.

> In case you build your own docker image based on the `WebApp.Dockerfile` and host it in a App Serice, you can also increase your app's ability to handle concurrent requests from multiple users with the above steps.
When you host your container not in an App Service you can add this seetings as container environment variable.

### Debugging your deployed app
First, add an environment variable on the app service resource called "DEBUG". Set this to "true".

Expand Down
4 changes: 3 additions & 1 deletion WebApp.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt \
COPY . /usr/src/app/
COPY --from=frontend /home/node/app/static /usr/src/app/static/
WORKDIR /usr/src/app
ENV UWSGI_PROCESSES=2
ENV UWSGI_THREADS=1
EXPOSE 80
CMD ["uwsgi", "--http", ":80", "--wsgi-file", "app.py", "--callable", "app", "-b","32768"]
CMD uwsgi --processes $UWSGI_PROCESSES --threads $UWSGI_THREADS --http :80 --wsgi-file app.py --callable app -b 32768
10 changes: 9 additions & 1 deletion infrastructure/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,15 @@
{
"name": "ELASTICSEARCH_EMBEDDING_MODEL_ID",
"value": "[parameters('ElasticsearchEmbeddingModelId')]"
}
},
{
"name": "UWSGI_PROCESSES",
"value": "2"
},
{
"name": "UWSGI_THREADS",
"value": "2"
}
],
"linuxFxVersion": "[variables('WebAppImageName')]"
}
Expand Down

0 comments on commit 654953b

Please sign in to comment.