-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·53 lines (41 loc) · 1.4 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# install.sh - Install script for vLLM-Intercept
# This script sets up the daemon_server.py as a systemd service.
set -e
# Variables
SERVICE_NAME="vllm_intercept"
SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service"
USER="$(whoami)"
WORKING_DIR="$(pwd)"
PYTHON_EXEC="$(which python3)"
# Install required Python packages
echo "Installing Python dependencies..."
pip install -r requirements.txt
# Generate gRPC code from the .proto file
echo "Generating gRPC code from generation_service.proto..."
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. generation_service.proto
# Create systemd service file
echo "Creating systemd service file..."
sudo bash -c "cat > ${SERVICE_FILE}" <<EOL
[Unit]
Description=vLLM Intercept Daemon Service
After=network.target
[Service]
Type=simple
ExecStart=${PYTHON_EXEC} ${WORKING_DIR}/daemon_server.py
User=${USER}
WorkingDirectory=${WORKING_DIR}
Restart=on-failure
StandardOutput=append:${WORKING_DIR}/vllm_intercept.log
StandardError=append:${WORKING_DIR}/vllm_intercept_error.log
[Install]
WantedBy=multi-user.target
EOL
# Reload systemd daemon
echo "Reloading systemd daemon..."
sudo systemctl daemon-reload
# Enable and start the service
echo "Enabling and starting the ${SERVICE_NAME} service..."
sudo systemctl enable ${SERVICE_NAME}
sudo systemctl start ${SERVICE_NAME}
echo "Installation complete. The ${SERVICE_NAME} service is now running."