|
| 1 | +# Managing IP Changes |
| 2 | + |
| 3 | +When you connect to a new network (different WiFi, mobile hotspot, or office network), your computer's IP address changes. This means the endpoint URLs in the AI MultiBarcode Capture app need to be updated to maintain connectivity with the web management system. |
| 4 | + |
| 5 | +## 🔧 Quick Solution |
| 6 | + |
| 7 | +The system includes automatic IP update scripts that detect your new network IP and update the Docker container configuration. |
| 8 | + |
| 9 | +### Windows Users |
| 10 | + |
| 11 | +Run the following script in the `WebInterface` directory: |
| 12 | + |
| 13 | +```batch |
| 14 | +update-network-ip.bat |
| 15 | +``` |
| 16 | + |
| 17 | +### Linux/macOS Users |
| 18 | + |
| 19 | +Run the following script in the `WebInterface` directory: |
| 20 | + |
| 21 | +```bash |
| 22 | +./update-network-ip.sh |
| 23 | +``` |
| 24 | + |
| 25 | +## 📋 What These Scripts Do |
| 26 | + |
| 27 | +1. **Detect New IP**: Automatically detect your current network IP address |
| 28 | +2. **Update Container**: Restart the Docker container with the new IP configuration |
| 29 | +3. **Preserve Data**: All your barcode sessions and data remain intact |
| 30 | +4. **Update Endpoints**: The web interface will show the correct new endpoint URLs |
| 31 | + |
| 32 | +## 🎯 When to Use |
| 33 | + |
| 34 | +Use these scripts whenever you: |
| 35 | + |
| 36 | +- Connect to a different WiFi network |
| 37 | +- Switch from WiFi to mobile hotspot |
| 38 | +- Move between office locations |
| 39 | +- Experience connectivity issues with the Android app |
| 40 | + |
| 41 | +## ⚡ Step-by-Step Process |
| 42 | + |
| 43 | +### For Windows: |
| 44 | + |
| 45 | +1. Open Command Prompt or PowerShell |
| 46 | +2. Navigate to the WebInterface directory: |
| 47 | + ``` |
| 48 | + cd path\to\AI_MultiBarcode_Capture\WebInterface |
| 49 | + ``` |
| 50 | +3. Run the update script: |
| 51 | + ``` |
| 52 | + update-network-ip.bat |
| 53 | + ``` |
| 54 | +4. Wait for the script to complete (typically 30-60 seconds) |
| 55 | + |
| 56 | +### For Linux/macOS: |
| 57 | + |
| 58 | +1. Open Terminal |
| 59 | +2. Navigate to the WebInterface directory: |
| 60 | + ``` |
| 61 | + cd path/to/AI_MultiBarcode_Capture/WebInterface |
| 62 | + ``` |
| 63 | +3. Run the update script: |
| 64 | + ``` |
| 65 | + ./update-network-ip.sh |
| 66 | + ``` |
| 67 | +4. Wait for the script to complete (typically 30-60 seconds) |
| 68 | + |
| 69 | +## 📱 Updating Your Android App |
| 70 | + |
| 71 | +After running the IP update script: |
| 72 | + |
| 73 | +1. **Open the web interface** at `http://localhost:3500` |
| 74 | +2. **Click the Settings (⚙️) button** in the top-right corner |
| 75 | +3. **Click "🔗 Endpoint Configuration"** |
| 76 | +4. **Copy the new Local Network Endpoint** (it will show your new IP address) |
| 77 | +5. **Open the AI MultiBarcode Capture app** on your Android device |
| 78 | +6. **Go to Settings → Server Configuration** |
| 79 | +7. **Paste the new endpoint URL** |
| 80 | +8. **Test the connection** to verify it works |
| 81 | + |
| 82 | +## 🔍 Verifying the Update |
| 83 | + |
| 84 | +After running the script, you can verify it worked by: |
| 85 | + |
| 86 | +1. **Check the script output** - it should show "Network IP updated to: [YOUR_NEW_IP]" |
| 87 | +2. **Visit the web interface** at `http://localhost:3500` |
| 88 | +3. **Check the endpoint configuration** - it should show your new IP address |
| 89 | +4. **Test Android connectivity** by scanning a barcode |
| 90 | + |
| 91 | +## 🛠️ Technical Details |
| 92 | + |
| 93 | +The scripts perform these operations: |
| 94 | + |
| 95 | +1. **IP Detection**: Use system commands (`ipconfig` on Windows, `hostname -I` on Linux) to detect the current network IP |
| 96 | +2. **Container Restart**: Stop and remove the current Docker container |
| 97 | +3. **Reconfiguration**: Start a new container with the updated `HOST_IP` environment variable |
| 98 | +4. **Data Preservation**: Reuse the same MySQL data volume to preserve all sessions and barcodes |
| 99 | + |
| 100 | +## ⚠️ Important Notes |
| 101 | + |
| 102 | +- **No Data Loss**: Your barcode sessions and data are preserved during the update |
| 103 | +- **Brief Downtime**: The web interface will be unavailable for 30-60 seconds during the container restart |
| 104 | +- **Automatic Detection**: The scripts automatically detect common private IP ranges (192.168.x.x, 10.x.x.x, 172.x.x.x) |
| 105 | +- **No User Interaction**: The scripts run completely automatically without prompting for input |
| 106 | + |
| 107 | +## 🔧 Troubleshooting |
| 108 | + |
| 109 | +### Script Won't Run |
| 110 | +- **Windows**: Ensure you're running as Administrator if you get permission errors |
| 111 | +- **Linux/macOS**: Make sure the script is executable with `chmod +x update-network-ip.sh` |
| 112 | + |
| 113 | +### Container Won't Start |
| 114 | +- **Check Docker**: Ensure Docker Desktop is running |
| 115 | +- **Port Conflicts**: Make sure port 3500 isn't being used by another application |
| 116 | +- **Check Logs**: Run `docker logs multibarcode-webinterface` to see error messages |
| 117 | + |
| 118 | +### IP Not Detected |
| 119 | +- The script will fall back to `127.0.0.1` if it can't detect your IP |
| 120 | +- You can manually check your IP with `ipconfig` (Windows) or `ip addr` (Linux) |
| 121 | +- Ensure you're connected to a network with a valid IP address |
| 122 | + |
| 123 | +### Android App Still Can't Connect |
| 124 | +- **Double-check the endpoint URL** in the Android app settings |
| 125 | +- **Verify both devices are on the same network** |
| 126 | +- **Check firewall settings** that might block connections |
| 127 | +- **Try the internet endpoint** if local network endpoint doesn't work |
| 128 | + |
| 129 | +## 📚 Related Documentation |
| 130 | + |
| 131 | +- **[Docker WMS Deployment](10-Docker-WMS-Deployment.md)** - Initial setup and deployment |
| 132 | +- **[Android App Configuration](07-Android-App-Configuration.md)** - Configuring the mobile app |
| 133 | +- **[Troubleshooting Guide](15-Troubleshooting-Guide.md)** - General troubleshooting help |
| 134 | + |
| 135 | +--- |
| 136 | + |
| 137 | +**💡 Tip**: Consider bookmarking this page or keeping the script location handy, as network changes are common when working with mobile devices in different locations. |
0 commit comments