- Before bringing up the stack, check if the agent-db volume exists but
is missing the expected database (left from a previous broken run with
wrong POSTGRES_DB). Offer to wipe and re-init automatically.
- After docker compose up, wait for pg_isready then run
`alembic upgrade head` inside the agent container so tables are created
before the agent attempts to use them.
- Restart agent-service after migrations so it connects to a fully
initialized database on its first attempt.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces manual .env editing with a guided setup script.
Auto-discovers:
- Odoo container name and database (via `docker ps` + odoo.conf inspection)
- Ollama endpoint (scans 192.168.2.10/9, 192.168.2.1, localhost on port 11434)
- Ollama model list (lets user pick from available, auto-selects if only one)
Auto-generates (idempotent — preserves on re-run):
- POSTGRES_PASSWORD (openssl rand -hex 24)
- AGENT_API_KEY (openssl rand -hex 32)
- WEBHOOK_SECRET (openssl rand -hex 32)
Postgres constants always written correctly:
- POSTGRES_HOST=agent-db, POSTGRES_DB=activeblue_ai, POSTGRES_USER=activeblue
(fixes previous issue where these were blank or wrong in .env)
Odoo API key:
- Attempts auto-creation via Odoo HTTP session + res.users.apikeys.description
wizard (works on Odoo 16/17/18 with valid admin credentials)
- Falls back to clear manual instructions + paste prompt on failure
Writes .env with chmod 600. Offers to `docker compose up -d` when done.
Usage:
cd /root/odoo/odoo-ai
bash setup.sh
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>