1
1
#! /bin/bash
2
2
3
- # Check if the backup directory exists and handle the restore
4
- if [ -d " $1 " ] && [ -d " $1 /$2 " ]; then
5
- echo " Restoring backup from $1 /$2 ..."
6
- # Your restore logic here, e.g., running a Python script or restoring a database
7
- python -m src.codegate.cli restore-backup --backup-path " $1 " --backup-name " $2 "
8
- else
9
- echo " No backup found at $1 /$2 . Skipping restore."
10
- fi
11
-
12
- # Step 2: Start the Nginx server with FE
13
- echo " Starting the dashboard.. "
14
- exec nginx -g ' daemon off;' &
15
-
16
- # Step 3: Start the main application (serve)
17
- echo " Starting the application..."
18
- 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
3
+ DEFAULT_VLLM_URL=" https://inference.codegate.ai"
4
+
5
+ # Parse arguments
6
+ VLLM_URL=${1:- $DEFAULT_VLLM_URL }
7
+ BACKUP_PATH=$2
8
+ BACKUP_MODE=$3
9
+
10
+ # Function to restore backup if paths are provided
11
+ restore_backup () {
12
+ if [ -n " $BACKUP_PATH " ] && [ -n " $BACKUP_MODE " ]; then
13
+ if [ -d " $BACKUP_PATH " ] && [ -d " $BACKUP_PATH /$BACKUP_MODE " ]; then
14
+ echo " Restoring backup from $BACKUP_PATH /$BACKUP_MODE ..."
15
+ python -m src.codegate.cli restore-backup --backup-path " $BACKUP_PATH " --backup-name " $BACKUP_MODE "
16
+ else
17
+ echo " No backup found at $BACKUP_PATH /$BACKUP_MODE . Skipping restore."
18
+ fi
19
+ else
20
+ echo " Backup path or mode not provided. Skipping restore."
21
+ fi
22
+ }
23
+
24
+ # Function to start Nginx server for the dashboard
25
+ start_dashboard () {
26
+ echo " Starting the dashboard..."
27
+ nginx -g ' daemon off;' &
28
+ }
29
+
30
+ # Function to start the main application
31
+ start_application () {
32
+ echo " Starting the application with VLLM URL: $VLLM_URL "
33
+ exec python -m src.codegate.cli serve --port 8989 --host 0.0.0.0 --vllm-url " $VLLM_URL " --model-base-path /app/models
34
+ }
35
+
36
+ # Main execution flow
37
+ echo " Initializing entrypoint script..."
38
+
39
+ # Step 1: Restore backup if applicable
40
+ restore_backup
41
+
42
+ # Step 2: Start the dashboard
43
+ start_dashboard
44
+
45
+ # Step 3: Start the main application
46
+ start_application
0 commit comments