Git Product home page Git Product logo

docker-odoo-project's Introduction

Build Status

docker-odoo-project

A base image for our Odoo projects.

This image alone does nothing because it doesn't contain any Odoo's code. The code should be added in a Dockerfile inheriting from this image.

A project using this image has to respect a defined structure, look at the example.

See also the Changelog.

⚠️ Version 5.0.0 : Some Breaking changes

  • We not longer use gosu
  • The odoo user is created during the build of the image, and no longer in the entrypoint
  • All odoo related files are moved in /odoo
  • odoo runs with uid 999; if you need to change this, use for instance `docker-compose --build-arg UID=$(id -u)
  • Odoo versions 7.0, 8.0, 9.0 and 10.0 are no longer supported

⚠️ Reporting now use kwkhtmltopdf instead of wkhtmltopdf

To limit the amount of memory required on each containers to print report

We have switch to kwkhtmltopdf project : https://github.com/acsone/kwkhtmltopdf

the kwkhtmltopdf client is included in the base image, you must set the env variable :

KWKHTMLTOPDF_SERVER_URL=:

and you also need to specify report url to let kwkhtmltopdf server to retrive images/header etc... from odoo:

ODOO_REPORT_URL=

⚠️ Images moved to ghcr.io

Due to pull limitation on docker.io the images are now pushed exclusively on ghcr.io.

Images can be found under the github link "Packages". https://github.com/camptocamp/docker-odoo-project/pkgs/container/odoo-project

Image Flavors

There are 4 flavors of the image:

  • normal: odoo-project:${odoo_version}-${tag_version}
  • normal-onbuild: odoo-project:${odoo_version}-${tag_version}-onbuild
  • batteries-included: odoo-project:${odoo_version}-${tag_version}-batteries
  • batteries-included-onbuild: odoo-project:${odoo_version}-${tag_version}-batteries-onbuild

Note: in production, we strongly recommend to never use the "latest" tag. Instead use a specific version in order to be able to rebuild identical images.

Normal or Batteries-included?

The batteries-included image is exactly the same image, with a list of additional pre-installed python packages. The packages have been chosen because of their prevalent usage in OCA addons.

The list of package (with their version) is defined in the extra_requirements.txt file.

you can also see the Dockerfile that generate this image here: common/Dockerfile-batteries

With or without onbuild?

The onbuild flavors add default ONBUILD instructions in the Dockerfile in order to simplify the generation of custom image.

For more information on the ONBUILD command please read Docker documentation

The dockerfile for this flavor is here: common/Dockerfile-onbuild

For comparison, two example of Dockerfile are shown in the project example here:

Note: the Dockerfile of the onbuild flavor is shorter but

  • you can not create intermediary custom image based on it (as ONBUILD instruction need to be played).
  • the official docker images have deprecated their -onbuild images: docker-library/official-images#2076

Build

The images should be build with make:

Normal flavors:

# generate image camptocamp/odoo-project:11.0-latest and camptocamp/odoo-project:11.0-latest-onbuild
$ make VERSION=11.0
# generate image camptocamp/odoo-project:10.0-latest and camptocamp/odoo-project:10.0-latest-onbuild
$ make VERSION=10.0

Batteries-included flavors:

# generate image camptocamp/odoo-project:11.0-batteries-latest and camptocamp/odoo-project:11.0-latest-batteries-onbuild
$ make VERSION=11.0 BATTERIES=True
# generate image camptocamp/odoo-project:10.0-batteries-latest and camptocamp/odoo-project:10.0-latest-batteries-onbuild
$ make VERSION=10.0 BATTERIES=True

Configuration

The host for the database is in $DB_HOST (db by default).

A volume /data/odoo is declared, which is expected to contain Odoo's filestore (this path is set in openerp.cfg).

Ports 8069 and 8072 are exposed by default.

Environment variables

ODOO_BASE_URL

The ir.config_parameter web.base.url will be automatically set to this domain when the container starts. web.base.url.freeze will be set to True. Default url is http://localhost:8069. If ODOO_BASE_URL is set to an empty value, the configuration parameters will be left unchanged.

ODOO_REPORT_URL

The ir.config_parameter report.url will be automatically set to this domain when the container starts.. Default url is http://localhost:8069. As soon as we use kwkhtmltopdf we must set this URL to be accessible by you kwkhtmltopdf server

KWKHTMLTOPDF_SERVER_URL

It point to the server that host the kwktmltopdf server to serve files

MIGRATE

MIGRATE can be True or False and determines whether migration tool marabunta will be launched. By default migration will be launched.

Migration is not launched when using:

    docker-compose run --rm odoo odoo shell [...]
    docker-compose run --rm odoo odoo [...] --help [...]

MARABUNTA_MODE

In Marabunta versions, you can declare additional execution modes, such as demo or full in order to choose which operations and addons are executed for a migration.

A typical use case would be:

  • Install the set of addons in the base mode (the base mode is always executed)
  • Load an excerpt of the data in the demo mode, used for test instances
  • Load the complete dataset in the full mode, used for the integration and production servers

On the test server, you would set MARABUNTA_MODE=demo and on the production one MARABUNTA_MODE=full.

MARABUNTA_ALLOW_SERIE

By default, Marabunta does not allow to execute more than one version upgrade at a time. This is because it is dangerous to execute a migration script (say 9.1.0) if the version of the code is not the same (say 9.2.0).

For a production server, it works, because usually you only want to upgrade to the last version N from N-1. But for development or a test server, you might want to take the risk of running all the migration scripts consecutively, this is what MARABUNTA_ALLOW_SERIE=True is for.

MARABUNTA_FORCE_VERSION

When you are developing / testing migrations with Marabunta, you can force the upgrade of a specific version with MARABUNTA_FORCE_VERSION=<version>.

ODOO_DATA_PATH

Specifies path of data folder where to put base setup data for your project. In anthem songs this allows you to pass relative paths instead of recovering the full path via module resource paths. More precisely, if you set this var you can skip this in your songs:

  from pkg_resources import Requirement, resource_stream

  req = Requirement.parse('my-odoo')


  def load_csv(ctx, path, model, delimiter=',',
               header=None, header_exclude=None):
      content = resource_stream(req, path)
      load_csv(ctx, content, ...)

and use anthem loader straight::

  from anthem.lyrics.loaders import load_csv

  load_csv('relative/path/to/file', ...)

NOTE: anthem > 0.11.0 is required.

LOCAL_CODE_PATH

Specifies path for local(custom) code to be used, by default is /odoo/odoo/addons

MIGRATION_CONFIG_FILE

Specifies path for migration config file, by default is /odoo/migration.yml

DEMO

DEMO can be True or False and determines whether Odoo will load its Demo data. It has effect only at the creation of the database.

User id

By default, the user ID inside of the container will be 999. There is little concern with this ID until we setup a host volume: the same user ID will be used to write the files on the host's filesystem. 999 will probably be inexistent on the host system but at least it will not collide with an actual user.

If you need you can make an image that inherit from this one and made an alter user odoo -u your udi

CREATE_DB_CACHE

Used in bin/runtests and bin/runmigration.

If set to "true", will create a dump in .cachedb of an intermediate state of the tests or migration. By default not set, thus unactivated.

LOAD_DB_CACHE

Used in bin/runtests and bin/runmigration.

If set to "false", will skip trying to reload a cached dump from .cachedb.

SUBS_MD5

This value is used in bin/runtests to determine the name of the intermediate state to load or create.

Value to tag a database dump of bin/runtests, for instance it can be based on submodules in .travis.yml of your git repositories in odoo/src and in odoo/external-src:

export SUBS_MD5=$(git submodule status | md5sum | cut -d ' ' -f1)

You want this value to be unique and identify your dependencies, thus if a dependency change you need to generate a new one.

MIG_LOAD_VERSION_CEIL

Used in bin/runmigration to specify from which dump we want to play the migration. In case you have a dump per version, you can play the migration against the version of your choice. If the version specified does not exists, it will search for a lower occurence.

It will load a dump lower than "odoo_sample_$MIG_LOAD_VERSION_CEIL.dmp" This is useful if you bumped odoo/VERSION as it won't match existing dumps.

For instance you have made a dump 10.1.0, you are now on the version 10.2.0, if you pass your current version it will search for a dump lower than 10.2.0 and restore the 10.1.0. Then play the remaining steps on top of it.

Odoo Configuration Options

The main configuration options of Odoo can be configured through environment variables. The name of the environment variables are the same of the options but uppercased (eg. workers becomes WORKERS).

Look in 11.0/templates/odoo.cfg.tmpl to see the full list.

While most of the variables can be set in the docker-compose file so we can have different values for different environments, the ADDONS_PATH must be set in the Dockerfile of your project with a line such as:

ENV ADDONS_PATH=/odoo/local-src,/odoo/external-src/server-tools,/odoo/src/addons

By setting this value in the Dockerfile, it will be integrated into the build and thus will be consistent across each environment.

By the way, you can add other ENV variables in your project's Dockerfile if you want to customize the default values of some variables for a project.

You can also use environment variable ADDITIONAL_ODOO_RC for any additional parameters that must go in the odoo.cfg file. e.g.:

ADDITIONAL_ODOO_RC="
custom_param=42
other_param='some value'
"

Running tests

runtests

Inside the container, a script runtests is used for running the tests on Travis.

Unless LOAD_DB_CACHE is set to falseit will search for a dump of dependencies and restore it. Otherwise, will create a new database, find theodoo/external-srcandodoo/srcdependencies of the local addons and ifCREATE_DB_CACHE` is activated creates a dump of that state.

