Thanks to visit codestin.com
Credit goes to github.com

Skip to content

walkin-watchdog/odoo-basic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Steps for Odoo 18 dockerised deployment and upgrading from Community Edition to Enterprise

Update Repos and Packages

sudo apt-get update && sudo apt-get full-upgrade -y && sudo apt-get autoremove -y && sudo apt-get autoclean

Install Docker (pre-requisite):

curl https://get.docker.com | bash

Create Odoo Directory in the root:

mkdir ~/odoo

Create Postgres Database Secret Password file:

nano ~/odoo/odoo_pg_pass

Paste:

pgdbpassword

Create Odoo Config directory:

mkdir ~/odoo/config

Create Odoo Config file:

nano ~/odoo/config/odoo.conf

Paste:

[options]
admin_passwd = odoo_db_master_password
db_host = db
db_port = 5432
db_user = odoo
db_password = pgdbpassword
addons_path = /mnt/extra-addons,/mnt/enterprise

Create entrypoint script:

nano ~/odoo/entrypoint.sh

Paste:

#!/bin/bash

set -e

# Check if database exists and web_enterprise is not installed
check_enterprise_installed() {
  PGHOST=db PGUSER=odoo PGPASSWORD="$(cat /run/secrets/postgresql_password)" psql -d "$1" -tAc "SELECT 1 FROM ir_module_module WHERE name='web_enterprise' AND state='installed'" | grep -q 1
}

install_enterprise_if_needed() {
  local DB_NAME="$1"
  if ! check_enterprise_installed "$DB_NAME"; then
    echo "Installing web_enterprise in database: $DB_NAME"
    odoo --config=/etc/odoo/odoo.conf -d "$DB_NAME" -i web_enterprise --stop-after-init
  fi
}

# Install for default database (postgres)
install_enterprise_if_needed "postgres"

# Start Odoo normally
exec "$@"

Create Dockerfile:

nano ~/odoo/Dockerfile

Paste:

# Start from the official Odoo 18 image
FROM odoo:18

# Copy the Enterprise .deb package into the image
COPY ./enterprise/odoo_18.0+e.latest_all.deb /tmp/enterprise.deb

# Install Enterprise and Python dependencies as root
USER root

# Install system packages and Enterprise DEB
RUN apt-get update && \
    apt-get install -y --allow-downgrades --no-install-recommends \
        /tmp/enterprise.deb \
        python3-pip \
        python3-venv \
        postgresql-client && \
    rm -rf /var/lib/apt/lists/* /tmp/enterprise.deb

# Install Python packages system-wide (safer in Docker than on host)
RUN pip3 install --no-cache-dir --break-system-packages google-auth pyjwt

# Ensure Odoo uses the virtual environment
ENV PATH="/opt/odoo-venv/bin:$PATH"

# Copy entrypoint script and set permissions in one step
COPY --chown=odoo:odoo --chmod=07777 ./entrypoint.sh /entrypoint.sh

# Switch back to the unprivileged 'odoo' user
USER odoo

ENTRYPOINT ["/entrypoint.sh"]
CMD ["odoo"]

Create docker-compose.yml file:

nano ~/odoo/docker-compose.yml

Paste:

services:
  web:
    build: .
    depends_on:
      db:
        condition: service_healthy
    restart: always
    ports:
      - "8069:8069"
      - "8072:8072"
    volumes:
      - odoo-web-data:/var/lib/odoo
      - ./config:/etc/odoo
      - ./addons:/mnt/extra-addons
      - ./enterprise:/mnt/enterprise
    environment:
      - PASSWORD_FILE=/run/secrets/postgresql_password
    secrets:
      - postgresql_password
  db:
    image: postgres:15
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_PASSWORD_FILE=/run/secrets/postgresql_password
      - POSTGRES_USER=odoo
      - PGDATA=/var/lib/postgresql/data/pgdata
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U odoo -d postgres"]
      interval: 5s
      timeout: 5s
      retries: 5
    restart: always
    volumes:
      - odoo-db-data:/var/lib/postgresql/data/pgdata
    secrets:
      - postgresql_password
volumes:
  odoo-web-data:
  odoo-db-data:

secrets:
  postgresql_password:
    file: odoo_pg_pass

Create enterprise dir:

mkdir ~/odoo/enterprise

Upload Enterprise Package to server:

scp -R /local/path/to/file/odoo_18.0+e.latest_all.deb root@SERVERIP:~/odoo/enterprise

Final Structure

~/odoo/
├── docker-compose.yml
├── odoo_pg_pass          # Database password file
├── entrypoint.sh
├── config/
│   └── odoo.conf         # Odoo configuration
├── addons/               # Custom modules
├── enterprise/
│   └── odoo_18.0+e.latest_all.deb  # Enterprise .deb package
└── Dockerfile            # Custom Odoo image with Enterprise pre-installed

Navigate to thw odoo directory:

cd ~/odoo

Set permissions:

chmod 600 ~/odoo/odoo_pg_pass
chmod +x ~/odoo/entrypoint.sh

Build and deploy docker containers:

docker compose up -d

Access Odoo frontend and activate web_enterprise module in apps

http://IP:8069

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published