fix(deploy): refine install.sh variables, pip upgrade, permissions, and active defaults based on review
This commit is contained in:
+17
-12
@@ -30,11 +30,12 @@ check_cmd() {
|
||||
|
||||
check_cmd tmux
|
||||
check_cmd python3
|
||||
check_cmd pip3
|
||||
|
||||
# Verify Python Version
|
||||
PYTHON_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
|
||||
if python3 -c "import sys; exit(0 if sys.version_info >= (3, 9) else 1)"; then
|
||||
PYTHON_MAJOR="${MIN_PYTHON_VERSION%%.*}"
|
||||
PYTHON_MINOR="${MIN_PYTHON_VERSION##*.}"
|
||||
if python3 -c "import sys; exit(0 if sys.version_info >= ($PYTHON_MAJOR, $PYTHON_MINOR) else 1)"; then
|
||||
echo "✅ Python $PYTHON_VERSION detected."
|
||||
else
|
||||
echo "❌ Error: Python version must be $MIN_PYTHON_VERSION or higher. Detected: $PYTHON_VERSION" >&2
|
||||
@@ -46,8 +47,10 @@ cd "$TARGET_DIR"
|
||||
echo "📂 Ensuring metadata directory structure (.mam/)..."
|
||||
mkdir -p .mam/jobs .mam/delegate_job_logs
|
||||
|
||||
# File permission lockdown on database directory
|
||||
chmod 0700 .mam
|
||||
# File permission lockdown on database directory (if owned by the current user to prevent multi-user system issues)
|
||||
if [ -O .mam ]; then
|
||||
chmod 0700 .mam
|
||||
fi
|
||||
|
||||
# --- 3. Check Network File System (NFS) Warnings ---
|
||||
echo "💾 Detecting file system mount type..."
|
||||
@@ -77,17 +80,18 @@ fi
|
||||
# shellcheck disable=SC1091
|
||||
source "$VENV_NAME"/bin/activate
|
||||
|
||||
# Upgrade pip
|
||||
pip install --upgrade pip
|
||||
|
||||
# Install requirements
|
||||
REQ_FILE=".agents/skills/multi-agent-mux-delegate-job/requirements.txt"
|
||||
if [ -f "$REQ_FILE" ]; then
|
||||
echo "📦 Installing backplane dependencies from $REQ_FILE..."
|
||||
pip install --upgrade pip
|
||||
pip install -r "$REQ_FILE"
|
||||
echo "✅ Dependencies installed successfully."
|
||||
else
|
||||
echo "⚠️ WARNING: Could not find requirements file: $REQ_FILE"
|
||||
echo " Installing default packages (paho-mqtt, pyyaml) manually..."
|
||||
pip install --upgrade pip
|
||||
pip install "paho-mqtt>=2.0.0" pyyaml
|
||||
fi
|
||||
|
||||
@@ -98,13 +102,15 @@ if [ ! -f "$ENV_FILE" ]; then
|
||||
if [ -f "$ENV_EXAMPLE" ]; then
|
||||
echo "📝 Creating configuration from $ENV_EXAMPLE..."
|
||||
cp "$ENV_EXAMPLE" "$ENV_FILE"
|
||||
chmod 0600 "$ENV_FILE"
|
||||
else
|
||||
echo "📝 Creating default $ENV_FILE..."
|
||||
cat <<EOF > "$ENV_FILE"
|
||||
# ==============================================================================
|
||||
# Multi-Agent Mux (MAM) Environment Settings
|
||||
# ==============================================================================
|
||||
touch "$ENV_FILE"
|
||||
fi
|
||||
|
||||
# Always append the active defaults to ensure they are set and not commented out
|
||||
cat <<EOF >> "$ENV_FILE"
|
||||
|
||||
# === Installer-applied active defaults ===
|
||||
MQTT_BROKER=broker.hivemq.com
|
||||
MQTT_PORT=1883
|
||||
MQTT_TLS=0
|
||||
@@ -112,7 +118,6 @@ MQTT_CLIENT_ID_PREFIX=mam-agent
|
||||
TMUX_SERVER_NAME=default
|
||||
EOF
|
||||
chmod 0600 "$ENV_FILE"
|
||||
fi
|
||||
echo "✅ Config file .env initialized with chmod 0600."
|
||||
else
|
||||
echo "ℹ️ $ENV_FILE already exists. Skipping config override."
|
||||
|
||||
Reference in New Issue
Block a user