again setup
All checks were successful
Build and Deploy MITM Webserver / build (push) Successful in 9s
All checks were successful
Build and Deploy MITM Webserver / build (push) Successful in 9s
This commit is contained in:
@@ -25,7 +25,8 @@ PYTHON_VERSION="3" # aktuelle Python 3 Version
|
|||||||
echo "==> Update & Upgrade"
|
echo "==> Update & Upgrade"
|
||||||
apt update && apt upgrade -y
|
apt update && apt upgrade -y
|
||||||
apt install -y git curl build-essential nginx python3 python3-pip python3-venv unzip wget python3-dev \
|
apt install -y git curl build-essential nginx python3 python3-pip python3-venv unzip wget python3-dev \
|
||||||
libnetfilter-queue-dev libnfnetlink-dev libpcap-dev autoconf automake libtool pkg-config libjson-c-dev
|
libnetfilter-queue-dev libnfnetlink-dev libpcap-dev autoconf automake libtool pkg-config libjson-c-dev \
|
||||||
|
gettext flex bison libnuma-dev libpcre2-dev libmaxminddb-dev librrd-dev
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Node.js installieren (LTS)
|
# Node.js installieren (LTS)
|
||||||
@@ -68,6 +69,22 @@ pip install --upgrade pip
|
|||||||
# -----------------------------
|
# -----------------------------
|
||||||
NDPIDIR="/tmp/nDPI"
|
NDPIDIR="/tmp/nDPI"
|
||||||
|
|
||||||
|
patch_ndpi_pack_on_if_needed() {
|
||||||
|
local py_dir="$1"
|
||||||
|
if [ -f "$py_dir/pyproject.toml" ] && grep -q "PACK_ON" "$py_dir/pyproject.toml"; then
|
||||||
|
sed -i 's/PACK_ON/"0.0.0"/g' "$py_dir/pyproject.toml"
|
||||||
|
echo "==> Applied PACK_ON workaround in pyproject.toml"
|
||||||
|
fi
|
||||||
|
if [ -f "$py_dir/setup.cfg" ] && grep -q "PACK_ON" "$py_dir/setup.cfg"; then
|
||||||
|
sed -i 's/PACK_ON/0.0.0/g' "$py_dir/setup.cfg"
|
||||||
|
echo "==> Applied PACK_ON workaround in setup.cfg"
|
||||||
|
fi
|
||||||
|
if [ -f "$py_dir/setup.py" ] && grep -q "PACK_ON" "$py_dir/setup.py"; then
|
||||||
|
sed -i "s/PACK_ON/'0.0.0'/g" "$py_dir/setup.py"
|
||||||
|
echo "==> Applied PACK_ON workaround in setup.py"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if ! ldconfig -p | grep -q "libndpi"; then
|
if ! ldconfig -p | grep -q "libndpi"; then
|
||||||
echo "==> Build and install nDPI library"
|
echo "==> Build and install nDPI library"
|
||||||
rm -rf "$NDPIDIR"
|
rm -rf "$NDPIDIR"
|
||||||
@@ -95,12 +112,16 @@ if [ -d "$NDPIDIR/python" ]; then
|
|||||||
echo "==> WARNING: failed to install nDPI python dev_requirements"
|
echo "==> WARNING: failed to install nDPI python dev_requirements"
|
||||||
fi
|
fi
|
||||||
if ! python3 -m pip install .; then
|
if ! python3 -m pip install .; then
|
||||||
echo "==> WARNING: nDPI Python bindings install failed, backend will run without DPI enrichment"
|
echo "==> Initial nDPI pip install failed; retrying with PACK_ON workaround"
|
||||||
else
|
patch_ndpi_pack_on_if_needed "$NDPIDIR/python"
|
||||||
if python - <<'PY'
|
if ! python3 -m pip install .; then
|
||||||
|
echo "==> WARNING: nDPI Python bindings install failed, backend will run without DPI enrichment"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if python - <<'PY'
|
||||||
import importlib
|
import importlib
|
||||||
mods = []
|
mods = []
|
||||||
for name in ("ndpi", "pyndpi"):
|
for name in ("ndpi", "pyndpi", "nDPI"):
|
||||||
try:
|
try:
|
||||||
m = importlib.import_module(name)
|
m = importlib.import_module(name)
|
||||||
mods.append((name, getattr(m, "__file__", "unknown")))
|
mods.append((name, getattr(m, "__file__", "unknown")))
|
||||||
@@ -110,11 +131,10 @@ if not mods:
|
|||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
print("nDPI Python modules:", mods)
|
print("nDPI Python modules:", mods)
|
||||||
PY
|
PY
|
||||||
then
|
then
|
||||||
echo "==> nDPI Python import check passed"
|
echo "==> nDPI Python import check passed"
|
||||||
else
|
else
|
||||||
echo "==> WARNING: nDPI installed but import failed in backend venv"
|
echo "==> WARNING: nDPI installed but import failed in backend venv"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
cd "$BACKEND_DIR"
|
cd "$BACKEND_DIR"
|
||||||
fi
|
fi
|
||||||
@@ -246,6 +266,19 @@ FRONTEND_DIR="$APP_DIR/frontend"
|
|||||||
BACKEND_DIR="$APP_DIR/backend"
|
BACKEND_DIR="$APP_DIR/backend"
|
||||||
BACKEND_SERVICE="mitm-backend"
|
BACKEND_SERVICE="mitm-backend"
|
||||||
|
|
||||||
|
patch_ndpi_pack_on_if_needed() {
|
||||||
|
local py_dir="$1"
|
||||||
|
if [ -f "$py_dir/pyproject.toml" ] && grep -q "PACK_ON" "$py_dir/pyproject.toml"; then
|
||||||
|
sed -i 's/PACK_ON/"0.0.0"/g' "$py_dir/pyproject.toml"
|
||||||
|
fi
|
||||||
|
if [ -f "$py_dir/setup.cfg" ] && grep -q "PACK_ON" "$py_dir/setup.cfg"; then
|
||||||
|
sed -i 's/PACK_ON/0.0.0/g' "$py_dir/setup.cfg"
|
||||||
|
fi
|
||||||
|
if [ -f "$py_dir/setup.py" ] && grep -q "PACK_ON" "$py_dir/setup.py"; then
|
||||||
|
sed -i "s/PACK_ON/'0.0.0'/g" "$py_dir/setup.py"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
cd $APP_DIR
|
cd $APP_DIR
|
||||||
git reset --hard
|
git reset --hard
|
||||||
git pull
|
git pull
|
||||||
@@ -261,18 +294,22 @@ source venv/bin/activate
|
|||||||
NDPIDIR="/tmp/nDPI"
|
NDPIDIR="/tmp/nDPI"
|
||||||
if [ ! -d "$NDPIDIR/python" ]; then
|
if [ ! -d "$NDPIDIR/python" ]; then
|
||||||
rm -rf "$NDPIDIR"
|
rm -rf "$NDPIDIR"
|
||||||
git clone --branch dev --depth 1 https://github.com/ntop/nDPI.git "$NDPIDIR"
|
git clone --depth 1 https://github.com/ntop/nDPI.git "$NDPIDIR"
|
||||||
fi
|
fi
|
||||||
if [ -d "/tmp/nDPI/python" ]; then
|
if [ -d "/tmp/nDPI/python" ]; then
|
||||||
cd "$NDPIDIR/python"
|
cd "$NDPIDIR/python"
|
||||||
python3 -m pip install --upgrade pip
|
python3 -m pip install --upgrade pip
|
||||||
python3 -m pip install -r dev_requirements.txt || true
|
python3 -m pip install -r dev_requirements.txt || true
|
||||||
if ! python3 -m pip install .; then
|
if ! python3 -m pip install .; then
|
||||||
echo "WARNING: nDPI Python bindings install failed during runner build"
|
echo "WARNING: Initial nDPI install failed during runner build; retry with PACK_ON workaround"
|
||||||
else
|
patch_ndpi_pack_on_if_needed "$NDPIDIR/python"
|
||||||
python - <<'PY' || echo "WARNING: nDPI import check failed during runner build"
|
if ! python3 -m pip install .; then
|
||||||
|
echo "WARNING: nDPI Python bindings install failed during runner build"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
python - <<'PY' || echo "WARNING: nDPI import check failed during runner build"
|
||||||
import importlib
|
import importlib
|
||||||
for name in ("ndpi", "pyndpi"):
|
for name in ("ndpi", "pyndpi", "nDPI"):
|
||||||
try:
|
try:
|
||||||
m = importlib.import_module(name)
|
m = importlib.import_module(name)
|
||||||
print("nDPI import OK:", name, getattr(m, "__file__", "unknown"))
|
print("nDPI import OK:", name, getattr(m, "__file__", "unknown"))
|
||||||
@@ -281,7 +318,6 @@ for name in ("ndpi", "pyndpi"):
|
|||||||
pass
|
pass
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
PY
|
PY
|
||||||
fi
|
|
||||||
cd $BACKEND_DIR
|
cd $BACKEND_DIR
|
||||||
fi
|
fi
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|||||||
Reference in New Issue
Block a user