dolibarr

Deploy Dolibarr ERP 11.03 in Docker Swarm, Behind Traefik v2.0

Dolibarr is an open-source ERP CRM software suite. It includes all the important features of an ERP CRM suite. It is used by millions of users worldwide.

Today I am going to show you how to deploy Dolibarr ERP 11.03 to our Docker Swarm Cluster using the Docker Compose tool.

Dolibarr is an open-source ERP CRM software suite. It includes all the important features of an ERP CRM suite.

Nowadays I am a bit busy and didn’t get time to publish or write posts. Hope all is well.

Stay at Home and be Safe.

Dolibarr is an open source ERP CRM software package for companies of any size, foundations or freelancers. It includes different features for enterprise resource planning (ERP) and customer relationship management (CRM) but also other features for different activities

Dolibarr – One powerful suite to manage all your business

learn more about using the official Dolibarr website and Wikipedia.

Let’s start with actual deployment…

Prerequisites

Please make sure you should fulfill the below requirements before proceeding to the actual deployment.

  1. Docker Swarm Cluster with GlusterFS as persistent tool.
  2. Traefik as reverse proxy to expose micro-services to external.
  3. Database stack to host application databases.

Introduction

Dolibarr is an open-source ERP CRM software suite. It includes all the important features of an ERP CRM suite. It is modular and is thus characterized by its ease of installation and use, despite a large number of features.

There are several feature modules that can be enabled or disabled, as needed and the software is free under GNU General Public License 3.0. It is a web-based application, and can therefore be used wherever internet service is available.

Dolibarr aims to offer free open source ERP and CRM features for people with no technical knowledge, by providing a simple solution.

It is used by millions of users> worldwide and became a major integrated solution in the Open Source world. Its user and developer community is growing day and day.

Why is Dolibarr

Dolibarr is free and open-source, which means that anyone is allowed to install and operate it on their own private server devices.

In contrast to proprietary services, the open architecture enables users to have full control of their data.

Dolibarr Features

There are several feature modules that can be enabled or disabled, as needed. You can setup the application to match your, and only your need

Integration between the features/modules is ready in the box. Users are immediately ready to work, even without customization.

The upgrades of new versions are integrated by design into the development process. So you can upgrade at any time to the latest version, whatever is your current version, without losing any data. Users always benefit from the latest features and innovations.

The marketplace is open to everybody to centralize several hundreds of external add-ons done to enhance the application for specific needs. You can also extend the possibilities of your application, without any coding development with the module builder assistant, or make custom development if this is not enough.

More features include

  • A more competitive solution
  • The easiest ERP and CRMof the market
  • Available on all platformson premise or as a SaaS application
  • A rich eco-system of partners

Dolibarr Key Modules

Dolibarr includes all the important modules/features of an ERP CRM suite. It is modular and is thus characterized by its ease of installation and use, despite a large number of features.

Main Dolibarr modules/features include:

  1. HR
  2. CRM & Sales
  3. Finance & Billing
  4. Product & Stack
  5. Marketing
  6. Productivity

Learn more about Dolibarr modules/features here

Persist Dolibarr Data

Containers are fast to deploy and make efficient use of system resources. Developers get application portability and programmable image management and the operations team get standard run time units of deployment and management.

With all the known benefits of containers, there is one common misperception that the containers are ephemeral, which means if we restart the container or in case of any issues with it, we lose all the data for that particular container. They are only good for stateless micro-service applications and that it’s not possible to containerize stateful applications.

I am going to use GlusterFS to overcome the ephemeral behavior of Containers.

I already set up a replicated GlusterFS volume to have data replicated throughout the cluster if I would like to have some persistent data.

The below diagram explains how the replicated volume works.

Volume will be mounted on all the nodes, and when a file is written to the /mnt partition, data will be replicated to all the nodes in the Cluster

In case of any one of the nodes fails, the application automatically starts on other node without loosing any data and that’s the beauty of the replicated volume.

Persistent application state or data needs to survive application restarts and outages. We are storing the data or state in GlusterFS and had periodic backups performed on it.

We will use a backup of the volume to spin a new application container anywhere else in case of unexpected issues occur in the current environment.

I am going to persistent /var/www/html/var/www/documents and /var/www/html/config folders of Dolibarr for disorder recovery.

Create folders in /mnt directory to persistent Dolibarr folders mentioned above.

Use the below commands to create the folders.

cd /mnt
sudo mkdir -p dolibarr-html
sudo mkdir -p dolibarr-doc
sudo mkdir -p dolibarr-config

Please watch the below video for Glusterfs Installation

https://youtube.com/watch?v=VU-cxFObPjI%3Ffeature%3Doembed

Prepare Dolibarr Environment

Create a folder in /opt directory to place configuration file, i.e, .yml file for Dolibarr ERP CRM.

Use the below commands to create the folder.

cd /opt
sudo mkdir -p dolibarr
cd dolibarr
sudo touch dolibarr.yml

Dolibarr Docker Compose

Open dolibarr.yml created earlier with nano editor using sudo nano dolibarr.yml

Copy and paste the below code in dolibarr.yml

Here is the docker compose file for dolibarr.

version: "3.7"
 
services:
  dolibarr:
    image: monogramm/docker-dolibarr
    secrets:
      - mysql_root_password
    environment:
      - DOLI_DB_HOST=db
      - DOLI_DB_PORT=3306
      - DOLI_DB_NAME=dolitest
      - DOLI_DB_USER=root
      - DOLI_DB_PASSWORD_FILE=/run/secrets/mysql_root_password
      - DOLI_URL_ROOT=http://erp.example.com
    volumes:
      - /mnt/dolibarr-html:/var/www/html
      - /mnt/dolibarr-doc:/var/www/documents
      - /mnt/dolibarr-config:/var/www/html/conf
    networks:
      - proxy
    deploy:
      placement:
        constraints: [node.role == worker]
      replicas: 1
      update_config:
        parallelism: 2
        delay: 10s
      restart_policy:
        condition: on-failure
      labels:
        - "traefik.enable=true"
        - "traefik.docker.network=proxy"
        - "traefik.http.routers.dolibarr.rule=Host(`erp.example.com`)"
        - "traefik.http.routers.dolibarr.tls=true"
        - "traefik.http.routers.dolibarr.tls.certresolver=default"
        - "traefik.http.routers.dolibarr.entrypoints=websecure"
        - "traefik.http.services.dolibarr.loadbalancer.server.port=80"
secrets:
  mysql_root_password:
    external: true 
volumes:
  dolibarr-html:
    driver: "local"
  dolibarr-doc:
    driver: "local"
  dolibarr-config
networks:
  proxy:
    external: true

As I mentioned in the prerequisites, I used MariaDB as a back-end storage system for Dolibarr which was deployed earlier to our Docker Swarm environment.

As of this writing, there is no official Docker Container for Dolibarr. There are plenty available in GitHub. I used monogramm/docker-dolibarr

Deploy Dolibarr using Docker Compose

Now it’s time to deploy our docker-compose file above dolibarr.yml using the below command

docker stack deploy --compose-file dolibarr.yml doli

You can give it any name for the stack. I just named it as doli

Check the status of the stack by using docker stack ps doli

Now open any browser and type erp.example.com/install (whatever host URL used in the Dolibarr configuration in the docker-compose file) to complete Dolibarr installation.

Make sure that you have DNS entry for your application (dolibarr.example.com) in your DNS Management Application.

Please find below images for your reference. Click on them to open in lightbox for full resolution.

Stay tuned for other deployments in coming posts… 🙄

Leave a Reply

Your email address will not be published. Required fields are marked *