Some tips when I take time to write them down.

Part 1 - Setup the environment

This post is the first part of a serie where we'll build and deploy an odoo module thanks to Gitlab and Docker.

I assume that you already have git, python, pip and docker installed on your environment. Oh and create a Gitlab account if you don't have one, it's free.

In this post, we'll setup an odoo development environment on macOS but this should work on Linux too with few more sudo. We'll use docker to run a database container. Get odoo sources with git and setup an isolated python environment to keep things clean.

First, let's create a database container:

$ docker run -d -p 5432:5432 -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db-docker postgres:9.4

Create a python virtual environment to keep things together:

$ mkdir -p ~/odoo-docker/addons
$ cd ~/odoo-docker
$ pip install virtualenv
$ virtualenv odoo-virtualenv
$ source odoo-virtualenv/bin/activate

Check that you're using the right interpreter:

$ which python

Get odoo sources:

$ git clone --depth 1
$ cd odoo/

Install python dependencies, you'll have to install system packages to be able to install some python dependencies:

$ pip install -r requirements.txt
$ python install

The last command install odoo in the python environment so we can use the odoo cli, but we'll generate the configuration file with the odoo-bin to get the correct addon path.

Let's use it to generate a config file:

$ ./odoo-bin -s -c ../addons/config.ini --stop-after-init
$ cd ../addons/

Edit the config file to change database settings:

db_host = localhost
db_password = odoo
db_port = 5432
db_user = odoo

We can now run Odoo:

$ odoo -c config.ini

If everything goes well, you should finish the installation from the web interface.