A Guide to Installing and Configuring Odoo 13 Using Docker

A Guide to Installing and Configuring Odoo 13 Using Docker

After spending quite some time in software development, I realized creating a full-fledged ERP system solo is not a good idea, especially when you don't have much time to build it. It's like building a house brick by brick all by yourself. But, there comes a moment when you need a solution that's ready to roll, customizable, and built with the tech you love, which is Python. That's when I decided to take a dip into Odoo.

Technology Stack of Odoo 13

Python: It's the language that powers Odoo. The programming language that I love for its readability and versatility, forming the backbone of Odoo's development.

PostgreSQL: Powerful open-source relational database management system that ensures data integrity and scalability within Odoo.

JavaScript and XML: Odoo uses Javascript and XML for frontend development and customization.

Odoo: A Fit for Any Business

Whether you're a tiny startup, a mid-sized player, or a big shot in the business world, Odoo offers you a complete solution. Odoo's modular structure allows for scalability and customization, making it adaptable to various business domains. It's for all sorts of industries – manufacturing, e-commerce, finance, HR. So, whatever your business flavor, Odoo 13 can form itself to fit right in.

I went for Odoo 13 instead of the newer Odoo because it comes with a bunch of useful features for free. Even though it's not officially supported by Odoo, but there's an active community ready to help with any issues or customizations.

Installing Docker (Ubuntu 22.04)

Let's install Docker from the official Docker from the Docker repository. To do that, we will add the new package source and add the GPG key from docker to ensure the downloads are valid.

Update the existing list of packages:

sudo apt update

Next, we have to install every required package in the system to run the docker:

sudo apt install apt-transport-https ca-certificates curl software-properties-common

Get the GPG key for maintenance and security:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Get the stable version of the docker repository:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Update all the system packages:

sudo apt update

Install the docker community edition using the below command:

sudo apt install docker-ce

Install Odoo 13 on docker

Initially, we must install and configure the database container since the Odoo container will be relying on the database container:

Intalling PostgreSQL 10 image:

docker pull postgres:10

Creating database container:

docker run -d -v odoo-db:/var/lib/postgresql/data -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo -e POSTGRES_DB=postgres --name db postgres:10

You must change the database user, password, and database name with the one you want to assign.

Explanation:

docker run -d -v: Initiates container creation using the downloaded image.

odoo-db:/var/lib/postgresql/data: Establishes a dedicated folder for database data, ensuring Odoo data persists even if the container is removed.

POSTGRES_USER=odoo: Assigns a name to the database user (you should change it with the one you want).

POSTGRES_PASSWORD=odoo: Sets the password for the user (you should change it with the one you want).

POSTGRES_DB=postgres: Specifies the desired database name.

--name db: Labels the container with an easily recognizable name.

postgres:10: Uses the PostgreSQL image for container creation, aligning with the specified settings.

Now we need to install and configure the Odoo container:

Installing Odoo 13 image:

docker pull odoo:13

Creating Odoo container:

docker run -d -v /custom/conf/path:/etc/odoo -v /path/to/addons:/mnt/extra-addons -p 8069:8069 --name odoo --link db:db -t odoo:13

-v /custom/conf/path:/etc/odoo: This option mounts the local directory /custom/conf/path from the host machine to the /etc/odoo path inside the running container. Here is my custom /custom/conf/path/odoo.conf file.

[options]

limit_time_real = 1000000 # if you have a large database to import

addons_path = /mnt/extra-addons

-v /path/to/addons:/mnt/extra-addons: This option mounts the local directory /path/to/addons from the host machine to the /mnt/extra-addons path inside the running container. It is used to provide additional addons or modules for Odoo.

-p 8069:8069: This option maps port 8069 from the container to port 8069 on the host machine. This is the default port for the Odoo application.

--name odoo: This option sets the name of the container to "odoo," making it easier to reference the container by name instead of its container ID.

--link db:db: This option establishes a connection between the 'odoo' container and the 'db' container, ensuring communication between Odoo and the database.

-t odoo:13: Allocates a pseudo-TTY, enhancing interaction with the container.

Open port in the firewall:

sudo ufw allow 8069

Now that you've got Odoo running on http://localhost:8069, let's dive in! Create an account and explore the open-source goodness of Odoo, although Odoo formerly known as OpenERP.

I trust Odoo will simplify your business. Thanks to Docker, setting up Odoo 13 is now easy, even with its dependencies on older packages. Whether you're starting a new venture or have an established business, Odoo 13 offers a complete solution. While I'm not a hardcore Odoo developer, exploring different tech, Odoo has captured my interest like only a few of others. Enjoy exploring!