- Added StateManager and data_model modules to manage application state. - Updated ApiHandler to utilize StateManager for WebSocket connections. - Enhanced Server initialization to include StateManager. - Implemented Docker container querying in Neode UI to populate app data dynamically. - Removed temporary dummy app configurations in favor of real Docker-based applications. - Improved WebSocket reconnection logic and error handling in the UI. - Updated package.json and package-lock.json to include dockerode dependency.
4.1 KiB
4.1 KiB
Real Docker Integration Complete
Summary
The mock backend now queries real Docker containers instead of returning dummy data. When you start the dev server, it will show actual running Docker containers in the "My Apps" section.
Changes Made
1. Mock Backend (mock-backend.js)
- ✅ Added
dockerodepackage for Docker API access - ✅ Added
getDockerContainers()function to query running containers - ✅ Mapcontainer names to app IDs (archy-bitcoin → bitcoin, etc.)
- ✅ Initialize package data from Docker on startup
- ✅ Poll Docker every 5 seconds and broadcast updates via WebSocket
- ✅ Removed hardcoded dummy Bitcoin data
2. Apps View (Apps.vue)
- ✅ Removed all dummy app logic
- ✅ Removed dummyApps import
- ✅ Removed external API fetching (Start9 registry, GitHub)
- ✅ Now uses only real packages from store
- ✅ Clean console logs - no more "Returning dummy apps"
3. Package Dependencies
- ✅ Installed
dockerodefor Docker API integration
How It Works
Backend Startup
1. Mock backend starts
2. Connects to Docker API
3. Queries running containers
4. Maps container names to app IDs
5. Builds package data from containers
6. Broadcasts to connected UI clients
Live Updates
Every 5 seconds:
1. Query Docker containers
2. Update package data
3. Broadcast changes via WebSocket
4. UI automatically updates
Container Detection
The backend looks for containers with these names:
archy-bitcoin→ bitcoinarchy-btcpay→ btcpay-serverarchy-homeassistant→ homeassistantarchy-grafana→ grafanaarchy-endurain→ endurainarchy-fedimint→ fedimintarchy-morphos→ morphos-serverarchy-lnd→ lightning-stackarchy-mempool-web→ mempoolarchy-ollama→ ollamaarchy-searxng→ searxngarchy-onlyoffice→ onlyofficearchy-penpot-frontend→ penpot
Testing
Start Backend
cd neode-ui
npm run backend:mock
Expected Output:
[Docker] Querying running containers...
[Docker] Found 0 containers (0 running)
[Docker] No containers found. Start docker-compose to see apps.
Start Bitcoin Core
docker compose up -d bitcoin
Check Backend Logs
Within 5 seconds, you should see:
[Docker] Found 1 containers (1 running)
[Docker] Apps detected:
- Bitcoin Core (running) → http://localhost:18443
Start UI
cd neode-ui
npm run dev
Open http://localhost:8100 and navigate to "My Apps"
Expected Result:
- ✅ Bitcoin Core appears in the list
- ✅ Shows as "running"
- ✅ Has correct icon and description
- ✅ Launch button appears
- ✅ Clicking launch opens http://localhost:18443
Console Output
Before (Dummy Apps)
[Apps] Real packages from store: 0 apps: []
[Apps] Dummy apps available: 13 apps: ['bitcoin', 'btcpay-server', ...]
[Apps] Returning dummy apps
After (Real Docker)
[Apps] Real packages from store: 1 apps
No more dummy app noise!
Start All Apps
To see all apps:
# Start specific apps
docker compose up -d bitcoin btcpay homeassistant grafana
# Or start everything
docker compose up -d
Each container will automatically appear in "My Apps" within 5 seconds.
App States
The backend correctly detects:
- ✅ Running containers → state: "running", Launch button enabled
- ✅ Stopped containers → state: "stopped", Start button shown
- ✅ Ports → Extracted from Docker and shown in interface-addresses
- ✅ Metadata → Title, description, icon from predefined mapping
Future Enhancements
- Add start/stop/restart actions via Docker API
- Add resource usage (CPU, memory) from Docker stats
- Add container logs viewer
- Add health check status
- Support docker-compose scale operations
File Changes
neode-ui/package.json- Added dockerode dependencyneode-ui/mock-backend.js- Docker integrationneode-ui/src/views/Apps.vue- Removed dummy app logic
Status: ✅ Complete - Dev server now shows real Docker containers
Testing: Start with npm run backend:mock and docker compose up -d bitcoin