Made changes to suit Openwebui
This commit is contained in:
+18
-8
@@ -4,10 +4,10 @@
|
||||
# Usage: ./remote_deploy.sh [server_ip] [user] [port] [remote_dir]
|
||||
|
||||
# Default values
|
||||
SERVER_IP=${1:-"104.225.217.215"}
|
||||
SERVER_USER=${2:-"root"}
|
||||
SERVER_PORT=${3:-"22"}
|
||||
REMOTE_DIR=${4:-"/root/openwebui"}
|
||||
SERVER_IP=${1:-"104.225.217.215"} # IP address of the server where OpenWebUI is installed
|
||||
SERVER_USER=${2:-"root"} # SSH username for the server
|
||||
SERVER_PORT=${3:-"22"} # SSH port for the server
|
||||
REMOTE_DIR=${4:-"/root/openwebui"} # Directory where OpenWebUI is installed
|
||||
LOCAL_DIR="."
|
||||
|
||||
echo "Deploying to server: $SERVER_IP"
|
||||
@@ -36,12 +36,22 @@ ssh -p $SERVER_PORT $SERVER_USER@$SERVER_IP "cd $REMOTE_DIR/ai_service_app && \
|
||||
python3 -m venv venv || true && \
|
||||
source venv/bin/activate && \
|
||||
pip install --upgrade pip && \
|
||||
pip install -r requirements.txt && \
|
||||
pip install python-dotenv langchain-text-splitters"
|
||||
pip install -r ai_service/requirements.txt && \
|
||||
pip install python-dotenv langchain-text-splitters requests"
|
||||
|
||||
# Stop any existing service
|
||||
echo "Stopping any existing service..."
|
||||
ssh -p $SERVER_PORT $SERVER_USER@$SERVER_IP "pkill -f 'uvicorn ai_service.run:app' || true"
|
||||
ssh -p $SERVER_PORT $SERVER_USER@$SERVER_IP "pkill -f 'uvicorn ai_service.api:app' || true"
|
||||
|
||||
# Set up environment file if it doesn't exist
|
||||
echo "Setting up environment file..."
|
||||
ssh -p $SERVER_PORT $SERVER_USER@$SERVER_IP "cd $REMOTE_DIR/ai_service_app && \
|
||||
if [ ! -f ai_service/.env ]; then \
|
||||
cp ai_service/.env.example ai_service/.env; \
|
||||
echo 'Created .env file from .env.example'; \
|
||||
else \
|
||||
echo '.env file already exists'; \
|
||||
fi"
|
||||
|
||||
# Start the service
|
||||
echo "Starting the service..."
|
||||
@@ -52,7 +62,7 @@ ssh -p $SERVER_PORT $SERVER_USER@$SERVER_IP "cd $REMOTE_DIR/ai_service_app && \
|
||||
# Check if the service is running
|
||||
echo "Checking if the service is running..."
|
||||
sleep 5
|
||||
ssh -p $SERVER_PORT $SERVER_USER@$SERVER_IP "ps aux | grep 'uvicorn ai_service.run:app' | grep -v grep"
|
||||
ssh -p $SERVER_PORT $SERVER_USER@$SERVER_IP "ps aux | grep 'uvicorn ai_service.api:app' | grep -v grep"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Service is running!"
|
||||
echo "You can access the API at: http://$SERVER_IP:5251"
|
||||
|
||||
Reference in New Issue
Block a user