camptocamp/docker-odoo-project

Allow passing --dev switch to odoo at startup

szabolcsmaj opened this issue · 5 comments

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?

you can start the container with --dev sending it directly, but we don't have it in setup,
it is not needed in production for instance, plus during dev you may don't want this option to run

Thank you @i-vyshnevska for your quick answer. I'm using docker-compose during development. How can I pass the --dev switch to the odoo container without overriding the entrypoint?

docker-compose run --rm odoo odoo --dev=foo --what-ever-you-like-to-pass-to-the-odoo-executable

I'm sorry, I didn't explain it properly. I meant where should I put the --dev=all switch in the docker-compose.yml file?

It looks like this ATM:

  odoo:
    build: odoo
    image: project-image:latest
    environment:
      - DEMO=True
      - MARABUNTA_MODE=demo
      - MARABUNTA_ALLOW_SERIE=True
      - LIST_DB=True
      - PYTHONDONTWRITEBYTECODE=True
      - LOCAL_USER_ID=$UID
      - RUNNING_ENV=$ENV
      - DB_HOST=$PGHOST
      - DB_NAME=$PGDATABASE
      - DB_USER=$PGUSER
      - DB_PASSWORD=$PGPASSWORD
      - PGHOST=$PGHOST
      - PGDATABASE=$PGDATABASE
      - PGUSER=$PGUSER
      - PGPASSWORD=$PGPASSWORD
      - ADDONS_PATH=$ADDONS_PATH
    hostname: ${ENV}-${COMPOSE_PROJECT_NAME}
    labels:
      - "traefik.enable=true"
      - "traefik.port=8069"
      - "traefik.http.routers.odoo.rule=Host(`odoo.localhost`)"
      - "traefik.http.routers.odoo_long.rule=Host(`odoo.localhost`) && PathPrefix(`/longpolling/`)"
      - "traefik.http.services.odoo_long.loadbalancer.server.port=8072"
      - "docky.main.service=true"
      - "docky.user=odoo"
    links:
      - db
    volumes:
      - ./odoo:/odoo
      - odoo:/data/odoo

I don't think you should do it there. If you need it always while developing you could create an alias instead.

Eg: alias docodev='docker-compose run --rm -p 8069:8069 odoo odoo --workers=0 --dev=foo --what-ever-you-like-to-pass-to-the-odoo-executable'