Files
powershell-scripts/DEPLOYMENT_DUALPATH.md
cproudlock 96cb1dd946 Remove all emojis from markdown documentation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-10 11:03:45 -05:00

5.3 KiB

DualPath Feature Deployment Guide

Date: 2025-09-08

Overview

This deployment adds DualPath PC management capabilities to track PCs that control two machines.

Pre-Deployment Checklist

  • Backup database
  • Backup current production files
  • Test on staging environment first
  • Schedule maintenance window

Step 1: Database Migration (CRITICAL - DO FIRST!)

# On production server
mysql -u your_user -p shopdb < dualpath_migration.sql

Step 2: PHP Files to Update

/var/www/html/dashboard-v2/api.php

Changes:

  • Added 3 new API endpoints: getDualPathAssignments, saveDualPathAssignment, deleteDualPathAssignment
  • Updated getMachineList() to include DualPath relationships
  • Updated getAssets() to include has_dualpath field
  • Fixed boolean conversion for PowerShell data (strtolower for True/False)
  • Fixed MachineNo field mapping

Key sections modified:

  • Lines 224-235: New case statements for DualPath endpoints
  • Lines 1153-1264: New DualPath management methods
  • Lines 1266-1319: Updated getMachineList with DualPath support
  • Lines 1940-1941: Fixed boolean conversion for GE registry fields
  • Lines 2732-2766: Updated getAssets query with DualPath fields

Step 3: JavaScript Files to Update

/var/www/html/dashboard-v2/js/components/tables.js

Changes:

  • Updated renderMachinesTable() to show DualPath relationships
  • Updated renderAssetsTable() to show DualPath badge

Key sections modified:

  • Lines 449-459: Machine hostname display logic
  • Line 248: Asset machine number with DualPath badge

/var/www/html/dashboard-v2/js/pages/machines.js

Changes:

  • Added DualPath indicators in machine details modal
  • Shows warning for DualPath enabled PCs
  • Suggests adjacent machine assignments

Key sections modified:

  • Lines 1947-1967: DualPath status display with alerts

/var/www/html/dashboard-v2/js/components/charts.js

Changes:

  • Added shopfloorApps chart configuration
  • Created shopfloor applications chart method

Key sections modified:

  • Lines 33-37: Added shopfloorApps chart config
  • Lines 156-158: Added case for shopfloorApps
  • Lines 585-650: New createShopfloorAppsChart method

/var/www/html/dashboard-v2/js/pages/summary.js

Changes:

  • Added shopfloor applications chart loading
  • Fixed API call method (request vs get)

Key sections modified:

  • Lines 412: Call to createShopfloorAppsChart
  • Lines 430-444: New createShopfloorAppsChart method

/var/www/html/dashboard-v2/index.html

Changes:

  • Added Shopfloor Applications chart card

Key sections modified:

  • Lines 300-308: New shopfloor applications chart card

Step 4: PowerShell Files to Update (For Client Deployment)

/home/camp/asset_data/fin/Update-PC-CompleteAsset.ps1

Changes:

  • Fixed Unicode arrow character ( to ->)
  • Integrated application detection for shopfloor PCs

/home/camp/asset_data/fin/Get-ShopfloorConfig.ps1

Changes:

  • Added Get-InstalledApplications function
  • Added UDC/CLM process detection

/home/camp/asset_data/fin/Deploy-And-Run.bat

Changes:

  • Added credential configuration variables
  • Fixed authentication for remote execution

Step 5: Deployment Commands

# 1. Connect to production server
ssh your_server

# 2. Backup current files
cd /var/www/html/dashboard-v2
tar -czf backup_$(date +%Y%m%d_%H%M%S).tar.gz api.php js/ index.html

# 3. Run database migration
mysql -u your_user -p shopdb < /path/to/dualpath_migration.sql

# 4. Copy updated files
# Copy all PHP and JS files from development to production

# 5. Clear any caches
# If using opcache
service php-fpm reload

# 6. Test the deployment
curl http://your_server/dashboard-v2/api.php?action=getDualPathAssignments

Step 6: Verification Tests

  1. Check API endpoints:
# Test new DualPath endpoint
curl "http://your_server/dashboard-v2/api.php?action=getDualPathAssignments"
  1. Check Machines page:
  • Verify machines table shows DualPath indicators
  • Check that secondary machines show link icon
  1. Check Assets page:
  • Verify DualPath badge appears for enabled PCs
  1. Check Summary page:
  • Verify Shopfloor Applications chart loads
  1. Check Machine Details:
  • Open details for a DualPath-enabled PC
  • Verify DualPath section appears with warnings

Step 7: Post-Deployment

  1. Monitor error logs:
tail -f /var/log/apache2/error.log
tail -f /var/log/mysql/error.log
  1. Run PowerShell script on a test PC:
  • Verify GE registry and DualPath data saves correctly
  1. Manual DualPath assignment test:
  • Use API to assign a secondary machine
  • Verify it appears in machines table

Rollback Plan

If issues occur:

# 1. Restore database tables (if needed)
mysql -u your_user -p shopdb
DROP TABLE IF EXISTS pc_dualpath_assignments;
DROP VIEW IF EXISTS vw_machine_assignments;

# 2. Restore backed up files
cd /var/www/html/dashboard-v2
tar -xzf backup_[timestamp].tar.gz

# 3. Reload services
service apache2 reload
service php-fpm reload

Notes

  • The boolean conversion fix in api.php is critical for PowerShell data
  • DualPath assignments are manual until patterns are established
  • Monitor the first few PCs that report DualPath status
  • Consider creating a DualPath management UI page in future

Support

If issues arise:

  1. Check PHP error logs
  2. Verify database migration completed
  3. Clear browser cache
  4. Test API endpoints directly