Then it will install local addons, run their tests and show the code coverage.

docker-compose run --rm [-e CREATE_DB_CACHE=true] [-e LOAD_DB_CACHE=false] [-e SUBS_MD5=<hash>] odoo runtests

This is not the day-to-day tool for running the tests as a developer.

pytests

pytest is included and can be invoked when starting a container. It needs an existing database to run the tests:

docker-compose run --rm -e DB_NAME=testdb odoo testdb-gen -i my_addon
docker-compose run --rm -e DB_NAME=testdb odoo pytest -s odoo/local-src/my_addon/tests/test_feature.py::TestFeature::test_it_passes

When you make changes in the addon, you need to update it in Odoo before running the tests again. You can use:

docker-compose run --rm -e DB_NAME=testdb odoo testdb-update -u my_addon

When you are done, you can drop the database with:

docker-compose run --rm odoo dropdb testdb

Pytest uses a plugin (https://github.com/camptocamp/pytest-odoo) that corrects the Odoo namespaces (openerp.addons/odoo.addons) when running the tests.

pytest-cov

pytest-cov is also included and can be used to generate a coverage report. You can add --cov=MODULE_PATH to your pytest to get a text version in the shell, or export it as HTML so you can browse the results. To export it to HTML, add --cov-report=HTML:EXPORT_PATH

runmigration

Inside the container, a script runmigration is used to run the migration steps on Travis.

Then when launched, it will search for database dump of the content of odoo/VERSION file. Or if you provided MIG_LOAD_VERSION_CEIL which will allow you to search for an other version. If no dump is available (or LOAD_DB_CACHE is set to false), migration will start from scratch.

The migration steps are then run.

If migration succeed a dump is created if CREATE_DB_CACHE is set to true.

docker-compose run --rm [-e CREATE_DB_CACHE=true] [-e LOAD_DB_CACHE=false] [-e MIG_LOAD_VERSION_CEIL=x.y.z] odoo runmigration

This tools really speed up the process of testing migration steps as you can be executing only a single step instead of redoing all.

cached dumps (runtests / runmigration)

To use database dumps you will need a volume on /.cachedb to have persistant dumps.

On travis you will also want to activate the cache, if your volume definition is - "$HOME/.cachedb:/.cachedb" add this in .travis.yml:

cache:
  directories:
    - $HOME/.cachedb

Start entrypoint

Any script in any language placed in /start-entrypoint.d will be executed just between the migration and the start of Odoo. Similarly, scripts placed in /before-migrate-entrypoint.d will be executed just before the migration.

The order of execution of the files is determined by the run-parts 's rules. You can add your own scripts in those directories. They must be named something like 010_abc (^[a-zA-Z0-9_-]+$) and must have no extension (or it would not be picked up by run-parts).

Important: The database is guaranteed to exist when the scripts are run, so you must take that in account when writing them. Usually you'll want to use such check:

  if [ "$( psql -tAc "SELECT 1 FROM pg_database WHERE datname='$DB_NAME'" )" != '1' ]
  then
      echo "Database does not exist, ignoring script"
      exit 0
  fi

The scripts are run only if the command is odoo/odoo.py.

Legacy images

Legacy images are used for projects using deprecated Odoo versions (7 & 8). They work the same as the newer ones, with a few differences.

Anthem

anthem is not available in these images as the Odoo API is too old to use it. If you want to script migration parts, you can write a script using erppeek.

Sidenote: You can still use SQL scripts the same as before

Demo Data

In Odoo 8, the configuration parameter without_demo can be sometimes buggy (Odoo will still install demo data even if it is told not to do so).

To circumvent this behavior, you can force this parameter in the command line used to start Odoo (check migration.yml as example).

docker-odoo-project's People

Contributors

bealdav avatar brovalex avatar damdam-s avatar florentx avatar grindtildeath avatar guewen avatar gurneyalex avatar hparfr avatar ivantodorovich avatar jcoux avatar jgodin-c2c avatar leemannd avatar mmequignon avatar nilshamerlinck avatar p-tombez avatar sbidoul avatar sebalix avatar sebastienbeau avatar simahawk avatar tdu avatar tonow-c2c avatar tschanzt avatar vrenaville avatar yann-soubeyrand avatar yvaucher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-odoo-project's Issues

make migration in example docker setup more robust

In migration of the docker example there is a step included that executes a sql query (psql -c \"CREATE pg_trgm;") this step will only work on a pristine database. Any subsequent executions will result in an error.

I updated the query to be more robust so I can reexecute/force the migration "setup" by modifying the query to:

psql -c \"CREATE EXTENSION IF NOT EXISTS pg_trgm;

- "sh -c 'psql -c \"CREATE EXTENSION pg_trgm;\"'"

Odoo closes connection to db

Hi

I am new to docker, so apologies if my issue is not relevant.
I followed the installation instructions in '/example', built the odoo folder in an image called odoo-custom and launched the 3 containers into a swarm. Odoo seems to connect to db but immediately closes the connection.

Not sure if this is related, but the source github repository camptocamp/docker-postgresql is not available anymore

The 3 containers are ran into a swarm. Seems ok, except I would expect to see a port mapping like 0.0.0.0:5432->5432/tcp for the db container :

robin@Robin-Ubuntu:~/workspace/creo2-odoo$ docker ps
CONTAINER ID        IMAGE                                COMMAND                  CREATED             STATUS              PORTS                NAMES
04c839dce2d0        odoo-custom:latest                   "docker-entrypoint..."   11 minutes ago      Up 11 minutes       8069/tcp, 8072/tcp   creo2-odoo_odoo.1.945oty059tk71li985hn0v8k1
12339c7d61b4        camptocamp/odoo-nginx:9.0-1.1.0      "/docker-entrypoin..."   11 minutes ago      Up 11 minutes       80/tcp               creo2-odoo_nginx.1.o0ubhx6x0kmfd6qcg598i9d9z
deca0735d0d2        camptocamp/postgresql:pg9.5-latest   "/docker-entrypoin..."   11 minutes ago      Up 11 minutes       5432/tcp             creo2-odoo_db.1.643ku2mczbapgrm5tw1rm4i48

Odoo logs: every time the connection is closed after setting the base url

robin@Robin-Ubuntu:~/workspace/creo2-odoo$ docker service logs creo2-odoo_odoo
creo2-odoo_odoo.1.945oty059tk7@Robin-Ubuntu    | Starting with UID : 999
creo2-odoo_odoo.1.945oty059tk7@Robin-Ubuntu    | Running with demo data
creo2-odoo_odoo.1.945oty059tk7@Robin-Ubuntu    | 2017/08/03 13:59:58 Waiting for: tcp://db:5432
creo2-odoo_odoo.1.945oty059tk7@Robin-Ubuntu    | 2017/08/03 13:59:58 Connected to tcp://db:5432
creo2-odoo_odoo.1.945oty059tk7@Robin-Ubuntu    | run-parts: executing /opt/odoo/start-entrypoint.d/000_set_base_url
creo2-odoo_odoo.1.945oty059tk7@Robin-Ubuntu    | Setting Base URL to domain http://localhost:8069
creo2-odoo_odoo.1.945oty059tk7@Robin-Ubuntu    | 2017-08-03 13:59:59,909 1 INFO odoodb odoo.sql_db: ConnectionPool(used=0/count=0/max=64): Closed 1 connections 

Db logs: Everything seems normal here, except maybe that I don't see any logs with regards to the connection

robin@Robin-Ubuntu:~/workspace/creo2-odoo$ docker service logs creo2-odoo_db
creo2-odoo_db.1.vzszc03xyz4x@Robin-Ubuntu    | LOG:  database system was interrupted; last known up at 2017-08-03 14:14:38 UTC
creo2-odoo_db.1.vzszc03xyz4x@Robin-Ubuntu    | LOG:  incomplete startup packet
creo2-odoo_db.1.vzszc03xyz4x@Robin-Ubuntu    | FATAL:  the database system is starting up
creo2-odoo_db.1.vzszc03xyz4x@Robin-Ubuntu    | LOG:  database system was not properly shut down; automatic recovery in progress
creo2-odoo_db.1.vzszc03xyz4x@Robin-Ubuntu    | LOG:  redo starts at 0/2901B30
creo2-odoo_db.1.vzszc03xyz4x@Robin-Ubuntu    | LOG:  invalid record length at 0/2901C10
creo2-odoo_db.1.vzszc03xyz4x@Robin-Ubuntu    | LOG:  redo done at 0/2901BD8
creo2-odoo_db.1.vzszc03xyz4x@Robin-Ubuntu    | LOG:  MultiXact member wraparound protections are now enabled
creo2-odoo_db.1.vzszc03xyz4x@Robin-Ubuntu    | LOG:  database system is ready to accept connections
creo2-odoo_db.1.vzszc03xyz4x@Robin-Ubuntu    | LOG:  autovacuum launcher started

Finally, my docker-compose.yml file

# Composition for development

version: '3'

services:
  odoo:
    image: odoo-custom #this image has been built locally
    deploy:
        replicas: 1 #for development
    depends_on:
      - db
    volumes:
      - "data-odoo:/data/odoo"
    environment:
      - DB_USER=odoo
      - DB_PASS=odoo
      - DB_NAME=odoodb
      - ADMIN_PASSWD=testme
      - RUNNING_ENV=dev
      - MARABUNTA_MODE=demo
      - LOG_HANDLER=:WARN
      - DEMO=true
      #- ODOO_BASE_URL="http://localhost:8069"
      - MIGRATE=true # MIGRATE can be True or False and determines whether migration tool marabunta will be launched. By default migration will be launched.


  db:
    image: camptocamp/postgresql:pg9.5-latest
    environment:
      - POSTGRES_USER=odoo
      - POSTGRES_PASSWORD=odoo
    volumes:
      - "data-db:/var/lib/postgresql/data"

  # can be useful for dev when longpolling is required
  nginx:
    image: camptocamp/odoo-nginx:9.0-1.1.0
    depends_on:
      - odoo

volumes:
  data-odoo:
  data-db:

DeprecationWarning: pkg_resources is deprecated as an API

Something to follow up on for the future.

/odoo/.local/bin/odoo:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  __import__('pkg_resources').require('odoo==17.0')

Database xxxxxx not initialized

I've been trying for days, when I try to use an external database server, I get the following error and I could not pass at all. How can I fix ?

ERROR ? odoo.modules.loading: Database xxxxxx not initialized, you can force it with -i base

Can't run example project

Hello, I was not able to make the example project work:

  • Using just as it is, returns this error on build stage:
chown: invalid user: ‘odoo:odoo’
The command '/bin/sh -c chown -R odoo:odoo /odoo' returned a non-zero code: 1
  • When updating the Dockerfile's image to ghcr.io/camptocamp/odoo-project:14.0-latest, building the image works but got this error after trying docker-compose up:
Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "docker-entrypoint.sh" executable file not found in $PATH: unknown

Cannot make submodule

git submodule add [email protected]:odoo/odoo.git odoo/src

Cloning into '/home/frontiir/odoo/src'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:odoo/odoo.git' into submodule path '/home/frontiir/odoo/src' failed

Wrong VOLUME definition in 16.0 Dockerfile???? Error Permission pip egg UID

Here we can see volume data is set to:

VOLUME ["/data/odoo", "/var/log/odoo"]

As for the rest wherever we see data directory for odoo settings we see:

RUN mkdir -p /odoo/data/odoo/{addons,filestore,sessions}

ODOO_DATA_PATH=/odoo/data \

I am getting permission problems when trying to use 16's image as base for my own image. pip is complaining about not enough permissions in /odoo/src directory to create the egg.info or something like that. I'm thinking the root cause could be connected to the volume definition. The errors arise when trying to build with build-arg UID=1000.

So volume should be /data/odoo or /odoo/data????

services:
  odoo:
    image: ${IMAGE}:${TAG}
    build: 
      context: ./odoo/
      network: host
      args:
        UID: ${UID}
        CACHEBUST: 1
    command: ['odoo', '--dev=xml,reload']
    expose:
      - "8069"
      - "8072"
    ports:
      - "${WEB_PDB_PORT}:5555"
    volumes:
      - "odoo_data:/odoo/data"      
      - "${ENTERPRISE_REPO_PATH}:/odoo/external-src/enterprise"
      - "${ADDONS_PATH}:/odoo/external-src/custom" 
    environment:
      - PYTHONDONTWRITEBYTECODE=true
      - ADMIN_PASSWD=admin
      - DB_NAME=odoodb
      - LIST_DB=True
      - ODOO_BASE_URL=${ODOO_BASE_URL}
      - ODOO_REPORT_URL=${ODOO_REPORT_URL}
      - KWKHTMLTOPDF_SERVER_URL=${KWKHTMLTOPDF_SERVER_URL}
      - MIGRATE=false
      - LIMIT_TIME_REAL=1200000
      - LIMIT_TIME_REAL_CRON=1200000
      - PYTHONBREAKPOINT=web_pdb.set_trace
      - WORKERS=0
# syntax = docker/dockerfile:1.2
FROM ghcr.io/camptocamp/odoo-project:16.0-5.0.5

COPY ./src /odoo/src
COPY ./VERSION /odoo/
COPY ./setup.py /odoo/
COPY ./requirements.txt /odoo/
RUN pip3 install -e /odoo
RUN pip3 install -e /odoo/src

# Project's specifics packages
ARG CACHEBUST
RUN cd /odoo && pip3 install -r requirements.txt

ENV ADDONS_PATH=/odoo/local-src,/odoo/external-src/enterprise,/odoo/external-src/custom
Installing collected packages: odoo
#0 1.858   Running setup.py develop for odoo
#0 2.389     error: subprocess-exited-with-error
#0 2.389
#0 2.389     × python setup.py develop did not run successfully.
#0 2.389     │ exit code: 1
#0 2.389     ╰─> [4 lines of output]
#0 2.389         running develop
#0 2.389         running egg_info
#0 2.389         creating odoo.egg-info
#0 2.389         error: could not create 'odoo.egg-info': Permission denied
#0 2.389         [end of output]
#0 2.389
#0 2.389     note: This error originates from a subprocess, and is likely not a problem with pip.
#0 2.402 error: subprocess-exited-with-error
#0 2.402
#0 2.402 × python setup.py develop did not run successfully.
#0 2.402 │ exit code: 1
#0 2.402 ╰─> [4 lines of output]
#0 2.402     running develop
#0 2.402     running egg_info
#0 2.402     creating odoo.egg-info
#0 2.402     error: could not create 'odoo.egg-info': Permission denied
#0 2.402     [end of output]
#0 2.402
#0 2.402 note: This error originates from a subprocess, and is likely not a problem with pip.
------
failed to solve: process "/bin/sh -c pip3 install -e /odoo/src" did not complete successfully: exit code: 1

Question: best way to run Odoo 12.0 on Python 3.6 or 3.7, Debian Strech aging...

Hello,

The current Docker image for Odoo 12.0 run Python 3.5.3 on Debian 9 - Strech.

But:

And also, I have a requirement to run Odoo 12 on Python 3.6 or 3.7 to use Data Classes (available on 3.6 via backport).

Considering all this what would you recommend?

  1. Run Odoo 12.0 on the Odoo 13.0 Docker image? (does it work well?)
  2. Upgrade the current Odoo 12.0 Image to Debian Buster?
  3. Other like compile Python 3.7 on Debian Strech (this is easy but this would probably mean fork the image instead of reusing it)

cant run image (error odoo.egg-info)

i cant find out where the problem is, but after creating the image for odoo 12 and running it in my docker-compose (customized the one from example folder) i get the following error message:

`Starting with UID : 999

Running without demo data
/odoo/src/odoo.egg-info is missing, probably because the directory is a volume.
Running pip install -e /odoo/src to restore odoo.egg-info
ERROR: /odoo/src is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with svn+, git+, hg+, or bzr+).
`

[proposal] Default database collation to collate=C

When a database is created by the container's entrypoint, it uses the default collation that will be en_US.utf8.

As discussed here: odoo/odoo#25196 (comment), this may be under-optimized with the use of LIKE queries using wildcards (LIKE 'foo%').

We have several possible axes of improvements:

  • add text_pattern_ops case by case where necessary
  • add trigram indices using pg_trgm which benefits for LIKE '%foo%' queries as well, case by case too however
  • create the databases with a C collation and locale en_US.utf8 (collate=C)

This is mainly the last point which should be discussed here.

Pros:

  • consistent sorting
  • expected general improvement of performance

Cons:

  • sorting of accented chars "sounds" wrong for French: Blanche, Béatrice, Claude is going to be sorted as Blanche, Béatrice, Claude instead of Béatrice, Blanche, Claude. Can be resolved with unaccent

My proposal is to change the calls to createdb in the image to always create them with collate=C.

move /opt/odoo to /odoo

We may want to move /opt/odoo to /odoo, some reasons

  • when we work from the outside of a container in a project, we have the directory "odoo" at the root directory, so the same structure inside the container is less confusing, and means we don't need to add/remove /opt in scripts
  • we anyway already have /data/odoo which isn't an usual unix directory and it seems it's not so important in the docker world to use our own directory in / (?)

Things to care about:

  • adapt the paths in the container
  • the directories /opt/bin and /opt/etc should be moved elsewhere to not be shadowed when we use a host volume on the full /odoo directory

Debian roadmap

Hi folks,

The end of LTS of Debian Jessie is 30/6/2020.
Odoo v8 and v9 are currently based on Jessie.

Are you planning to upgrade it to Debian Stretch ?

Error pytest

After upgrading a project to the last version
The following error occur when running pytest

Plugin 'pytest_cov' could not be loaded: (six 1.9.0 (/usr/local/lib/python2.7/dist-packages), Requirement.parse('six>=1.10.0'))

missing executable bit in /start-entrypoint.d/001_set_report_url

I noticed that in camptocamp/odoo-project:11.0-latest the /start-entrypoint.d/001_set_report_url is missing the executable bit so it won't be executed.

docker run --rm --entrypoint "/bin/bash" -ti  camptocamp/odoo-project:11.0-latest
root@85c327e2a9ee:/# ls -l /start-entrypoint.d/
total 8
-rwxrwxr-x 1 root root 991 Oct 31 16:22 000_set_base_url
-rw-rw-r-- 1 root root 648 Oct 31 16:22 001_set_report_url

Can't run example project either

Using ghcr.io/camptocamp/odoo-project 16.0-5.0.5 I'm getting "Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "docker-entrypoint.sh": executable file not found in $PATH: unknown"
I had to make some minor changes to my Dockerfile:

# syntax = docker/dockerfile:1.2
FROM ghcr.io/camptocamp/odoo-project:16.0-5.0.5

COPY ./src /odoo/src
COPY ./external-src /odoo/external-src
COPY ./VERSION /odoo/
USER root
COPY ./requirements.txt /odoo/
RUN chown -R odoo:odoo /odoo
USER odoo
RUN pip3 install -e /odoo/src

# Project's specifics packages
RUN cd /odoo && pip3 install -r requirements.txt

ENV ADDONS_PATH=/odoo/local-src,/odoo/external-src/enterprise,/odoo/src/addons

And this is my compose file:

services:
  odoo:
    image: odoo:16-custom
    build: 
      context: ./odoo/
      network: host
    volumes:
      - "odoo_data:/data/odoo"
      - "./odoo:/odoo"
      - "/home/rolando/gits/odoo/enterprise:/odoo/external-src/enterprise"
      - "/home/rolando/projects/mc/edicolombia/mc-addons:/odoo/local-src"
    environment:
      - DB_USER=odoo
      - DB_PASS=odoo
      - PROXY_MODE=true
      - DB_NAME=odoodb
      - ADMIN_PASSWD=odoo
      - ODOO_BASE_URL=odoo-edicolombia.docker.localhost
      - ODOO_REPORT_URL=http://odoo:8069
      - KWKHTMLTOPDF_SERVER_URL=http://kwkhtmltopdf:8080
    depends_on:
      - db
      - kwkhtmltopdf      
    labels:
      - traefik.enable=true
      - traefik.http.routers.co-edi-16.entrypoints=https
      - traefik.http.routers.co-edi-16.tls=true
    networks:
      - traefik_net
      - db_net
 
  kwkhtmltopdf:
    image: ghcr.io/acsone/kwkhtmltopdf:0.12.5-latest
    networks:
      - db_net

  db:
    image: postgres:13-alpine
    environment:
      POSTGRES_USER: odoo
      POSTGRES_PASSWORD: odoo
      POSTGRES_DB: postgres
    volumes:
      - "db_data:/var/lib/postgresql/data"
    networks:
      - db_net
volumes:
  odoo_data:
  db_data:
version: "3.8"

services:
  odoo:
    image: odoo:16-custom
    build: 
      context: ./odoo/
      network: host
    volumes:
      - "odoo_data:/data/odoo"
      - "./odoo:/odoo"
      - "/home/rolando/gits/odoo/enterprise:/odoo/external-src/enterprise"
      - "/home/rolando/projects/mc/edicolombia/mc-addons:/odoo/local-src"
    environment:
      - DB_USER=odoo
      - DB_PASS=odoo
      - PROXY_MODE=true
      - DB_NAME=odoodb
      - ADMIN_PASSWD=odoo
      - ODOO_BASE_URL=odoo-edicolombia.docker.localhost
      - ODOO_REPORT_URL=http://odoo:8069
      - KWKHTMLTOPDF_SERVER_URL=http://kwkhtmltopdf:8080
    depends_on:
      - db
      - kwkhtmltopdf      
    labels:
      - traefik.enable=true
      - traefik.http.routers.co-edi-16.entrypoints=https
      - traefik.http.routers.co-edi-16.tls=true
    networks:
      - traefik_net
      - db_net
 
  kwkhtmltopdf:
    image: ghcr.io/acsone/kwkhtmltopdf:0.12.5-latest
    networks:
      - db_net

  db:
    image: postgres:13-alpine
    environment:
      POSTGRES_USER: odoo
      POSTGRES_PASSWORD: odoo
      POSTGRES_DB: postgres
    volumes:
      - "db_data:/var/lib/postgresql/data"
    networks:
      - db_net
volumes:
  odoo_data:
  db_data:

networks:
  traefik_net:
    external: true
  db_net:
networks:
  traefik_net:
    external: true
  db_net:

Any help will be appreciated

python 3.5 end-of-life in strech / boto3 won't install on top

Python 3.5 has reached it end of life, perhaps it would be a good idea to base 12.0 on something more modern?

White at it, a lot of dependencies are very much outdated too in 12.0, boto3 won't install just on top because of dependencies conflicts and requires uninstall of requests and liburl

Builds failing due to EOL of Python 2

Builds fails with error message

    You are running Setuptools on Python 2, which is no longer
    supported and
    >>> SETUPTOOLS WILL STOP WORKING <<<
    in a subsequent release (no sooner than 2020-04-20).
    Please ensure you are installing
    Setuptools using pip 9.x or later or pin to `setuptools<45`
    in your environment.
    If you have done those things and are still encountering
    this message, please comment in
    https://github.com/pypa/setuptools/issues/1458
    about the steps that led to this unsupported combination.

Database creation problem

I cleaned migration.yml anthem tags.
When i use DB_NAME with env. its creating database but wont install base addons etc. and container getting error
image

I just want run container without database. i will cretate after. or why wont install base addons ?

how can i success ?

Version 5.X.X batteries images are not built

Maybe I'm mistaken, but in the 5.X.X (master) branch "make VERSION=XX BATTERIES=true" does not lead to an image with batteries included.
Do I miss something or is it an omission?

Error in docker-entrypoint.sh

Hello,

Since the last change in docker-entrypoint.sh (7a18a12) I have a problem with some commands.
Following commands fails with a the error "/odoo-bin/docker-entrypoint.sh: line 136: [: too many arguments"
docker-compose run odoo gosu odoo migrate
docker-compose run odoo gosu odoo bash

@vrenaville @p-tombez

remote postgresql user/database connection issue

Hi,
Im trying to setup docker compose stack, odoo with remote db instead of stack db.
Whenever i try to start the container, it throws error password authentication failed,

Starting with UID : 999
Running without demo data
2022/09/28 15:41:47 Waiting for: tcp://192.168.1.104:5432
2022/09/28 15:41:47 Connected to tcp://192.168.1.104:5432
psql: error: connection to server at "192.168.1.104", port 5432 failed: FATAL:  password authentication failed for user "odoo-c2c"
createdb: error: connection to server at "192.168.1.104", port 5432 failed: FATAL:  password authentication failed for user "odoo-c2c"

But when i use stack db it working. As well as when I use remote db with odoo stock image, it works perfectly.
Im not user what is the problem causing. remote db is accessible is accessible over the network. Password is also correct, but it throws password authentication failed. Thanks

[13.0] python libs versions for buster

Encountered following error while using freezegun on 13.0:

    from freezegun import freeze_time
usr/local/lib/python3.7/dist-packages/freezegun/__init__.py:9: in <module>
    from .api import freeze_time
usr/local/lib/python3.7/dist-packages/freezegun/api.py:26: in <module>
    _EPOCHTZ = datetime.datetime(1970, 1, 1, tzinfo=dateutil.tz.UTC)
E   AttributeError: module 'dateutil.tz' has no attribute 'UTC'

This error is fixed by bumping python-dateutil lib to 2.7.3 as per odoo requirements.txt: https://github.com/odoo/odoo/blob/13.0/requirements.txt

However, it seems there are quite a few more libs to update according to following commit on odoo: odoo/odoo@32e455b

Broken packages v10

some updates are missing for python
bug appeared on tag 4.0.0, to reproduce it try to execute any test with pytest
a stack trace

Traceback (most recent call last):
File "/usr/local/bin/pytest", line 11, in <module>
load_entry_point('pytest==5.3.2', 'console_scripts', 'pytest')()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2443, in load
return self.resolve()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2449, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python2.7/dist-packages/pytest/__init__.py", line 6, in <module>
from _pytest.assertion import register_assert_rewrite
File "/usr/local/lib/python2.7/dist-packages/_pytest/assertion/__init__.py", line 7, in <module>
from _pytest.assertion import rewrite
File "/usr/local/lib/python2.7/dist-packages/_pytest/assertion/rewrite.py", line 205
def _is_marked_for_rewrite(self, name: str, state):

Build failing due to yaml parsing in 9.0/10.0/11.0

On master, the build is failing with:

2019-03-11 08:21:55,103 79 CRITICAL odoodb_test odoo.service.server: Failed to initialize database `odoodb_test`.
Traceback (most recent call last):
  File "/odoo/src/odoo/service/server.py", line 945, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)
  File "/odoo/src/odoo/modules/registry.py", line 85, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/odoo/src/odoo/modules/loading.py", line 321, in load_modules
    report=report, models_to_check=models_to_check)
  File "/odoo/src/odoo/modules/loading.py", line 184, in load_module_graph
    _load_data(cr, module_name, idref, mode, kind='demo')
  File "/odoo/src/odoo/modules/loading.py", line 95, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "/odoo/src/odoo/tools/convert.py", line 789, in convert_file
    convert_yaml_import(cr, module, fp, kind, idref, mode, noupdate, report)
  File "/odoo/src/odoo/tools/yaml_import.py", line 854, in yaml_import
    yaml_interpreter.process(yaml_string)
  File "/odoo/src/odoo/tools/yaml_import.py", line 794, in process
    for node in yaml.load(yaml_string):
  File "/usr/local/lib/python3.5/dist-packages/yaml/__init__.py", line 113, in load
    return loader.get_single_data()
  File "/usr/local/lib/python3.5/dist-packages/yaml/constructor.py", line 43, in get_single_data
    return self.construct_document(node)
  File "/usr/local/lib/python3.5/dist-packages/yaml/constructor.py", line 52, in construct_document
    for dummy in generator:
  File "/usr/local/lib/python3.5/dist-packages/yaml/constructor.py", line 404, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/usr/local/lib/python3.5/dist-packages/yaml/constructor.py", line 210, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/usr/local/lib/python3.5/dist-packages/yaml/constructor.py", line 131, in construct_mapping
    key = self.construct_object(key_node, deep=deep)
  File "/usr/local/lib/python3.5/dist-packages/yaml/constructor.py", line 92, in construct_object
    data = constructor(self, node)
  File "/usr/local/lib/python3.5/dist-packages/yaml/constructor.py", line 420, in construct_undefined
    node.start_mark)
