odoo / docker

Other
979 stars 1.57k forks source link

recent docker pull from odoo:16 cause AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK' #490

Open dhamanutd opened 10 months ago

dhamanutd commented 10 months ago

I recently pull docker for odoo:16 image, and I get this issue when running it.

odoo-1  | 2024-01-12 09:34:32,019 1 CRITICAL ? odoo.modules.module: Couldn't load module web
odoo-1  | 2024-01-12 09:34:32,019 1 CRITICAL ? odoo.modules.module: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'
odoo-1  | 2024-01-12 09:34:32,019 1 ERROR ? odoo.service.server: Failed to load server-wide module `web`.
odoo-1  | The `web` module is provided by the addons found in the `openerp-web` project.
odoo-1  | Maybe you forgot to add those addons in your addons_path configuration.
odoo-1  | Traceback (most recent call last):
odoo-1  |   File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 1248, in load_server_wide_modules
odoo-1  |     odoo.modules.module.load_openerp_module(m)
odoo-1  |   File "/usr/lib/python3/dist-packages/odoo/modules/module.py", line 471, in load_openerp_module
odoo-1  |     __import__('odoo.addons.' + module_name)
odoo-1  |   File "/usr/lib/python3/dist-packages/odoo/addons/web/__init__.py", line 4, in <module>
odoo-1  |     from . import controllers
odoo-1  |   File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/__init__.py", line 5, in <module>
odoo-1  |     from . import database
odoo-1  |   File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/database.py", line 19, in <module>
odoo-1  |     from odoo.addons.base.models.ir_qweb import render as qweb_render
odoo-1  |   File "/usr/lib/python3/dist-packages/odoo/addons/base/__init__.py", line 5, in <module>
odoo-1  |     from . import models
odoo-1  |   File "/usr/lib/python3/dist-packages/odoo/addons/base/models/__init__.py", line 21, in <module>
odoo-1  |     from . import ir_mail_server
odoo-1  |   File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_mail_server.py", line 19, in <module>
odoo-1  |     from OpenSSL import crypto as SSLCrypto
odoo-1  |   File "/usr/lib/python3/dist-packages/OpenSSL/__init__.py", line 8, in <module>
odoo-1  |     from OpenSSL import crypto, SSL
odoo-1  |   File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1556, in <module>
odoo-1  |     class X509StoreFlags(object):
odoo-1  |   File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1577, in X509StoreFlags
odoo-1  |     CB_ISSUER_CHECK = _lib.X509_V_FLAG_CB_ISSUER_CHECK
odoo-1  | AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'
odoo-1  | 2024-01-12 09:34:32,022 1 CRITICAL ? odoo.modules.module: Couldn't load module base
odoo-1  | 2024-01-12 09:34:32,022 1 CRITICAL ? odoo.modules.module: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'
odoo-1  | 2024-01-12 09:34:32,022 1 ERROR ? odoo.service.server: Failed to load server-wide module `base`.
odoo-1  | Traceback (most recent call last):
odoo-1  |   File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 1248, in load_server_wide_modules
odoo-1  |     odoo.modules.module.load_openerp_module(m)
odoo-1  |   File "/usr/lib/python3/dist-packages/odoo/modules/module.py", line 471, in load_openerp_module
odoo-1  |     __import__('odoo.addons.' + module_name)
odoo-1  |   File "/usr/lib/python3/dist-packages/odoo/addons/base/__init__.py", line 5, in <module>
odoo-1  |     from . import models
odoo-1  |   File "/usr/lib/python3/dist-packages/odoo/addons/base/models/__init__.py", line 21, in <module>
odoo-1  |     from . import ir_mail_server
odoo-1  |   File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_mail_server.py", line 19, in <module>
odoo-1  |     from OpenSSL import crypto as SSLCrypto
odoo-1  |   File "/usr/lib/python3/dist-packages/OpenSSL/__init__.py", line 8, in <module>
odoo-1  |     from OpenSSL import crypto, SSL
odoo-1  |   File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1556, in <module>
odoo-1  |     class X509StoreFlags(object):
odoo-1  |   File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1577, in X509StoreFlags
odoo-1  |     CB_ISSUER_CHECK = _lib.X509_V_FLAG_CB_ISSUER_CHECK
odoo-1  | AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'

Currently It makes me volume mounting the OpenSSL to library in my device to workaround this issue.

lathama commented 7 months ago

@dhamanutd

Can you reproduce this and share how you do? Can you share your exact docker command and or docker-compose.yml used?

dhamanutd commented 6 months ago

@lathama had been resolved by rearrange the Dockerfile and mount some py library

Here is my Dockerfile

FROM odoo:16.0

USER root

RUN DEBIAN_FRONTEND=noninteractive && \
    apt-get update --fix-missing && \
    apt install python3-pip && apt install tzdata

RUN rm -R /usr/lib/python3/dist-packages/OpenSSL
RUN ln -sf /usr/share/zoneinfo/Asia/Jakarta /etc/localtime
USER odoo

RUN python3 -m pip install cryptography==38.0.2 pdf2image odoo_test_helper coverage firebase-admin google-api-python-client google-auth-httplib2 google-auth-oauthlib html2text

with this docker-compose.yml

version: '3.1'
services:
  odoo:
    image: odoo-local:latest
    build: .
    environment:
      - TZ=Asia/Jakarta
    ports:
      - "8069:8069"
    volumes:
      - odoo-web-data:/var/lib/odoo
      - ./configs:/etc/odoo
      - ./modules:/mnt/extra-addons
      - ./lib/cryptography:/usr/lib/python3/dist-packages/cryptography
      - ./lib/OpenSSL:/usr/lib/python3/dist-packages/OpenSSL
    command:
      - /entrypoint.sh
      - odoo 
      - --test-tags
      - training

  db:
    image: postgres:13
    environment:
      - TZ=Asia/Jakarta
      - POSTGRES_USER=odoo
      - POSTGRES_PASSWORD=odoo
      - POSTGRES_DB=postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U odoo -d postgres"]
      interval: 10s
      timeout: 5s
      retries: 5
    ports:
      - 5432:5432
    volumes:
      - odoo-db-data:/var/lib/postgresql/data
      - ./configs/postgresql.conf:/etc/postgresql/postgresql.conf

volumes:
  odoo-web-data:
  odoo-db-data:

Hope anyone experiencing the same issue with me, can be helped by that.