|
| 1 | +# Port Conflict Resolution - Automatic Handling |
| 2 | + |
| 3 | +## What Was Fixed |
| 4 | + |
| 5 | +Your Local Nexus Controller now automatically handles port conflicts on startup. You'll never have to manually kill processes again. |
| 6 | + |
| 7 | +## What Changed |
| 8 | + |
| 9 | +All startup scripts now include automatic port conflict detection and resolution: |
| 10 | + |
| 11 | +### Updated Scripts |
| 12 | + |
| 13 | +1. **run.ps1** - Manual startup script |
| 14 | + - Automatically detects processes using port 5010 |
| 15 | + - Stops conflicting processes before starting |
| 16 | + - Shows clear status messages |
| 17 | + |
| 18 | +2. **start.bat** - Windows batch file startup |
| 19 | + - Calls run.ps1 with port conflict handling |
| 20 | + - Works from any location |
| 21 | + |
| 22 | +3. **tools/auto_start_controller.ps1** - Auto-start on boot |
| 23 | + - Handles port conflicts during Windows startup |
| 24 | + - Ensures clean application start after reboot |
| 25 | + |
| 26 | +4. **tools/auto_start_and_launch_all.ps1** - Full automation |
| 27 | + - Clears port conflicts |
| 28 | + - Starts controller |
| 29 | + - Launches all registered services |
| 30 | + |
| 31 | +5. **tools/setup_auto_start.ps1** - Auto-start setup |
| 32 | + - Now uses the improved controller script |
| 33 | + - Configures Windows Task Scheduler properly |
| 34 | + |
| 35 | +## How It Works |
| 36 | + |
| 37 | +When you start the application: |
| 38 | + |
| 39 | +1. Script checks if port 5010 is in use |
| 40 | +2. If a process is found, it's automatically stopped |
| 41 | +3. A brief pause ensures the port is released |
| 42 | +4. Your application starts cleanly |
| 43 | + |
| 44 | +## Setup Auto-Start on Reboot |
| 45 | + |
| 46 | +To ensure the controller starts automatically when you reboot Windows: |
| 47 | + |
| 48 | +### Run Setup Script |
| 49 | + |
| 50 | +```powershell |
| 51 | +cd tools |
| 52 | +.\setup_auto_start.ps1 |
| 53 | +``` |
| 54 | + |
| 55 | +This will: |
| 56 | +- Configure Windows Task Scheduler |
| 57 | +- Create necessary startup files |
| 58 | +- Set up automatic port conflict resolution |
| 59 | +- Start the controller on user login |
| 60 | + |
| 61 | +### Verify Auto-Start |
| 62 | + |
| 63 | +After setup, check the status: |
| 64 | + |
| 65 | +```powershell |
| 66 | +Get-ScheduledTask -TaskName "Local Nexus Controller" |
| 67 | +``` |
| 68 | + |
| 69 | +### Disable Auto-Start |
| 70 | + |
| 71 | +If you need to disable it: |
| 72 | + |
| 73 | +```powershell |
| 74 | +cd tools |
| 75 | +.\disable_auto_start.ps1 |
| 76 | +``` |
| 77 | + |
| 78 | +## Manual Startup |
| 79 | + |
| 80 | +You can still start the controller manually anytime: |
| 81 | + |
| 82 | +### Option 1: PowerShell |
| 83 | +```powershell |
| 84 | +.\run.ps1 |
| 85 | +``` |
| 86 | + |
| 87 | +### Option 2: Batch File |
| 88 | +```batch |
| 89 | +start.bat |
| 90 | +``` |
| 91 | + |
| 92 | +Both methods now include automatic port conflict resolution. |
| 93 | + |
| 94 | +## What Happens on Reboot |
| 95 | + |
| 96 | +After configuring auto-start: |
| 97 | + |
| 98 | +1. You log in to Windows |
| 99 | +2. Task Scheduler launches the controller |
| 100 | +3. Port conflicts are automatically resolved |
| 101 | +4. Application starts cleanly |
| 102 | +5. Dashboard is available at http://127.0.0.1:5010 |
| 103 | + |
| 104 | +## Troubleshooting |
| 105 | + |
| 106 | +### If the application won't start: |
| 107 | + |
| 108 | +1. Check if Python is in your PATH: |
| 109 | + ```powershell |
| 110 | + python --version |
| 111 | + ``` |
| 112 | + |
| 113 | +2. Verify the virtual environment exists: |
| 114 | + ```powershell |
| 115 | + Test-Path .\.venv |
| 116 | + ``` |
| 117 | + |
| 118 | +3. Reinstall dependencies: |
| 119 | + ```powershell |
| 120 | + .\.venv\Scripts\python.exe -m pip install -r requirements.txt |
| 121 | + ``` |
| 122 | + |
| 123 | +### View Task Scheduler logs: |
| 124 | + |
| 125 | +```powershell |
| 126 | +Get-ScheduledTask -TaskName "Local Nexus Controller" | Get-ScheduledTaskInfo |
| 127 | +``` |
| 128 | + |
| 129 | +## Next Steps |
| 130 | + |
| 131 | +Your system is now fully configured for: |
| 132 | +- Automatic port conflict resolution |
| 133 | +- Clean startup on reboot |
| 134 | +- Reliable operation |
| 135 | + |
| 136 | +Just run the setup script once, and everything will work automatically going forward. |
0 commit comments