fix(deploy): refine install.sh variables, pip upgrade, permissions, and active defaults based on review

This commit is contained in:
2026-06-23 08:32:02 +09:00
parent a10c789dc2
commit 82dcb78a85
+16 -11
View File
@@ -30,11 +30,12 @@ check_cmd() {
check_cmd tmux check_cmd tmux
check_cmd python3 check_cmd python3
check_cmd pip3
# Verify Python Version # Verify Python Version
PYTHON_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")') 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." echo "✅ Python $PYTHON_VERSION detected."
else else
echo "❌ Error: Python version must be $MIN_PYTHON_VERSION or higher. Detected: $PYTHON_VERSION" >&2 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/)..." echo "📂 Ensuring metadata directory structure (.mam/)..."
mkdir -p .mam/jobs .mam/delegate_job_logs mkdir -p .mam/jobs .mam/delegate_job_logs
# File permission lockdown on database directory # 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 chmod 0700 .mam
fi
# --- 3. Check Network File System (NFS) Warnings --- # --- 3. Check Network File System (NFS) Warnings ---
echo "💾 Detecting file system mount type..." echo "💾 Detecting file system mount type..."
@@ -77,17 +80,18 @@ fi
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source "$VENV_NAME"/bin/activate source "$VENV_NAME"/bin/activate
# Upgrade pip
pip install --upgrade pip
# Install requirements # Install requirements
REQ_FILE=".agents/skills/multi-agent-mux-delegate-job/requirements.txt" REQ_FILE=".agents/skills/multi-agent-mux-delegate-job/requirements.txt"
if [ -f "$REQ_FILE" ]; then if [ -f "$REQ_FILE" ]; then
echo "📦 Installing backplane dependencies from $REQ_FILE..." echo "📦 Installing backplane dependencies from $REQ_FILE..."
pip install --upgrade pip
pip install -r "$REQ_FILE" pip install -r "$REQ_FILE"
echo "✅ Dependencies installed successfully." echo "✅ Dependencies installed successfully."
else else
echo "⚠️ WARNING: Could not find requirements file: $REQ_FILE" echo "⚠️ WARNING: Could not find requirements file: $REQ_FILE"
echo " Installing default packages (paho-mqtt, pyyaml) manually..." echo " Installing default packages (paho-mqtt, pyyaml) manually..."
pip install --upgrade pip
pip install "paho-mqtt>=2.0.0" pyyaml pip install "paho-mqtt>=2.0.0" pyyaml
fi fi
@@ -98,13 +102,15 @@ if [ ! -f "$ENV_FILE" ]; then
if [ -f "$ENV_EXAMPLE" ]; then if [ -f "$ENV_EXAMPLE" ]; then
echo "📝 Creating configuration from $ENV_EXAMPLE..." echo "📝 Creating configuration from $ENV_EXAMPLE..."
cp "$ENV_EXAMPLE" "$ENV_FILE" cp "$ENV_EXAMPLE" "$ENV_FILE"
chmod 0600 "$ENV_FILE"
else else
echo "📝 Creating default $ENV_FILE..." echo "📝 Creating default $ENV_FILE..."
cat <<EOF > "$ENV_FILE" touch "$ENV_FILE"
# ============================================================================== fi
# Multi-Agent Mux (MAM) Environment Settings
# ============================================================================== # 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_BROKER=broker.hivemq.com
MQTT_PORT=1883 MQTT_PORT=1883
MQTT_TLS=0 MQTT_TLS=0
@@ -112,7 +118,6 @@ MQTT_CLIENT_ID_PREFIX=mam-agent
TMUX_SERVER_NAME=default TMUX_SERVER_NAME=default
EOF EOF
chmod 0600 "$ENV_FILE" chmod 0600 "$ENV_FILE"
fi
echo "✅ Config file .env initialized with chmod 0600." echo "✅ Config file .env initialized with chmod 0600."
else else
echo "$ENV_FILE already exists. Skipping config override." echo "$ENV_FILE already exists. Skipping config override."