Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

feat: allow to expose vllm_url as parameter in Docker #240

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ EXPOSE 80
# Set the PYTHONPATH environment variable
ENV PYTHONPATH=/app/src

# Define an argument for vlm_url with a default value
ENV VLLM_URL=https://inference.codegate.ai

# Set the container's default entrypoint
EXPOSE 8989
ENTRYPOINT ["/app/scripts/entrypoint.sh", "/tmp/weaviate_backup", "backup"]
ENTRYPOINT ["/app/scripts/entrypoint.sh", "/tmp/weaviate_backup", "backup"]
59 changes: 43 additions & 16 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,45 @@
#!/bin/bash
DEFAULT_VLLM_URL="https://inference.codegate.ai"
VLLM_URL=${VLLM_URL:-$DEFAULT_VLLM_URL}

# Check if the backup directory exists and handle the restore
if [ -d "$1" ] && [ -d "$1/$2" ]; then
echo "Restoring backup from $1/$2..."
# Your restore logic here, e.g., running a Python script or restoring a database
python -m src.codegate.cli restore-backup --backup-path "$1" --backup-name "$2"
else
echo "No backup found at $1/$2. Skipping restore."
fi

# Step 2: Start the Nginx server with FE
echo "Starting the dashboard.. "
exec nginx -g 'daemon off;' &

# Step 3: Start the main application (serve)
echo "Starting the application..."
exec python -m src.codegate.cli serve --port 8989 --host 0.0.0.0 --vllm-url https://inference.codegate.ai --model-base-path /app/models
# Parse arguments
BACKUP_PATH=$1
BACKUP_MODE=$2

# Function to restore backup if paths are provided
restore_backup() {
if [ -n "$BACKUP_PATH" ] && [ -n "$BACKUP_MODE" ]; then
if [ -d "$BACKUP_PATH" ] && [ -d "$BACKUP_PATH/$BACKUP_MODE" ]; then
echo "Restoring backup from $BACKUP_PATH/$BACKUP_MODE..."
python -m src.codegate.cli restore-backup --backup-path "$BACKUP_PATH" --backup-name "$BACKUP_MODE"
else
echo "No backup found at $BACKUP_PATH/$BACKUP_MODE. Skipping restore."
fi
else
echo "Backup path or mode not provided. Skipping restore."
fi
}

# Function to start Nginx server for the dashboard
start_dashboard() {
echo "Starting the dashboard..."
nginx -g 'daemon off;' &
}

# Function to start the main application
start_application() {
echo "Starting the application with VLLM URL: $VLLM_URL"
exec python -m src.codegate.cli serve --port 8989 --host 0.0.0.0 --vllm-url "$VLLM_URL" --model-base-path /app/models
}

# Main execution flow
echo "Initializing entrypoint script..."

# Step 1: Restore backup if applicable
restore_backup

# Step 2: Start the dashboard
start_dashboard

# Step 3: Start the main application
start_application
Loading