PR #1673 revealed that enterprise apps have compose: [] in the local DB (encrypted in the enterprise field), which unearthed multiple critical bugs in the redeployment and recovery logic.
Issues Fixed
1. Repeated Redeployments Every 12 Minutes
reinstallOldApplicationswas comparingappSpecifications.hashvsinstalledApp.hashdecryptEnterpriseAppscalledspecificationFormatter()which strips metadata (hash, height, instances, expire)- Result:
installedApp.hashwasundefined, causing false positive "obsolete" detection - Fix: Added
formatSpecsoption (default: true for backward compatibility),getInstalledAppsFromDbnow passesformatSpecs: falseto preserve metadata
2. Missing Container Recovery
- When containers were missing (not just stopped), no recovery mechanism existed
- Fix: Added
recreateMissingContainers()topeerNotification.jsthat reinstalls components when containers don't exist
3. Syncthing Delay Applied Incorrectly
- Apps with syncthing flags (r:, g:) would wait 30 minutes before recreation even when containers were completely missing
- The delay is meant for stopped containers to allow data syncing, not missing containers
- Fix: Check container existence first; only apply 30-minute delay if container exists but is stopped
4. Component Redeployment Crashes
softUninstallComponentandhardUninstallComponentcalled withnullappId causing crashes- Fix: Calculate appId using
dockerService.getAppIdentifier()before calling uninstall functions - Fix: Pass
appComponentinstead ofappSpecificationsas third parameter
5. Hard Redeployment Broken for Enterprise Apps
hardRedeployComponentloaded specs fromgetStrictApplicationSpecifications(doesn't decrypt)- Then tried to access empty
composearray - Fix: Added decryption check before accessing compose array
6. Soft Redeployment Component Broken for Enterprise Apps
softRedeployComponenthad the same issue as hardRedeployComponent- Loaded specs without decryption, then tried to access empty compose array
- Fix: Added decryption check before accessing compose array
7. stopAppMonitoring Parameter Bugs
softUninstallComponentcalled with booleantrueinstead of the actualstopAppMonitoringfunction (fixed in previous commit)hardUninstallComponentalso called with booleantrueinstead of function- Both functions invoke
stopAppMonitoring()as a function, so passingtruewould crash with "true is not a function" - Fix: Pass the function reference, not a boolean
Testing
- Verified on nodes: 38.240.227.140, 162.55.241.211, 195.3.222.71, 148.251.229.179, 65.108.231.135, 176.9.31.60, 23.88.73.206
- Confirmed streamrnode apps no longer repeatedly redeploy
- Confirmed wordpress apps with syncthing now recreate immediately when containers are missing
- Confirmed syncthing apps are created but not started, then handleReceiveOnlyTransition starts them after sync
- Confirmed container recreation works for missing enterprise app containers
Related
- Builds on #1673 which identified the root cause (enterprise compose redaction)