Deploying an Odoo App
Introduction
Odoo is an open-source business application suite covering CRM, ERP, accounting, inventory, and more. Deploying Odoo with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage for add-ons and uploads—all configured from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample API usage, and production tips.
Prerequisites
- A Klutch.sh account (sign up)
- A GitHub repository containing your Odoo code and Dockerfile (GitHub is the only supported git source)
- PostgreSQL database (deploy as a Klutch.sh TCP app on port
8000and connect on5432) - Domain and TLS for secure access
For onboarding, see the Quick Start.
Architecture and ports
- Odoo web runs on internal port
8069; choose HTTP traffic. - Long-polling (bus) also uses the same port by default.
- PostgreSQL runs externally over TCP; connect on
5432. - Persistent storage is needed for filestore, logs, and configuration.
Repository layout
odoo/├── Dockerfile # Must be at repo root for auto-detection├── addons/ # Custom modules (optional)└── README.mdKeep secrets out of Git; store them in Klutch.sh environment variables.
Installation (local) and starter commands
Validate locally before pushing to GitHub:
docker build -t odoo-local .docker run -p 8069:8069 \ -e DB_HOST=localhost \ -e DB_PORT=5432 \ -e DB_USER=odoo \ -e DB_PASSWORD=odoo \ odoo-localDockerfile for Odoo (production-ready)
Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):
FROM odoo:17.0
ENV ODOO_RC=/etc/odoo/odoo.conf \ PORT=8069
WORKDIR /usr/lib/python3/dist-packages
# Copy custom addons if presentCOPY addons /mnt/extra-addons
EXPOSE 8069CMD ["odoo", "-c", "/etc/odoo/odoo.conf"]Notes:
- Pin the tag (e.g.,
17.0) for stability; update intentionally. - If you need extra Python packages, add
pip installsteps before runtime.
Environment variables (Klutch.sh)
Set these in Klutch.sh before deploying:
PORT=8069DB_HOST=<postgres-host>DB_PORT=5432DB_USER=<db-user>DB_PASSWORD=<db-password>DB_NAME=<db-name>(optional; Odoo can create databases with master password)ADMIN_PASSWORD=<strong-master-password>- Optional:
ODOO_RC=/etc/odoo/odoo.conf, email/SMTP settings as needed
If you deploy without the Dockerfile and need Nixpacks overrides (Python):
NIXPACKS_PYTHON_VERSION=3.11NIXPACKS_START_CMD=odoo -c /etc/odoo/odoo.conf
Attach persistent volumes
In Klutch.sh storage settings, add mount paths and sizes (no names required):
/var/lib/odoo— filestore and data./var/log/odoo— logs./etc/odoo— configuration (if you customizeodoo.conf)./mnt/extra-addons— custom modules (if you want them persisted/mounted).
Ensure these paths are writable.
Deploy Odoo on Klutch.sh (Dockerfile workflow)
- Push your repository—with the Dockerfile at the root—to GitHub.
- Open klutch.sh/app, create a project, and add an app.
- Select HTTP traffic and set the internal port to
8069. - Add the environment variables above, including Postgres credentials and a strong
ADMIN_PASSWORD. - Attach persistent volumes for
/var/lib/odoo,/var/log/odoo,/etc/odoo, and optionally/mnt/extra-addons, sizing them for your data, logs, and modules. - Deploy. Complete the Odoo web setup at
https://example-app.klutch.sh, create the database, and log in.
Sample API usage
Authenticate and call an Odoo model via JSON-RPC:
import jsonimport requests
url = "https://example-app.klutch.sh/jsonrpc"headers = {"Content-Type": "application/json"}
payload = { "jsonrpc": "2.0", "method": "call", "params": { "service": "common", "method": "login", "args": ["<db_name>", "<user>", "<password>"] }, "id": 1}uid = requests.post(url, data=json.dumps(payload), headers=headers).json()["result"]
payload = { "jsonrpc": "2.0", "method": "call", "params": { "service": "object", "method": "execute_kw", "args": ["<db_name>", uid, "<password>", "res.partner", "search_read", [], {"limit": 1}] }, "id": 2}res = requests.post(url, data=json.dumps(payload), headers=headers).json()print(res["result"])Health checks and production tips
- Add an HTTP probe to
/webor a simple health route for readiness. - Enforce HTTPS at the edge; forward internally to port
8069. - Keep DB credentials and
ADMIN_PASSWORDin Klutch.sh secrets; rotate them regularly. - Monitor disk usage on
/var/lib/odooand/var/log/odoo; resize before they fill. - Pin image versions and test upgrades in staging; back up data and DB before updates.
Odoo on Klutch.sh combines reproducible Docker builds with managed secrets, persistent storage, and flexible HTTP/TCP routing. With the Dockerfile at the repo root, port 8069 configured, and PostgreSQL connected, you can deliver a robust business application suite without extra YAML or workflow overhead.