Skip to content

Commit 0ccc203

Browse files
committed
Configure renovate bot, skip major python and dep upgrades
Signed-off-by: Mihai Criveti <[email protected]>
1 parent 20bf08b commit 0ccc203

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

run-gunicorn.sh

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
# Author: Mihai Criveti
33
# Description: Run Gunicorn production server (optionally with TLS)
44

5-
# Determine script directory
5+
# ──────────────────────────────
6+
# Locate script directory
7+
# ──────────────────────────────
68
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
79

8-
# Attempt to activate a venv if not already active
10+
# ──────────────────────────────
11+
# Activate virtual-env (if any)
12+
# ──────────────────────────────
913
if [[ -z "$VIRTUAL_ENV" ]]; then
1014
# If a known venv path exists (like your custom .venv location), activate it
1115
if [[ -f "${HOME}/.venv/mcpgateway/bin/activate" ]]; then
@@ -20,6 +24,22 @@ if [[ -z "$VIRTUAL_ENV" ]]; then
2024
fi
2125
fi
2226

27+
# ──────────────────────────────
28+
# Identify Python interpreter
29+
# ──────────────────────────────
30+
if [[ -n "${VIRTUAL_ENV:-}" && -x "${VIRTUAL_ENV}/bin/python" ]]; then
31+
PYTHON="${VIRTUAL_ENV}/bin/python"
32+
elif command -v python3 >/dev/null 2>&1; then
33+
PYTHON="$(command -v python3)"
34+
elif command -v python >/dev/null 2>&1; then
35+
PYTHON="$(command -v python)"
36+
else
37+
echo "✘ No suitable Python interpreter found (tried python3, python)."
38+
exit 1
39+
fi
40+
41+
echo "🐍 Using Python interpreter: ${PYTHON}"
42+
2343
cat << "EOF"
2444
███╗ ███╗ ██████╗██████╗ ██████╗ █████╗ ████████╗███████╗██╗ ██╗ █████╗ ██╗ ██╗
2545
████╗ ████║██╔════╝██╔══██╗ ██╔════╝ ██╔══██╗╚══██╔══╝██╔════╝██║ ██║██╔══██╗╚██╗ ██╔╝
@@ -54,8 +74,14 @@ if [[ "${SSL}" == "true" ]]; then
5474
echo "✓ TLS enabled – using ${CERT_FILE} / ${KEY_FILE}"
5575
fi
5676

57-
# Initialize databases
58-
"$PYTHON" -m mcpgateway.db
77+
# ──────────────────────────────
78+
# Database migrations / checks
79+
# ──────────────────────────────
80+
"${PYTHON}" -m mcpgateway.db
81+
if [[ $? -ne 0 ]]; then
82+
echo "✘ Database migration/check failed. Please resolve issues before starting the server."
83+
exit 1
84+
fi
5985

6086
exec gunicorn -c gunicorn.config.py \
6187
--worker-class uvicorn.workers.UvicornWorker \

0 commit comments

Comments
 (0)