|
|
|
|
@ -20,7 +20,8 @@ $STD apt-get install -y \
|
|
|
|
|
unzip \
|
|
|
|
|
build-essential \
|
|
|
|
|
libyaml-dev \
|
|
|
|
|
python3-dev
|
|
|
|
|
python3-dev \
|
|
|
|
|
git
|
|
|
|
|
msg_ok "Installed Dependencies"
|
|
|
|
|
|
|
|
|
|
msg_info "Installing Python"
|
|
|
|
|
@ -38,13 +39,13 @@ NODE_VERSION="20" install_node_and_modules
|
|
|
|
|
msg_ok "Installed Node.js"
|
|
|
|
|
|
|
|
|
|
msg_info "Setup ${APPLICATION}"
|
|
|
|
|
RELEASE=$(curl -fsSL https://api.github.com/repos/Dictionarry-Hub/profilarr/releases/latest | grep "tag_name" | cut -d'"' -f4)
|
|
|
|
|
RELEASE=$(curl -fsSL https://api.github.com/repos/BiluliB/profilarr/releases/latest | grep "tag_name" | cut -d'"' -f4)
|
|
|
|
|
if [[ -z "$RELEASE" ]]; then
|
|
|
|
|
msg_error "Failed to fetch latest release version"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
temp_file=$(mktemp)
|
|
|
|
|
$STD curl -fsSL -o "$temp_file" "https://github.com/Dictionarry-Hub/profilarr/archive/refs/tags/${RELEASE}.zip"
|
|
|
|
|
$STD curl -fsSL -o "$temp_file" "https://github.com/BiluliB/profilarr/archive/refs/tags/${RELEASE}.zip"
|
|
|
|
|
$STD unzip -q "$temp_file" -d /tmp
|
|
|
|
|
$STD mkdir -p /opt/${APPLICATION}
|
|
|
|
|
$STD mkdir -p /opt/${APPLICATION}_config
|
|
|
|
|
@ -99,7 +100,8 @@ WorkingDirectory=/opt/${APPLICATION}/backend
|
|
|
|
|
Environment=PATH=/opt/${APPLICATION}/venv/bin:/usr/local/bin:/usr/bin:/bin
|
|
|
|
|
Environment=CONFIG_PATH=/opt/${APPLICATION}_config
|
|
|
|
|
Environment=PYTHONPATH=/opt/${APPLICATION}/backend
|
|
|
|
|
ExecStart=/opt/${APPLICATION}/venv/bin/python -m gunicorn --bind 0.0.0.0:6868 --workers 2 --timeout 120 --pythonpath /opt/${APPLICATION}/backend app.main:create_app
|
|
|
|
|
Environment=GIT_PYTHON_REFRESH=quiet
|
|
|
|
|
ExecStart=/opt/${APPLICATION}/venv/bin/python -m gunicorn --bind 0.0.0.0:6868 --workers 2 --timeout 120 --pythonpath /opt/${APPLICATION}/backend "app.main:create_app()"
|
|
|
|
|
Restart=always
|
|
|
|
|
RestartSec=10
|
|
|
|
|
StandardOutput=journal
|
|
|
|
|
@ -118,23 +120,14 @@ cd /opt/${APPLICATION}/backend
|
|
|
|
|
# Check if the main module exists and is importable
|
|
|
|
|
if ! /opt/${APPLICATION}/venv/bin/python -c "
|
|
|
|
|
import sys
|
|
|
|
|
import os
|
|
|
|
|
sys.path.insert(0, '/opt/${APPLICATION}/backend')
|
|
|
|
|
os.environ['GIT_PYTHON_REFRESH'] = 'quiet'
|
|
|
|
|
try:
|
|
|
|
|
import app.main
|
|
|
|
|
print('✓ app.main imported successfully')
|
|
|
|
|
except ImportError as e:
|
|
|
|
|
print(f'✗ Import error: {e}')
|
|
|
|
|
# List directory structure for debugging
|
|
|
|
|
import os
|
|
|
|
|
print('Backend directory contents:')
|
|
|
|
|
for root, dirs, files in os.walk('/opt/${APPLICATION}/backend'):
|
|
|
|
|
level = root.replace('/opt/${APPLICATION}/backend', '').count(os.sep)
|
|
|
|
|
indent = ' ' * 2 * level
|
|
|
|
|
print(f'{indent}{os.path.basename(root)}/')
|
|
|
|
|
subindent = ' ' * 2 * (level + 1)
|
|
|
|
|
for file in files:
|
|
|
|
|
if file.endswith('.py'):
|
|
|
|
|
print(f'{subindent}{file}')
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print(f'✗ Other error: {e}')
|
|
|
|
|
@ -158,6 +151,7 @@ User=root
|
|
|
|
|
WorkingDirectory=/opt/${APPLICATION}/backend
|
|
|
|
|
Environment=PATH=/opt/${APPLICATION}/venv/bin:/usr/local/bin:/usr/bin:/bin
|
|
|
|
|
Environment=CONFIG_PATH=/opt/${APPLICATION}_config
|
|
|
|
|
Environment=GIT_PYTHON_REFRESH=quiet
|
|
|
|
|
ExecStart=/opt/${APPLICATION}/venv/bin/python run.py
|
|
|
|
|
Restart=always
|
|
|
|
|
RestartSec=10
|
|
|
|
|
@ -179,6 +173,7 @@ User=root
|
|
|
|
|
WorkingDirectory=/opt/${APPLICATION}/backend
|
|
|
|
|
Environment=PATH=/opt/${APPLICATION}/venv/bin:/usr/local/bin:/usr/bin:/bin
|
|
|
|
|
Environment=CONFIG_PATH=/opt/${APPLICATION}_config
|
|
|
|
|
Environment=GIT_PYTHON_REFRESH=quiet
|
|
|
|
|
ExecStart=/opt/${APPLICATION}/venv/bin/python main.py
|
|
|
|
|
Restart=always
|
|
|
|
|
RestartSec=10
|
|
|
|
|
@ -201,6 +196,7 @@ User=root
|
|
|
|
|
WorkingDirectory=/opt/${APPLICATION}/backend
|
|
|
|
|
Environment=PATH=/opt/${APPLICATION}/venv/bin:/usr/local/bin:/usr/bin:/bin
|
|
|
|
|
Environment=CONFIG_PATH=/opt/${APPLICATION}_config
|
|
|
|
|
Environment=GIT_PYTHON_REFRESH=quiet
|
|
|
|
|
Environment=FLASK_APP=app.main:create_app
|
|
|
|
|
Environment=FLASK_RUN_HOST=0.0.0.0
|
|
|
|
|
Environment=FLASK_RUN_PORT=6868
|
|
|
|
|
|