-
Notifications
You must be signed in to change notification settings - Fork 2
Add setup script for one-command local environment bootstrap #58
Copy link
Copy link
Open
Description
User Story
As a team member (or future contributor), I want to run a single command to bootstrap the full local development environment, so that I don't have to manually fix permissions, check port availability, or wait-and-guess whether services are healthy.
Context
The current setup is almost turnkey — all config files are checked into the repo and docker compose build && docker compose up gets most of the way there. But several manual steps and tribal knowledge remain:
- Permission fixes (
chmod -R 777 addons etc postgresql) are documented in the README but easy to miss - Credentials are hardcoded across 4+ files with no single source of truth — changing a password means editing
docker-compose.yml:42,docker-compose.yml:63,etc/odoo.conf:60, andopenems-backend/config.d/Metadata/Odoo.config:10at minimum - No
.envor.env.exampleexists - No health check or readiness verification — you watch logs and hope
- Odoo OpenEMS addon must be manually installed via the web UI after first boot (Settings → Apps → Install)
- The README mixes Odoo boilerplate docs (inherited from the template) with actual project setup instructions
This ticket captures the intent to script all of this. Priority is low — it should land after #56 (InfluxDB) since that changes docker-compose.yml and adds a new service. The setup script can incorporate InfluxDB from the start rather than needing a follow-up update.
Acceptance Criteria
-
.env.examplefile exists with all configurable values (DB passwords, Odoo master password, ports, AWS RDS host) and inline comments -
./setup.sh(ormake setup) copies.env.example→.envif missing, fixes directory permissions, runsdocker compose build -
./setup.shstarts services and waits for health checks (Odoo responds on 10016, backend on 8082, edge on 8085) before printing a success summary - Credentials in
docker-compose.yml,etc/odoo.conf, andopenems-backend/config.d/Metadata/Odoo.configare templated from.env(via docker-composeenv_fileor variable substitution) - OpenEMS Odoo addon auto-installs on first boot (via Odoo XML-RPC API call in setup script, or
odoo -i openemsentrypoint flag) - README updated: quick start reduced to
git clone && ./setup.sh, Odoo template boilerplate removed or moved to a separate doc
Out of Scope
- Deferred: CI/CD pipeline changes (AWS deployment uses different config path)
- Deferred: Secret management for production (Secrets Manager, Vault, etc.)
- Not doing: Windows-specific setup (Docker Desktop on macOS/Linux is the target)
- Not doing: Auto-updating JAR files from OpenEMS releases
Dev Notes
Current state — credentials scattered across files
| File | Line(s) | Credential |
|---|---|---|
docker-compose.yml |
15-19 | AWS RDS host, DB user/password |
docker-compose.yml |
41-42 | Odoo Postgres user/password (Icui4cyou) |
docker-compose.yml |
62-63 | Odoo entrypoint user/password |
etc/odoo.conf |
60 | Odoo admin/master password (openemspassword) |
openems-backend/config.d/Metadata/Odoo.config |
2-5 | Backend→Postgres creds |
openems-backend/config.d/Metadata/Odoo.config |
7,10 | Backend→Odoo creds (note: odooPassword appears twice, line 10 overrides line 7) |
Recommended approach
- Create
.env.examplewith variables likeODOO_DB_PASSWORD,ODOO_ADMIN_PASSWORD,OPENEMS_DB_PASSWORD, etc. - Use docker-compose variable substitution (
${ODOO_DB_PASSWORD}) indocker-compose.ymland mount.envviaenv_file - Template OSGi configs — either use
envsubstin the backend Dockerfile entrypoint to renderOdoo.configfrom env vars, or use a simple sed substitution in the setup script before build - Health checks —
curl --retryagainst known endpoints:- Odoo:
http://localhost:10016/web/login - Backend:
http://localhost:8082(UI websocket port) - Edge:
http://localhost:8085(edge websocket)
- Odoo:
- Odoo addon auto-install — Odoo supports
-i openemsflag on the command line to auto-install a module on startup. Alternatively, usexmlrpcto callinstall_moduleafter boot.
Key files
docker-compose.yml:1-110— service definitions, hardcoded credsetc/odoo.conf:60— Odoo master passwordopenems-backend/config.d/Metadata/Odoo.config:1-11— backend→Odoo connection configREADME.md:92-163— current setup instructions (mostly Odoo template boilerplate).env.example— createsetup.sh— create
References
- Depends on: Add InfluxDB container and wire backend timedata persistence #56 (InfluxDB) — should land first since it modifies
docker-compose.yml - Odoo CLI module install:
odoo -d <dbname> -i <module>(Odoo docs) - Docker Compose env_file: https://docs.docker.com/compose/how-tos/environment-variables/set-environment-variables/
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels