mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-15 23:05:23 -05:00
feat: improve idle memory usage (#1758)
* health check as python script * install crfpp model via python * drop curl from finale container * use uvicorn by default w/ gunicorn as opt in * recommend setting mem limit for container
This commit is contained in:
@@ -41,11 +41,6 @@ init() {
|
||||
poetry run python /app/mealie/db/init_db.py
|
||||
}
|
||||
|
||||
# Migrations
|
||||
# TODO
|
||||
# Migrations
|
||||
# Set Port from ENV Variable
|
||||
|
||||
if [ "$ARG1" == "reload" ]; then
|
||||
echo "Hot Reload!"
|
||||
|
||||
@@ -63,6 +58,11 @@ else
|
||||
GUNICORN_PORT=${API_PORT:-9000}
|
||||
|
||||
# Start API
|
||||
# uvicorn mealie.app:app --host 0.0.0.0 --port 9000
|
||||
gunicorn mealie.app:app -b 0.0.0.0:$GUNICORN_PORT -k uvicorn.workers.UvicornWorker -c /app/gunicorn_conf.py --preload
|
||||
|
||||
if [ $WEB_GUNICORN == 'true' ]; then
|
||||
echo "Starting Gunicorn"
|
||||
gunicorn mealie.app:app -b 0.0.0.0:$GUNICORN_PORT -k uvicorn.workers.UvicornWorker -c /app/gunicorn_conf.py --preload
|
||||
else
|
||||
uvicorn mealie.app:app --host 0.0.0.0 --port $GUNICORN_PORT
|
||||
fi
|
||||
fi
|
||||
|
||||
23
mealie/scripts/healthcheck.py
Normal file
23
mealie/scripts/healthcheck.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import os
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
def main():
|
||||
port = os.getenv("API_PORT")
|
||||
|
||||
if port is None:
|
||||
port = 9000
|
||||
|
||||
url = f"http://127.0.0.1:{port}/api/app/about"
|
||||
|
||||
r = requests.get(url)
|
||||
|
||||
if r.status_code == 200:
|
||||
exit(0)
|
||||
else:
|
||||
exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
21
mealie/scripts/install_model.py
Normal file
21
mealie/scripts/install_model.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import requests
|
||||
|
||||
from mealie.services.parser_services import crfpp
|
||||
|
||||
MODEL_URL = "https://github.com/mealie-recipes/nlp-model/releases/download/v1.0.0/model.crfmodel"
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Install the model into the crfpp directory
|
||||
"""
|
||||
|
||||
r = requests.get(MODEL_URL, stream=True, allow_redirects=True)
|
||||
with open(crfpp.MODEL_PATH, "wb") as f:
|
||||
for chunk in r.iter_content(chunk_size=1024):
|
||||
if chunk:
|
||||
f.write(chunk)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user