Skip to content

Commit

Permalink
Merge pull request #243 from rubencabrera/11-doc-docker
Browse files Browse the repository at this point in the history
feat: add pudb and also the upstream volume
  • Loading branch information
rubencabrera authored Jul 18, 2024
2 parents a094b01 + 6d5fd43 commit c7f54d3
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <dev@rubencabrera.es>
EXPOSE 8069 8071 8072
ENV LANG C.UTF-8
Expand Down
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
20 changes: 17 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,26 @@ 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"
restart: always
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
Expand All @@ -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

0 comments on commit c7f54d3

Please sign in to comment.