Scale setup script to bootstrap N simulated Edge instances#65
Open
amalbet wants to merge 7 commits intofeature/rrd4j-fixfrom
Open
Scale setup script to bootstrap N simulated Edge instances#65amalbet wants to merge 7 commits intofeature/rrd4j-fixfrom
amalbet wants to merge 7 commits intofeature/rrd4j-fixfrom
Conversation
- Add InfluxDB 1.8 container with healthcheck and named volume - Replace Dummy timedata with InfluxDB provider (timedata0.config) - Remove embedded InfluxDB from backend Dockerfile (now separate container) - Volume-mount edge config.d to persist Felix configs across restarts - Fix Metadata/Odoo.config to use Docker service names (db, odoo16) - Fix edge backend controller apikey to match Odoo device registration - Include Felix runtime config updates (Core, Ess, Evcs, DynamicBindings) Closes #56, closes #57 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add --edges N flag (default: 1) to setup.sh that generates per-edge config directories, unique API keys, and a docker-compose.override.yml with N edge services. Key changes: - Parse --edges N flag with validation (1-9 range, port scheme limit) - generate_edge_config: copies template, regenerates UUIDs for factory configs, updates service.pid and LDAP target filters, writes apikey - generate_compose_override: creates override.yml disabling the default edge service and adding N uniquely-ported edge services - DB registration loops over N edges with generated apikeys - Verification and summary output extended for N edges - Portable sedi() helper for macOS/GNU sed compatibility - Fixes existing apikey mismatch bug (DEMO_API_KEY vs hardcoded key) Closes #64 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…x local DB config
…rden Odoo init - Expose port 8075 (B2B REST API) for meter discovery from billing engine - Assign admin user role to each edge in openems_device_user_role so all edges appear in the OpenEMS UI (not just edge0 from demo data) - Fix generate_apikey SIGPIPE: disable pipefail in subshell for tr|head pipe - Fix psql default database: use -d postgres for pg_database catalog query - Replace sleep 5 with retry loop for Odoo XML-RPC password change Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Odoo __system user (uid 1) cannot make XML-RPC calls, causing "Access Denied" errors when the backend tries to update edge metadata. The admin user (uid 2) has proper permissions for the openems.device model. This was the root cause of edges being connected but not visible in the OpenEMS UI — the backend couldn't sync connection state to Odoo. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Odoo's ORM filters out records where active is NULL (treats as archived). Raw SQL inserts were missing this field, making edge1/edge2 invisible to the OpenEMS UI even though they were connected at the backend level. Also set name_number (used by Odoo for display ordering). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--edges Nflag tosetup.sh(default: 1, max: 9) to bootstrap N independent Edge instancesdocker-compose.override.ymlwith N edge services on unique ports (edge i → 8{i}80/8{i}85)apikey="DEMO_API_KEY"but setup.sh hardcoded a different valueCloses #64
Changes
generate_apikey,generate_edge_config,generate_compose_override,generate_uuid,sedi), argument parsing for--edges N, loops for DB registration/verification/restartconfig-edge*/dirs anddocker-compose.override.ymlBug fixes included (discovered during integration testing)
Critical: Backend Odoo UID was wrong (
odooUid=1→odooUid=2)The backend's
Metadata/Odoo.confighadodooUid=I"1"— the Odoo__systemuser, which cannot make XML-RPC calls. This causedAccess Deniederrors on every edge metadata sync, making edges connected but invisible in the OpenEMS UI. Fixed toodooUid=I"2"(theadminuser). This affects all deployments, not just multi-edge.Edge device INSERT missing
active=trueOdoo's ORM has an implicit
active=Truefilter — records without it are treated as "archived" and hidden from all queries. The raw SQL INSERT for edge registration didn't set this field, so edge1/edge2 were invisible despite being fully connected at the backend level. Also addedname_numberfor proper display ordering.Port 8075 not exposed
The B2B REST API port (used by the billing engine for meter discovery) was missing from the docker-compose backend port mappings.
Setup script hardening
generate_apikey:tr </dev/urandom | head -c 20exits 141 withpipefail; fixed with subshellset +o pipefailsleep 5with a 12-attempt retry loop — Odoo takes 15-30s to accept XML-RPC on first boot-d postgresforpg_databasecatalog query (noodoodatabase exists by default)openems_device_user_roleso edges appear in the UIPort scheme
Test plan
./setup.sh(no flag) — bootstraps 1 edge, identical behavior to before./setup.sh --edges 3— generates 3 config dirs, 3 services in override, 3 DB entriesEdge.Websocket)Access Deniederrors in backend logs--edges 0,--edges 10,--edges abcare rejected with clear errorsopenems-edge/config.d/is not modifiedMerge order
PRs must merge bottom-up: #59 → #60 → #63 → #65
Dependencies
🤖 Generated with Claude Code