Update installer and service for venv

This commit is contained in:
Andrew Davison
2025-11-11 12:52:12 +00:00
parent fd7f64c346
commit c844391a4c
2 changed files with 12 additions and 9 deletions

View File

@@ -91,14 +91,17 @@ echo -e "${YELLOW}Step 6: Enabling service${NC}"
systemctl enable "$SERVICE_NAME"
echo -e "${GREEN}Enabled $SERVICE_NAME service${NC}"
echo -e "${YELLOW}Step 7: Installing Python dependencies${NC}"
# Install Python dependencies
if command -v pip3 &> /dev/null; then
pip3 install -r "$INSTALL_DIR/requirements.txt"
echo -e "${GREEN}Installed Python dependencies${NC}"
else
echo -e "${YELLOW}pip3 not found, please install dependencies manually${NC}"
fi
echo -e "${YELLOW}Step 7: Installing Python dependencies in virtual environment${NC}"
# Create virtual environment
python3 -m venv "$INSTALL_DIR/venv"
echo -e "${GREEN}Created virtual environment${NC}"
# Install dependencies in venv
"$INSTALL_DIR/venv/bin/pip" install -r "$INSTALL_DIR/requirements.txt"
echo -e "${GREEN}Installed Python dependencies${NC}"
# Update ownership of venv
chown -R "$SERVICE_USER:$SERVICE_GROUP" "$INSTALL_DIR/venv"
echo ""
echo -e "${GREEN}Installation completed successfully!${NC}"

View File

@@ -9,7 +9,7 @@ Type=simple
User=meshcore
Group=meshcore
WorkingDirectory=/opt/meshcore-bot
ExecStart=/usr/bin/python3 /opt/meshcore-bot/meshcore_bot.py
ExecStart=/opt/meshcore-bot/venv/bin/python /opt/meshcore-bot/meshcore_bot.py
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=10