1

I am deploying Odoo 15 with Docker, and I am using the docker-compose.yml recommended in https://hub.docker.com/_/odoo. As you can see, the following volumes are created for the web service:

volumes:
 - odoo-web-data:/var/lib/odoo
 - ./config:/etc/odoo
 - ./addons:/mnt/extra-addons

The conclusion here is that there is a volume named odoo-web-data for the Odoo core, and two binds, which I guess they are in order to modify easily the configuration file and the extra addons.

If I expect to add a lot of modules in the local directory addons, in order to add those modules to the container directory extra-addons, and therefore adding them to the Odoo running in the container, does it make sense to add them this way?

For example, I am going to add the whole Odoo Community Association l10n-spain repository from GitHub (with all their addons), among others. Obviously I will do git pull every now and again to update the repository.

As I am not an expert on Docker, do you think this structure is the best? What if I need to update the Odoo core in the named volume?

forvas
  • 9,801
  • 7
  • 62
  • 158

2 Answers2

3

The DigitalOcean's guide explains in details how to deploy odoo with docker using nginx (on Ubuntu 20.04):

Step 1 — Installing Docker Compose

sudo apt update
sudo apt install docker-compose

Step 2 — Running Odoo and PostgreSQL with Docker Compose

nano docker-compose.yml

version: '3'
services:
  odoo:
    image: odoo:15.0
    env_file: .env
    depends_on:
      - postgres
    ports:
      - "127.0.0.1:8069:8069"
    volumes:
      - data:/var/lib/odoo
  postgres:
    image: postgres:13
    env_file: .env
    volumes:
      - db:/var/lib/postgresql/data/pgdata

volumes:
  data:
  db:

...
...

Step 3 — Installing and Configuring Nginx

...
...
sudo nano /etc/nginx/sites-available/odoo.conf

server {
    listen       80;
    listen       [::]:80;
    server_name  your_domain_here;

    access_log  /var/log/nginx/odoo.access.log;
    error_log   /var/log/nginx/odoo.error.log;

    location / {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-Host $host;
      proxy_set_header X-Forwarded-Proto https;
      proxy_pass http://localhost:8069;
  }
}

Step 4 — Installing Certbot and Setting Up TLS Certificates

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d your_domain_here

Step 5 — Setting Up Odoo

Back in your web browser, reload the page. You should now have Odoo’s database configuration page open via a secure https:// connection. Now you can enter usernames and passwords safely to complete the installation process (Database Name, Email, Password, Demo data...) ... ...

Full documentation here : https://www.digitalocean.com/community/tutorials/how-to-install-odoo-on-ubuntu-20-04-with-docker

sylvain
  • 853
  • 1
  • 7
  • 20
  • Thank you, how to run Docker + Odoo + Nginx is useful too (although I expected a Docker image of Nginx and calling it from the `docker-compose.yml`, I was not expecting to install Nginx out of Docker containers). +1 for your info, but my question was more related to @CZoellner answer. – forvas Aug 01 '22 at 08:26
1

There shouldn't be the core in volume odoo-web-data, only the filestore and sessions. The core itself is already installed in the docker image as you can see here

# Install Odoo
ENV ODOO_VERSION 15.0
ARG ODOO_RELEASE=20220718
ARG ODOO_SHA=dc4a5b8c5be8f873e751539117f5aa41d9f7b217
RUN curl -o odoo.deb -sSL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odoo_${ODOO_VERSION}.${ODOO_RELEASE}_all.deb \
    && echo "${ODOO_SHA} odoo.deb" | sha1sum -c - \
    && apt-get update \
    && apt-get -y install --no-install-recommends ./odoo.deb \
    && rm -rf /var/lib/apt/lists/* odoo.deb

So updating the core usually means: Build or pull the image (for example latest) and recreate the container(s). And sometimes you also have to make an update for all modules for your existing databases, because the core (code) has changed.

CZoellner
  • 13,553
  • 3
  • 25
  • 38
  • Thank you @CZoellner. So, do you mean I have to change the line `image: odoo:15.0` to `image: odoo:latest` and remove the `odoo-web-data:/var/lib/odoo` volume in my `docker-compose.yml`? Won't be that way Odoo 15 updated to 16, 17, etc, each time I execute `docker compose up` throughout the years? And on the other hand, do you think it is OK to create volumes for extra addons in order to add and keep updated Odoo Community Association repositories, as I do in my `docker-compose.yml`? – forvas Aug 01 '22 at 08:35
  • No you don't have to change to "latest", but that's your decision. "Mounting" more volumes for example for extra addons should be fine. – CZoellner Aug 08 '22 at 07:33