modified: README.md
new file: app.py new file: config/config.toml new file: requirements.txt new file: run.bat new file: run.sh new file: src/__init__.py new file: src/file_store_api.py new file: src/mainprocess.py new file: src/modules/__init__.py new file: src/modules/plugin_modules.py new file: src/modules/user_modules.py new file: src/plugin_manager.py
This commit is contained in:
51
run.sh
Normal file
51
run.sh
Normal file
@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
PROJECT_DIR=$(cd "$(dirname "$0")"; pwd)
|
||||
VENV_DIR="$PROJECT_DIR/.venv"
|
||||
FLASK_APP="app:app"
|
||||
|
||||
|
||||
echo "Activating virtual environment..."
|
||||
|
||||
if [ -f "$VENV_DIR/bin/activate" ]; then
|
||||
source "$VENV_DIR/bin/activate"
|
||||
else
|
||||
echo "Creating new virtual environment..."
|
||||
python3 -m venv "$VENV_DIR"
|
||||
source "$VENV_DIR/bin/activate"
|
||||
fi
|
||||
|
||||
if [ -z "$VIRTUAL_ENV" ]; then
|
||||
echo "Error: Failed to activate virtual environment"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Installing dependencies..."
|
||||
pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
pip install gunicorn
|
||||
|
||||
echo "Reading port from configuration..."
|
||||
|
||||
PORT=$(python3 -c \
|
||||
"
|
||||
from src.file_store_api import ConfigManager
|
||||
try:
|
||||
config = ConfigManager().load_config()
|
||||
port = config.get('app', {}).get('list_port')
|
||||
print(str(port) if port else '')
|
||||
except Exception as e:
|
||||
print('ERROR: ' + str(e))
|
||||
exit(1)
|
||||
")
|
||||
|
||||
if [[ "$PORT" == ERROR:* ]] || [ -z "$PORT" ]; then
|
||||
echo "Failed to get port from config: $PORT"
|
||||
echo "Using default port 25580"
|
||||
PORT=25580
|
||||
fi
|
||||
|
||||
echo "Starting rebot server..."
|
||||
echo "Listening on port: $PORT"
|
||||
|
||||
gunicorn -w 4 -b 0.0.0.0:$PORT "$FLASK_APP" --access-logfile - --error-logfile -
|
Reference in New Issue
Block a user