update service

This commit is contained in:
Cyberes 2023-12-21 13:22:47 -07:00
parent 885b2d64f7
commit 8cab76712f
4 changed files with 27 additions and 7 deletions

View File

@ -1,3 +1,4 @@
import time
import sys
from llm_server.custom_redis import redis
@ -5,7 +6,7 @@ from llm_server.logging import create_logger
def server_startup(s):
if not redis.get('daemon_started', dtype=bool):
logger = create_logger('gunicorn')
logger.fatal('Could not find the key daemon_started in Redis. Did you forget to start the daemon process?')
sys.exit(1)
while not redis.get('daemon_started', dtype=bool):
logger.warning('Could not find the key daemon_started in Redis. Did you forget to start the daemon process?')
time.sleep(10)

View File

@ -0,0 +1,15 @@
[Unit]
Description=Local LLM Proxy Daemon
Wants=basic.target
After=basic.target network.target
[Service]
User=server
Group=server
ExecStart=/srv/server/local-llm-server/venv/bin/python /srv/server/local-llm-server/daemon.py
Restart=always
RestartSec=2
SyslogIdentifier=local-llm-daemon
[Install]
WantedBy=multi-user.target

View File

@ -1,7 +1,8 @@
[Unit]
Description=Local LLM Proxy
Description=Local LLM Proxy Server
Wants=basic.target
After=basic.target network.target
After=basic.target network.target local-llm-daemon.service
Requires=local-llm-daemon.service
[Service]
User=server
@ -9,9 +10,10 @@ Group=server
WorkingDirectory=/srv/server/local-llm-server
# Need a lot of workers since we have long-running requests
# Takes about 3.5G memory
ExecStart=/srv/server/local-llm-server/venv/bin/gunicorn --workers 20 --bind 0.0.0.0:5000 server:app --timeout 60 --worker-class gevent
ExecStart=/srv/server/local-llm-server/venv/bin/gunicorn --workers 20 --bind 0.0.0.0:5000 server:app --timeout 60 --worker-class gevent -c /srv/server/local-llm-server/other/server.conf
Restart=always
RestartSec=2
SyslogIdentifier=local-llm-server
[Install]
WantedBy=multi-user.target

2
other/server.conf Normal file
View File

@ -0,0 +1,2 @@
accesslog="-"
errorlog="-"