High-Level Architecture
Relevant source files
The following files were used as context for generating this wiki page:
OdooConnectorAPI is a RESTful gateway designed to bridge external applications with the Odoo ERP system. The system architecture is built on FastAPI for asynchronous processing and utilizes the odoorpc library to communicate with Odoo's backend services. The application is designed to be fully containerized and cloud-ready, supporting both Docker Compose and Kubernetes environments.
Sources: README.md:3-8, app/main.py:1-6, requirements.txt:1-7
System Components
The architecture consists of three primary layers: the API Layer (FastAPI), the Integration Layer (OdooRPC), and the Data Layer (Odoo ERP & PostgreSQL).
Component Overview
| Component | Technology | Description |
|---|---|---|
| API Server | FastAPI / Uvicorn | Handles incoming HTTP requests and routes them to specific Odoo actions. |
| Connector | odoorpc | Python library used to perform RPC calls to the Odoo server. |
| ERP System | Odoo 17 | The target system containing business logic and modules (e.g., res.partner). |
| Database | PostgreSQL 13 | Persistent storage for Odoo ERP data. |
Sources: app/main.py:1-10, odoo/docker-compose.yml:25-56, requirements.txt:1-7
Logical Architecture Diagram
The following diagram illustrates the relationship between the external client, the FastAPI application, and the containerized Odoo environment.
The API acts as a middleman, translating RESTful requests into Odoo-specific Remote Procedure Calls.
Sources: app/main.py:23-38, odoo/docker-compose.yml:1-56
Data Flow and API Endpoints
The application manages data by establishing a connection to Odoo via credentials provided through environment variables.
Request Flow: Fetching Partners
When a client requests partner data, the system follows a specific sequence of authentication and retrieval:
Defined Endpoints
| Endpoint | Method | Functionality | Return Type |
|---|---|---|---|
/ | GET | Root health check / welcome message. | Dict[str, str] |
/get/partners | GET | Authenticates with Odoo and retrieves partner names and emails. | Dict[str, Any] |
Sources: app/main.py:17-38
Infrastructure and Deployment
The project provides multiple deployment strategies to ensure scalability and environment consistency.
Configuration Management
Configuration is handled primarily through environment variables, which are utilized by the application, Docker containers, and Helm charts.
| Variable | Default Value | Description |
|---|---|---|
ODOO_URL | localhost | The hostname of the Odoo server. |
ODOO_DB | mydb | The name of the Odoo database. |
ODOO_USERNAME | admin | Username for Odoo authentication. |
ODOO_PASSWORD | admin | Password for Odoo authentication. |
Sources: app/main.py:10-14, docker-compose.yml:10-14, charts/odooconnectorapi/values.yaml:15-19
Deployment Strategies
- Local/Development: Managed via a virtual environment and
uvicornordocker-compose. - Odoo Backend: A dedicated
odoo/docker-compose.ymlsets up Odoo 17 and PostgreSQL 13 with health checks and resource limits. - Production (Kubernetes): A Helm chart is provided, defining a
DeploymentandService.
Security and Performance
The application includes resource constraints and security best practices within its container definitions:
- Resource Limits: In the Odoo stack, services are limited to 0.50 CPUs and 512M of memory.
- Privilege Escalation: Containers are configured with
no-new-privilegesand restricted capabilities (cap_drop: [ALL]). - Security Policy: The project maintains a security policy for reporting vulnerabilities via
security@datacosmos-br.org.
Sources: odoo/docker-compose.yml:6-30, SECURITY.md:12-25
Conclusion
The High-Level Architecture of OdooConnectorAPI emphasizes a decoupled approach where a lightweight FastAPI layer serves as a managed interface to Odoo's internal RPC system. By utilizing standard containerization and orchestration tools, the system ensures consistent behavior across development and production environments while maintaining strict security and resource controls.