🛠
Getting set up
Make a project with under a directory called
nextway
git clone https://github.com/next-way/nextway-erp-api.git
Go back up to
nextway
and make a directory nextway-erp-web
this will contain our Odoo app. While at
nextway-erp-web
create a directory addons
and this will contain Nextway's custom addons.git clone https://github.com/next-way/order_dispatch
At the end, we get following directory structure
nextway
├── nextway-erp-api
└── nextway-erp-web
└── addons
└── order_dispatch
Here, we are going to focus on
nextway-erp-web
to get Odoo ready.Create the file
config/odoo.conf
The following is how the config may look like.
config/odoo.conf
#-----------------------------------------------------------------------------
# Filter listed database REGEXP
#-----------------------------------------------------------------------------
db_name = nextwaydb
db_host = host.docker.internal
db_port = 5435
db_user = odoo
db_password = secretdbpass
#-----------------------------------------------------------------------------
# Specify the addons_path folders ordered by priority
# addons_path=/first/path/,/second/path/
#-----------------------------------------------------------------------------
addons_path = /usr/lib/python3/dist-packages/odoo/addons,/var/lib/odoo/.local/share/Odoo/addons/16.0,/mnt/extra-addons
#-----------------------------------------------------------------------------
# Comma-separated list of server-wide modules, default=web
#-----------------------------------------------------------------------------
server_wide_modules = web,sale_management,stock,fleet,contacts,hr,delivery,order_dispatch
This sets up the database Odoo will use, the
addons_path
and the modules that will be installed and enabled by default.📌 More on Odoo system configuration here: https://www.odoo.com/documentation/16.0/administration/install/deploy.html
The postgres image will be used for PostgreSQL. We will only be needing one file for now.
Create a
odoo_pg_pass
file and add the database password. This will be used as a postgresql_password
secret in our compose file later. Now we are going to create the Dockerfile.
Dockerfile
FROM odoo:16
ARG extra_addons_path=addons
USER root
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3-pip
COPY $extra_addons_path /mnt/extra-addons
USER odoo
COPY --chown=odoo:odoo config/odoo.conf /etc/odoo/odoo.conf
For simplicity, here is how a compose file would look like.
docker-compose.yml
version: '3.1'
services:
web:
image: localhost:6000/nextway-odoo-web:latest
platform: linux/amd64
depends_on:
- db
ports:
- "8069:8069"
volumes:
- odoo-web-data:/var/lib/odoo
- ./config:/etc/odoo
- ./addons:/mnt/extra-addons
environment:
- PASSWORD_FILE=/run/secrets/postgresql_password
secrets:
- postgresql_password
db:
image: postgres:13
environment:
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD_FILE=/run/secrets/postgresql_password
- POSTGRES_USER=odoo
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- odoo-db-data:/var/lib/postgresql/data/pgdata
secrets:
- postgresql_password
ports:
- "5435:5432"
api:
image: localhost:6000/nextway-odoo-api:latest
platform: linux/amd64
environment:
- DOCKER_DEFAULT_PLATFORM=linux/amd64
- PASSWORD_FILE=/run/secrets/postgresql_password
depends_on:
- db
- web
ports:
- "8082:8082"
volumes:
- ../nextway-erp-api/.env.shared:/usr/local/api/.env.shared
- ./config:/etc/odoo
secrets:
- postgresql_password
volumes:
odoo-web-data:
odoo-db-data:
secrets:
postgresql_password:
file: odoo_pg_pass
Now our
nextway-erp-web
directory looks like the following.nextway/nextway-erp-web
├── Dockerfile