If you're looking to set up an Odoo server quickly and efficiently, especially to integrate modules from the Odoo Community Association (OCA), leveraging Docker offers significant advantages. This method allows you to "containerize" your Odoo server, isolating it within a virtual environment. This isolation ensures that your Odoo installation does not interfere with other services on your server, providing a clean and robust setup.
The Docker approach is not only practical and quick for testing purposes but also robust enough for full production environments. It simplifies deployment and management, making it an excellent choice for developers and system administrators alike.
This guide provides a basic, step-by-step walkthrough, primarily tailored for Ubuntu OS, but the principles can be easily adapted for MacOS or Windows environments. The methodology is based on practices outlined in Elico-Corp's odoo-docker repository.
Getting Started: Prerequisites and Setup
Before proceeding with the Odoo and OCA module installation, ensure your system meets the following prerequisites:
Install Docker and Docker Compose
You will need both Docker Engine and Docker Compose installed on your system. Docker Engine is essential for running containers, while Docker Compose helps define and run multi-container Docker applications with a single command.
Create the Project Directory Structure
Begin by creating the necessary directories for your Odoo installation. We will assume your base installation directory is named
odoo. Navigate into this directory after creation and set up subdirectories for PostgreSQL data, Odoo addons, filestore, and sessions. These volumes will persist your data, ensuring it is not lost when containers are stopped or removed.mkdir odoo && cd odoo mkdir -p ./volumes/postgres ./volumes/odoo/addons ./volumes/odoo/filestore \ ./volumes/odoo/sessions
Configuring Your Odoo Environment with Docker Compose
Define Your Services in
docker-compose.ymlIn your newly created
odoodirectory, create a file nameddocker-compose.yml. This file will define the services (PostgreSQL database and Odoo application) that constitute your Odoo environment. The configuration below specifies a PostgreSQL database image and an Odoo 10.0 image, linking them together and mapping local volumes for data persistence. It also sets up environment variables, including a link to an OCA repository for additional modules.version: '3.3' services: postgres: image: postgres:9.5 volumes: - ./volumes/postgres:/var/lib/postgresql/data environment: - POSTGRES_USER=odoo odoo: image: elicocorp/odoo:10.0 command: start ports: - 127.0.0.1:8069:8069 volumes: - ./volumes/odoo/addons:/opt/odoo/additional_addons - ./volumes/odoo/filestore:/opt/odoo/data/filestore - ./volumes/odoo/sessions:/opt/odoo/data/sessions links: - postgres:db environment: - ADDONS_REPO=https://github.com/OCA/business-requirement.git - ODOO_DB_USER=odooLaunch Your Odoo Containers
Once your
docker-compose.ymlfile is configured, navigate to yourodoodirectory in the terminal and execute the following command. This will download the necessary Docker images, create the services defined in your YAML file, and start them in detached mode (-d), allowing them to run in the background.docker-compose up -d odoo
Post-Installation Configuration within Odoo
Access Your Odoo Instance
Open your preferred web browser and navigate to the URL you configured in your
docker-compose.ymlfile. In this specific example, the URL will be http://127.0.0.1:8069. You should be greeted by the Odoo setup page.Create a New Database
Follow the on-screen prompts to create a new database for your Odoo instance. This is a standard Odoo setup step, where you'll define the database name, master password, and other initial settings.
Update the Addons List
After creating the database and logging into Odoo, you'll need to update the list of available modules. To do this, ensure you are in developer mode (often found in the 'Settings' menu). Then, navigate to the
Appsmenu and click onUpdate Apps List. This action will scan the directories configured in yourdocker-compose.yml(including the OCA repository) for new modules.Install OCA Modules
With the addons list updated, you can now easily find and install the desired OCA modules. For instance, to install the
Business Requirementsmodules, go to theAppsmenu, search for "Business Requirements," and click the 'Install' button next to the module.
Further Customization and Advanced Configurations
Your new Odoo Docker environment offers extensive possibilities for customization. You can enhance its functionality, adjust parameters, change default passwords, and implement more complex configurations by referring to the comprehensive documentation available at the Elico-Corp Odoo Docker repository. This resource provides valuable insights into advanced setups and best practices for managing your containerized Odoo instance.
