Nextway
Search
⌃K
🛠

Getting set up

Step 1: Setting up the project files
Make a project with under a directory called nextway
Clone the repository https://github.com/next-way/nextway-erp-api for the FastAPI app
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.
Change directory into addons and clone the repository https://github.com/next-way/order_dispatch
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
Step 2: Configuration
Here, we are going to focus on nextway-erp-web to get Odoo ready.

Nextway ERP WEB

Odoo system configuration

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.

Database configuration

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.

Dockerfile

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

Docker compose

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
├── odoo_pg_pass
├── addons
│  └── order_dispatch
└── docker-compose.yml
We are getting close! Now for the API.

Nextway ERP API

There are a few environment variables available for setup. For simplicity, a file called .env.sample is created for you. Copy the file into a .env.shared file and update the variables.
Step 3: Up and running system
Run docker compose up.
$ docker compose up
[+] Running 3/3
⠿ Container nextway-erp-web-db-1 Created 0.0s
⠿ Container nextway-erp-web-web-1 Recreated 0.8s
⠿ Container nextway-erp-web-api-1 Recreated 0.4s
Attaching to nextway-erp-web-api-1, nextway-erp-web-db-1, nextway-erp-web-web-1
nextway-erp-web-db-1 |
nextway-erp-web-db-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
nextway-erp-web-db-1 |
nextway-erp-web-db-1 | 2022-12-29 14:03:44.425 UTC [1] LOG: starting PostgreSQL 13.8 (Debian 13.8-1.pgdg110+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
nextway-erp-web-db-1 | 2022-12-29 14:03:44.426 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
nextway-erp-web-db-1 | 2022-12-29 14:03:44.426 UTC [1] LOG: listening on IPv6 address "::", port 5432
nextway-erp-web-db-1 | 2022-12-29 14:03:44.432 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
nextway-erp-web-db-1 | 2022-12-29 14:03:44.444 UTC [26] LOG: database system was shut down at 2022-12-28 04:17:37 UTC
nextway-erp-web-db-1 | 2022-12-29 14:03:44.537 UTC [1] LOG: database system is ready to accept connections
nextway-erp-web-api-1 | + uvicorn app.main:app --reload --host 0.0.0.0 --port 8082
nextway-erp-web-api-1 | INFO: Will watch for changes in these directories: ['/usr/local/api']
nextway-erp-web-api-1 | INFO: Uvicorn running on http://0.0.0.0:8082 (Press CTRL+C to quit)
nextway-erp-web-api-1 | INFO: Started reloader process [1] using StatReload
nextway-erp-web-web-1 | 2022-12-29 14:03:50,423 1 INFO ? odoo: Odoo version 16.0-20221202
nextway-erp-web-web-1 | 2022-12-29 14:03:50,429 1 INFO ? odoo: Using configuration file at /etc/odoo/odoo.conf
nextway-erp-web-web-1 | 2022-12-29 14:03:50,431 1 INFO ? odoo: addons paths: ['/usr/lib/python3/dist-packages/odoo/addons', '/var/lib/odoo/.local/share/Odoo/addons/16.0', '/mnt/extra-addons']
nextway-erp-web-web-1 | 2022-12-29 14:03:50,435 1 INFO ? odoo: database: [email protected]:5435
nextway-erp-web-web-1 | 2022-12-29 14:03:51,365 1 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf
nextway-erp-web-web-1 | 2022-12-29 14:03:53,698 1 INFO ? odoo.service.server: HTTP service (werkzeug) running on e3ee64dcb357:8069
nextway-erp-web-web-1 | 2022-12-29 14:03:53,821 1 INFO nextwaydb odoo.modules.loading: loading 1 modules...
nextway-erp-web-api-1 | INFO: Started server process [70]
nextway-erp-web-api-1 | INFO: Waiting for application startup.
nextway-erp-web-web-1 | 2022-12-29 14:03:53,885 1 INFO nextwaydb odoo.modules.loading: 1 modules loaded in 0.06s, 0 queries (+0 extra)
nextway-erp-web-api-1 | INFO: Application startup complete.
nextway-erp-web-web-1 | 2022-12-29 14:03:54,045 1 INFO nextwaydb odoo.modules.loading: loading 66 modules...
nextway-erp-web-web-1 | 2022-12-29 14:03:55,473 1 INFO nextwaydb odoo.modules.loading: 66 modules loaded in 1.43s, 0 queries (+0 extra)
nextway-erp-web-web-1 | 2022-12-29 14:03:56,125 1 INFO nextwaydb odoo.modules.loading: Modules loaded.
nextway-erp-web-web-1 | 2022-12-29 14:03:56,145 1 INFO nextwaydb odoo.modules.registry: Registry loaded in 2.455s

Local system running

Go to http://localhost:8069 for Odoo
Odoo (Nextway ERP Web)
And http://localhost:8082 for the API