Skip to content

Add setup script for one-command local environment bootstrap #58

@amalbet

Description

@amalbet

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, and openems-backend/config.d/Metadata/Odoo.config:10 at minimum
  • No .env or .env.example exists
  • 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

  1. .env.example file exists with all configurable values (DB passwords, Odoo master password, ports, AWS RDS host) and inline comments
  2. ./setup.sh (or make setup) copies .env.example.env if missing, fixes directory permissions, runs docker compose build
  3. ./setup.sh starts services and waits for health checks (Odoo responds on 10016, backend on 8082, edge on 8085) before printing a success summary
  4. Credentials in docker-compose.yml, etc/odoo.conf, and openems-backend/config.d/Metadata/Odoo.config are templated from .env (via docker-compose env_file or variable substitution)
  5. OpenEMS Odoo addon auto-installs on first boot (via Odoo XML-RPC API call in setup script, or odoo -i openems entrypoint flag)
  6. 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

  1. Create .env.example with variables like ODOO_DB_PASSWORD, ODOO_ADMIN_PASSWORD, OPENEMS_DB_PASSWORD, etc.
  2. Use docker-compose variable substitution (${ODOO_DB_PASSWORD}) in docker-compose.yml and mount .env via env_file
  3. Template OSGi configs — either use envsubst in the backend Dockerfile entrypoint to render Odoo.config from env vars, or use a simple sed substitution in the setup script before build
  4. Health checkscurl --retry against known endpoints:
    • Odoo: http://localhost:10016/web/login
    • Backend: http://localhost:8082 (UI websocket port)
    • Edge: http://localhost:8085 (edge websocket)
  5. Odoo addon auto-install — Odoo supports -i openems flag on the command line to auto-install a module on startup. Alternatively, use xmlrpc to call install_module after boot.

Key files

  • docker-compose.yml:1-110 — service definitions, hardcoded creds
  • etc/odoo.conf:60 — Odoo master password
  • openems-backend/config.d/Metadata/Odoo.config:1-11 — backend→Odoo connection config
  • README.md:92-163 — current setup instructions (mostly Odoo template boilerplate)
  • .env.example — create
  • setup.sh — create

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions