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 import sys
from llm_server.custom_redis import redis from llm_server.custom_redis import redis
@ -5,7 +6,7 @@ from llm_server.logging import create_logger
def server_startup(s): def server_startup(s):
if not redis.get('daemon_started', dtype=bool): logger = create_logger('gunicorn')
logger = create_logger('gunicorn') while not redis.get('daemon_started', dtype=bool):
logger.fatal('Could not find the key daemon_started in Redis. Did you forget to start the daemon process?') logger.warning('Could not find the key daemon_started in Redis. Did you forget to start the daemon process?')
sys.exit(1) 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] [Unit]
Description=Local LLM Proxy Description=Local LLM Proxy Server
Wants=basic.target Wants=basic.target
After=basic.target network.target After=basic.target network.target local-llm-daemon.service
Requires=local-llm-daemon.service
[Service] [Service]
User=server User=server
@ -9,9 +10,10 @@ Group=server
WorkingDirectory=/srv/server/local-llm-server WorkingDirectory=/srv/server/local-llm-server
# Need a lot of workers since we have long-running requests # Need a lot of workers since we have long-running requests
# Takes about 3.5G memory # 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 Restart=always
RestartSec=2 RestartSec=2
SyslogIdentifier=local-llm-server
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

2
other/server.conf Normal file
View File

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