DEV Community

majordomo-systems
majordomo-systems

Posted on

Odoo | Hasura GraphQL | Docker

I had been struggling with getting certain Odoo modules working nicely within a Docker container. My interest in Odoo is not for client work, more for infrastructure-as-code and for use as a headless CMS for application development.

However, I wanted to use any API other than Odoo’s XML-RPC.

The initial hope was to get the GraphQL module working. I had issues with graphql-core-server within a Docker container, so gave up, and opted for OpenAPI’s REST instead. I still wasn’t happy.

There is something I dont like about the API being provided by a module and I wanted more separation between the API and Odoo. I was still thinking about GraphQL. Then it hit me. Hasura!

Hasura provides a GraphQL API layer over new or existing Postgres databases. I’ve wanted to have a reason to start playing with it and finally the perfect scenario came along.

Here are the steps to get Odoo running, within a container, alongside Hasura, Postgres and Caddy. Personally, I think this is the greatest thing ever…

Here is the repo — https://github.com/majordomo-systems/odoo-hasura-docker

  1. Install Docker & Docker Compose on host
  2. curl -s https://raw.githubusercontent.com/majordomo-systems/odoo-hasura-docker/14.0/run.sh | sudo bash -s odoo-hasura-docker

If you want to add modules, copy them into the addons folder. On occasion dependencies need to be installed and examples of how to do so are in the run.sh.

Odoo.conf in /etc is mounted within the container as well.

Odoo will be running on port 14069, the GraphQL console on 80.

Bon appetit!

Latest comments (1)

Collapse
 
ajsb85 profile image
Alexander Salas Bastidas

Hi, good starting point.
But what about the scheme?
Do you make it manually with the Hasura Dashboard?