yaml.constructor.ConstructorError: could not determine a constructor for the tag '!record'
  in "<byte string>", line 2, column 3:
      !record {model: 'res.partner', i ... 
      ^

Allow passing --dev switch to odoo at startup

I used the --dev switch when developing odoo with my custom docker image. Passed --dev=all at startup and the service restarted when it detected changes in the XML files or in python codes. This ofter resulted in not needing to restart the whole application.

Am I missing something or the current project setup lacks this option completely?

base_requirements.txt of 12.0 in image version 5.1.0 causes errors

In version 5.1.0 of the image definition the base_requirments.txt has much newer versions of python libs from the official odoo source requirements.txt.
This leads to strange errors. For instance PyPDF==1.27 leads to errors when printing.
I just want to understand: isn't it habit to follow the Odoo requirements?
If yes or no, why would we use much newer libs?

[10.0] pytest not fixed -> invalid syntax

As Python 2.7 is now deprecated some libs like pytest must be set to a fixed version.

For pytest, last version is: 4.6.x

https://docs.pytest.org/en/latest/py27-py34-deprecation.html

This impacts most likely all Python 2.x images.

Traceback Currently launching pytest gives the following result:
Traceback (most recent call last):
  File "/usr/local/bin/pytest", line 11, in <module>
    load_entry_point('pytest==5.3.2', 'console_scripts', 'pytest')()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/pytest/__init__.py", line 6, in <module>
    from _pytest.assertion import register_assert_rewrite
  File "/usr/local/lib/python2.7/dist-packages/_pytest/assertion/__init__.py", line 7, in <module>
    from _pytest.assertion import rewrite
  File "/usr/local/lib/python2.7/dist-packages/_pytest/assertion/rewrite.py", line 205
    def _is_marked_for_rewrite(self, name: str, state):
                                         ^
SyntaxError: invalid syntax

default database

how can i install a database template in first run ? its not create database in run. and also i want disable MARABUNTA mode complety any suggestion ?

Anthem not working with OCA Wheelhouse due to PIP problems

I tried to integrate the OCA approach of installing Odoo addons via pip instead of importing external source repositories.
More about this can be found here and here.
Also I prepared a minimal example based on https://github.com/camptocamp/test-odoo-project demonstrating this for the example of installing disable_odoo_online from OCA server-tools here: camptocamp/test-odoo-project@master...codingforfun:pip-issue
https://github.com/codingforfun/test-odoo-project/tree/pip-issue

I run into the problem that anthem isn't finding odoo anymore if requirements from requirements.txt inside the child container contain dependencies to Odoo.
The reason seams to be that Odoo gets installed in the parent container with 'pip install -e'.

I did some research but don't have any conclusion yet and hope you maybe have an idea. It seams to have something to do with namespace packages. Pip packaged Odoo modules adds namespace_packages: ['odoo', 'odoo.addons'] inside setup.py for the module.
I was able to run anthem inside the container again after removal of the corresponding nspkg.pth from dist-packages.

Some relevant references I found:

The error log I get from docker-compose up --build:

[...]
Step 1/1 : RUN cd /opt/odoo && pip install -r src_requirements.txt
 ---> Running in c5f7fb4b75ee
Obtaining file:///opt/odoo (from -r src_requirements.txt (line 7))
Obtaining file:///opt/odoo/src (from -r src_requirements.txt (line 8))
Requirement already satisfied: babel>=1.0 in /usr/local/lib/python2.7/dist-packages (from odoo==10.0->-r src_requirements.txt (line 8))
[...]
Requirement already satisfied: python-stdnum in /usr/local/lib/python2.7/dist-packages (from vatnumber->odoo==10.0->-r src_requirements.txt (line 8))
Installing collected packages: test-odoo-project, odoo
  Running setup.py develop for test-odoo-project
  Running setup.py develop for odoo
Successfully installed odoo test-odoo-project
 ---> 6625234dcd4b
[...]
Step 4/5 : RUN cd /opt/odoo && find . -maxdepth 1 -name "*requirements.txt" ! -name src_requirements.txt ! -name base_requirements.txt -exec pip install --extra-index-url=https://wheelhouse.odoo-community.org/oca-simple -r {} \;
 ---> Running in d8d69d9a0631
Collecting odoo10-addon-disable-odoo-online (from -r ./requirements.txt (line 2))
  Downloading odoo10_addon_disable_odoo_online-10.0.1.0.0-py2-none-any.whl
Requirement already satisfied: odoo<10.1dev,>=10.0 in ./src (from odoo10-addon-disable-odoo-online->-r ./requirements.txt (line 2))
Requirement already satisfied: babel>=1.0 in /usr/local/lib/python2.7/dist-packages (from odoo<10.1dev,>=10.0->odoo10-addon-disable-odoo-online->-r ./requirements.txt (line 2))
[...]
Requirement already satisfied: python-stdnum in /usr/local/lib/python2.7/dist-packages (from vatnumber->odoo<10.1dev,>=10.0->odoo10-addon-disable-odoo-online->-r ./requirements.txt (line 2))
Installing collected packages: odoo10-addon-disable-odoo-online
Successfully installed odoo10-addon-disable-odoo-online-10.0.1.0.0
 ---> 90257035d29e
[...]
odoo_1   | |> migration: processing version 10.0.0
odoo_1   | |> version 10.0.0: start
odoo_1   | |> version 10.0.0: execute base pre-operations
odoo_1   | |> version 10.0.0: anthem songs.install.pre::main
odoo_1   | Traceback (most recent call last):
odoo_1   |   File "/usr/local/bin/anthem", line 7, in <module>
odoo_1   |     from anthem.cli import main
odoo_1   |   File "/usr/local/lib/python2.7/dist-packages/anthem/cli.py", line 22, in <module>
odoo_1   |     import openerp as odoo  # noqa
odoo_1   | ImportError: No module named openerp
odoo_1   | Traceback (most recent call last):
odoo_1   |   File "/usr/local/bin/marabunta", line 11, in <module>
odoo_1   |     sys.exit(main())
odoo_1   |   File "/usr/local/lib/python2.7/dist-packages/marabunta/core.py", line 126, in main
odoo_1   |     migrate(config)
odoo_1   |   File "/usr/local/lib/python2.7/dist-packages/marabunta/core.py", line 115, in migrate
odoo_1   |     runner.perform()
odoo_1   |   File "/usr/local/lib/python2.7/dist-packages/marabunta/runner.py", line 85, in perform
odoo_1   |     VersionRunner(self, version).perform()
odoo_1   |   File "/usr/local/lib/python2.7/dist-packages/marabunta/runner.py", line 143, in perform
odoo_1   |     operation.execute(self.log)
odoo_1   |   File "/usr/local/lib/python2.7/dist-packages/marabunta/model.py", line 259, in execute
odoo_1   |     self._execute(log, interactive=sys.stdout.isatty())
odoo_1   |   File "/usr/local/lib/python2.7/dist-packages/marabunta/model.py", line 246, in _execute
odoo_1   |     child.exitstatus
odoo_1   | marabunta.exception.OperationError: command 'anthem songs.install.pre::main' returned 1
testodooproject_odoo_1 exited with code 1
[...]

bin/runtests - Travis cached database issues

I spotted 2 use cases that can case cause trouble right now.

Both can be resolved by dropping the cache, but can leave to false positive or false negative travis builds.

Both affect only the migration testing. It will affect people using migration.yml and changing the odoo/VERSION file.

With the following config in travis:

before_install:
  - if [ "$TRAVIS_PULL_REQUEST" == "false" -a -z "$TRAVIS_TAG" ] ; then export CREATE_DB_CACHE="true" ; fi
script:
  - docker-compose -f $TRAVIS_COMPOSE run --rm -e MARABUNTA_MODE=sample -e MARABUNTA_ALLOW_SERIE=True -e CREATE_DB_CACHE=${CREATE_DB_CACHE} -e MIG_LOAD_VERSION_CEIL=${TRAVIS_TAG} odoo runmigration

1. ⏲️ Cached DB is not generated on the right time (meaning after a tag)

So you have an extra version in it that can raise issue.
(this is typically what happened on some case with 5 digits versions)

master

  • commit 1 tag 10.0.1
    no cache created (travis fails or no cache setup existed)
  • commit 2
    add a step in migration.yml for next release 10.0.2
    -> CACHED DB named 10.0.1 with step 10.0.2 ☠️
  • commit 3
    Travis launch migration.yml restore with step 10.0.2 already installed 💣

how to solve it

  • Drop cache, relaunch job of tag 10.0.1

TODO fix caching feature

Do the playing of migration.yml in 2 steps
1a. restore dump
or
1b. install till previous versions
2. install current version

In the script we should truncate migration.yml setting up the new database for step (1b).

It's not perfect as the code is not exactly to the version it was on tag install. But each steps should still be installable. Thus would be close to creating cache from scratch but still faster and would be fail safe.

2. 🤕 On patched version

We should be looking for a cached DB named after odoo/VERSION thus play the current step. It should use master branch cache, but in case there is no cache on master it will create it's own which might become an issue with multiple commits on a patch branch. Now, the issue that could happen is when merging the patched version into master you might be adding a version in the past, which makes the cache invalid.

  • create release-10.1.0 -> deployed on integration then prod
  • create release-10.2.0 -> deployed on integration only
  • create patch-release-10.1.1
  • merge patch into master 💣

When merging patch-release-10.1.1 on top of release-10.2.0 we create a new step in the past.
Thus cache became invalid. I currently don't see how we could detect that.

how to solve it

Here we need either to:

  • drop cache and replay from scratch (manually)
    or
  • drop cache and relaunch tag 10.1.0 so we dropped 10.2.0 then launch our job again. (manually)

TODO fix caching feature

Here the issue is that we need to know which version are installed in which cached DB before restauring any. Thus, we might want to create a manifest file per dump listing all installed versions.
Thus, if 10.1.1 is merged on top of 10.2.0, we could do the following steps:

  1. Drop cached DB > 10.1.1 that are missing version 10.1.1 (manifest files compared to migration.yml)
  2. Restore dump from highest version < 10.1.1 (ie. 10.1.0) or nothing if doesn't exists
  3. truncate migration.yml after 10.1.1 (we want to prepare a dump that includes 10.1.1)
  4. Run migration till 10.1.1
  5. Create cached file
  6. Run last migration step 10.2.0

bin/runtests - local-src is unnecessarily updated

This is not efficient. On large projects installing local-src can easily take at least a minute or two.

IMO they should be installed and tested at the same time, basically merging these lines:

echo "🔧🔧 Install local-src modules 🔧🔧"
gosu odoo odoo --stop-after-init --workers=0 --database $DB_NAME_TEST --log-level=warn --without-demo="" --db-filter=$DB_NAME_TEST -i ${LOCAL_ADDONS}
export COVERAGE_FILE=/home/odoo/.coverage
gosu odoo coverage run --source="${LOCAL_SRC_DIR}" "${ODOO_BIN_PATH}" --stop-after-init --workers=0 --database $DB_NAME_TEST --test-enable --log-level=test --log-handler=":INFO" --db-filter=$DB_NAME_TEST -u ${LOCAL_ADDONS}

Wait until postgres is really available

Even if the postgres port is open, it can still answer FATAL: the database system is starting up so we have to make preemptive checks when we wait for postgres.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.