Home » Install odoo 13 using Docker like a Pro.
install-odoo13-using-docker

Install odoo 13 using Docker like a Pro.

by mn.sobieh

Odoo is a powerful open-source business applications suite. It provides comprehensive functional coverage for business needs. Odoo contains CRM, ERP, sales, project management,  HR Management Suites, Accounting, and Business Instant Messaging. This article explains how to install ODOO 13 and postgres database using docker. In easy two steps approach, In additional to advanced installation.

What we will do

Hence, In this article we are going through the following

  • Setup docker environment.
  • Install ODOO 13 in easy two steps.
  • Install ODOO 13 docker like a Pro, by customization and advanced configuration.

Docker Containers

Containers allow you to improve your server security. In other word , It will isolate applications from the host system and from each others. In addition, you have easier management since install, upgrade, and rollback processes are very simple and fast.

First, we If you are using Ubuntu there are few packages you should install to run the docker.

sudo apt install apt-transport-https ca-certificates curl software-properties-common
After that, we will install latest stable version of docker from docker team (not the one provided by ubuntu).
This will be through few steps. These steps conclude Install GPG key for security. then ,  Install a stable version of the Docker .
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu (lsb_release -cs) stable" 
sudo apt update 
sudo apt install docker-ce

Finally, Add your user to the docker group.

sudo usermod -aG docker $USER

Simple ODOO 13 installation

To install odoo, firstly, we’ll lunch a postgreSQL database instance, just execute the following command. Make sure that, you don’t change database name

docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo -e POSTGRES_DB=postgres --name odoo-db postgres:10

Then, lunch odoo contains.

docker run -p 8069:8069 --name odoo --link db:odoo-db -t odoo

By executing the last command, you installed odoo. accordingly, You can access your application through URL http://<Server IP >: 8069

Advanced ODOO 13 installation

Now, we further customize ODOO installation, by expanding it’s capabilities, for example, We will automate ODOO container creation; auto restart; secure odoo database, and add persistence storage to keep all your data safe. If you don’t have it you can Install docker compose

Setup odoo pre-requirements

To begin with, we will create a folder odoo-crm. Then, navigate inside that folder. Then create a file with name dockerfile.

mkdir ~/odoo-crm
cd ~/odoo-crm
vi dockerfile

Add the following YAML, which achieve what we want.afterward, we will comp

version: '3'
services:
  odoo-app:
    container_name: odoo-app
    image: odoo:13
    depends_on:
      - db
    restart: unless-stopped
    ports:
      - 8069:8069/tcp
    volumes:
      - ./odoo-app/web-data:/var/lib/odoo
      - ./odoo-app/config:/etc/odoo
      - ./odoo-app/addons:/home/odoo/addons
      - ./odoo-app/enterprise:/home/odoo/enterprise
  db:
    container_name: odoo-db
    image: postgres:10
    restart: unless-stopped
    expose:
      - 5432/tcp
    volumes:
      - ./odoo-db:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=odoo
      - POSTGRES_PASSWORD=odoo

Secure database communication.

When you execute docker compose command, It will  automatically create a separate network , thus,  isolating all containers mentioned in the YAML file.

ODOO auto restart

When adding option “restart: unless-stopped” . It will put the containers

Persistence storage

When Docker-compose starts , it will automatically creates the folder structure for persistence storage. Container will read the data and configurations from paths described in the dockerfile. However, we will create them manually, in order to customize odoo configuration.

Application folder structure 

The following is the structure of odoo application directories. As you can see it allows you to easily manage addons and change the configuration odoo.

odoo-app/
├── addons
├── config
│   └── odoo.conf
├── enterprise
└── web-data

odoo-app/web-data          maps to container internal path /var/lib/odoo
odoo-app/config                maps to container internal path /etc/odoo
odoo-app/addons              maps to container internal path /home/odoo/addons
odoo-app/enterprise         maps to container internal path /home/odoo/enterprise

Database data

Docker-compose will create the folder for postgreSQL data files. Therefore, you don’t need to create that folder.

odoo-db        maps to container internal path /var/lib/postgresql/data

mkdir  odoo-app ; cd odoo-app ;
mkdir web-data config addons
chmod -R 755 odoo-app/
mkdir odoo-db

Configure ODOO Settings

We will customize odoo setting by changing odoo.conf.  This file contains lot of configuration, however , we will focus on few settings. for example, database server and Master password.

if you want advanced settings read that article.

Create odoo.conf file inside our config directory, then, add configuration the following lines

cat <<\EOF >>  odoo-app/config/odoo.conf
[options]  
admin_passwd = <OdooMasterPassword> 
db_host = odoo-db 
addons_path = /home/odoo/addons,/home/odoo/enterprise  
EOF

Lunch ODOO instances

while you are inside odoo-crm directory, execute the following command to start docker-compose.

docker-compose up -d

On successful execution, you can access it through URL http://<Server IP >: 8069

Finally, setup ODOO.

When you navigate to your website you will see the following page.

odoo-setup-intro

Just enter  your admin password, and chose a name for odoo database, then enter your details. when you click create database button, odoo control panel will open showing all it’s features.

odoo-ControlPanel

Conclusion

Installing ODOO have been never easier, when you use containers. In few steps you’ll have your application ready.

Leave a Comment