diff --git a/Dockerfile b/Dockerfile index 87f8c5a..a6e1fe9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # DOCKER image to run odoo 16 with Odoo Community Backports and OCA addons -FROM rubencabrera/odoo-base-image:16.0.1 +FROM rubencabrera/odoo-base-image:16.1.0 MAINTAINER Rubén Cabrera Martínez EXPOSE 8069 8071 8072 ENV LANG C.UTF-8 diff --git a/README.md b/README.md index 958c30b..fda1948 100644 --- a/README.md +++ b/README.md @@ -44,14 +44,37 @@ volume, named using the environment variable `$ODOO_DOCKER_PROJECT_NAME` The docker compose volume with the code configured in the given `docker-compose.yml` will need an existing **empty** directory where the repos -will be cloned. The default path is -`${HOME}/.${ODOO_DOCKER_PROJECT_NAME}_repos` and can be overriden by setting -the `$ODOO_DOCKER_REPOS_HOST_PATH` (to an existing empty directory) before -running `docker-compose up`. +will be cloned (if not empty, the content will be mounted as is). The default +path is `${HOME}/.${ODOO_DOCKER_PROJECT_NAME}_repos` and can be overriden by +setting the `$ODOO_DOCKER_REPOS_HOST_PATH` (to an existing empty directory) +before running `docker-compose up`. The repos are all cloned using git with `--depth=1`, so can be worked as any other git repo. +#### Debugging + +[pudb][pudb] is now included in the base image. To insert a breaking point add +these lines of code to where you'll need to look into: + +```python +from pudb.remote import set_trace +set_trace(host='0.0.0.0') +``` + +The `6899` port will need to be open (see the docker-compose). + +Then run the container again, get it to hit the breaking point where the +`set_trace` is and connect with: + +``` +telnet 127.0.0.1 6899 +``` + +And it will open the terminal debugger. See [upstream docs][pudb] for more +details. + + ## Odoo server config using environment variables Odoo uses a config file that is a bit of a pain with a docker @@ -136,3 +159,4 @@ por ayudar. [issue-link]: https://github.com/rubencabrera/odoo-docker/issues/new [compose-install]: https://docs.docker.com/compose/install/] +[pudb]: https://documen.tician.de/pudb/index.html diff --git a/docker-compose.yml b/docker-compose.yml index 4c663b5..062ca60 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -46,16 +46,18 @@ services: # command: ["/opt/odoo/odoo-bin", "-d", "${DATABASE_NAME}", "-u", "module_to_update"] # command: ["/opt/odoo/odoo-bin", "-d", "${DATABASE_NAME}", "-u", "all"] # - container_name: ${COMPOSE_PROJECT_NAME}_odoo16 + container_name: ${COMPOSE_PROJECT_NAME}_odoo16_pudb depends_on: db: condition: service_healthy restart: true environment: - # FIXME: might want to remove this for prod. + # FIXME: might want to remove or make this more specific for prod. - DB_FILTER=.* - image: "rubencabrera/odoo-docker:16.1.1" + # image: "rubencabrera/odoo-docker:16.1.1" + image: "odoo-docker-pudb" ports: + - "6899:6899" # pudb telnet port - "8069:8069" - "8071:8071" - "8072:8072" @@ -63,6 +65,7 @@ services: volumes: - code_volume:/opt/repos - odoo_data:/var/lib/odoo + - upstream_volume:/opt/odoo volumes: code_volume: # This is where the code will live. For local development, you might want @@ -79,3 +82,14 @@ volumes: name: ${COMPOSE_PROJECT_NAME}_data_storage odoo_data: name: ${COMPOSE_PROJECT_NAME}_odoo_data + upstream_volume: + # Odoo main code. This volume should only be needed for upstream + # contributions. + driver: local + driver_opts: + o: bind + type: none + # FIXME: The local paths need to exist for volumes to be mounted. + # For prod environments, this might be better inside a dir in `/opt` + device: ${ODOO_DOCKER_UPSTREAM_HOST_PATH:-${HOME}/.${COMPOSE_PROJECT_NAME}_upstream} + name: ${COMPOSE_PROJECT_NAME}_upstream