ERP

How to Deploy Dolibarr ERP 11.0.3 in Docker Swarm Behind Traefik v2.0

Dolibarr is a versatile, open-source ERP and CRM suite. Learn how to deploy it on a Docker Swarm cluster using GlusterFS and Traefik with automatic SSL.

Rajasekhar Gundala··7 min read

Dolibarr is a feature-rich, open-source ERP and CRM software suite designed for businesses of all sizes, non-profits, and freelancers. It provides an intuitive web platform to manage operations ranging from sales and invoicing to inventory and human resources.

In this guide, we walk through deploying Dolibarr ERP 11.0.3 to a Docker Swarm Cluster using Docker Compose, backed by persistent shared storage and exposed via Traefik v2.0.

Dolibarr — One powerful suite to manage all your business operations.

Prerequisites

Ensure the following requirements are met before proceeding:

  1. A functional Docker Swarm Cluster with GlusterFS configured as persistent storage.
  2. Traefik v2.0 deployed as the ingress reverse proxy on the proxy overlay network.
  3. A running MariaDB database stack reachable across the Swarm cluster.

What is Dolibarr?

Dolibarr is an open-source Enterprise Resource Planning (ERP) and Customer Relationship Management (CRM) platform licensed under the GNU General Public License (GPL) 3.0. It is modular by design, allowing organizations to activate only the features they need while keeping the interface lightweight and user-friendly.

Because Dolibarr is entirely web-based and runs on top of standard PHP and MySQL/MariaDB architectures, it is accessible from any modern browser and straightforward to maintain on self-hosted infrastructure.

Key Capabilities

  • Modular Architecture: Enable or disable modules based on operational needs without breaking system continuity.
  • Built-in Seamless Upgrades: Upgrading between releases is supported by design without schema data loss.
  • Zero Lock-in: Host the entire suite on your private infrastructure to maintain full custody and ownership of business data.
  • Extensible Marketplace: Access hundreds of third-party add-ons or use the integrated Module Builder assistant to build custom functionality.

Core Modules

Dolibarr covers essential enterprise management workflows out of the box:

  • Human Resources (HR): Employee records, leave requests, and expense reports.
  • CRM & Sales: Leads, commercial proposals, sales orders, and customer accounts.
  • Finance & Invoicing: Billing, payments, bank account reconciliation, and reporting.
  • Product & Stock Management: Warehousing, inventory tracking, and bill of materials.
  • Productivity: Collaborative agenda/calendar, project management, and task boards.

Persisting Dolibarr Data with GlusterFS

Docker Swarm containers are ephemeral by nature. If a container crashes or is rescheduled to another worker node, local changes within the container layer are discarded.

To ensure business continuity, we utilize GlusterFS as a distributed, replicated network filesystem mounted across our Swarm nodes:

GlusterFS Replicated Volume

The volume is mounted on all nodes under /mnt. Any file written to this mount point replicates automatically across all nodes in the cluster.

If any node fails, the Dolibarr task is automatically restarted on an available node by Docker Swarm without losing state.

For Dolibarr, we must persist three directories:

  • /var/www/html: Application codebase and core components.
  • /var/www/documents: Uploaded business files, invoices, receipts, and user attachments.
  • /var/www/html/conf: Core configuration files including database connection parameters.

Create the required persistent directories on your shared storage mount:

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

For a step-by-step setup of GlusterFS on Ubuntu, refer to the tutorial video below.


Prepare the Deployment Environment

Create a dedicated directory under /opt on the Docker Swarm manager node:

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

Docker Compose Stack Definition

Open dolibarr.yml using your editor:

sudo nano dolibarr.yml

Add the following stack specification:

version: "3.7"

services:
  dolibarr:
    image: monogramm/docker-dolibarr:11.0.3
    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=[https://erp.example.com](https://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:
      replicas: 1
      placement:
        constraints:
          - node.role == worker
      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.entrypoints=websecure"
        - "traefik.http.routers.dolibarr.tls=true"
        - "traefik.http.routers.dolibarr.tls.certresolver=default"
        - "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:
    driver: "local"

networks:
  proxy:
    external: true

Configuration Breakdown:

  • DOLI_URL_ROOT: Set this to https://erp.example.com to ensure all asset paths and redirects use secure HTTPS under Traefik.
  • Volume Mounts: Mapped directly to the replicated GlusterFS mounts under /mnt to preserve uploaded documents and configuration changes.
  • Traefik Labels: Automates container discovery, routing rules for erp.example.com, and ACME TLS certificate acquisition via the default cert resolver.

Deploy Dolibarr to Docker Swarm

Deploy the stack using the Docker CLI:

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

Check the health and runtime placement of your service:

docker stack ps doli

Ensure an active DNS A or CNAME record routes erp.example.com to the public ingress IP address of your Swarm load balancer.

Completing the Web-Based Installation

Once the container is healthy, navigate to https://erp.example.com/install in your browser to run the initial Dolibarr installation wizard:

  1. Verify Prerequisites: Dolibarr checks file permissions and required PHP extensions.
  2. Database Configuration: Provide the database credentials (db:3306, user, database name dolitest, and the root/app password).
  3. Admin User Setup: Define your primary administrative username and password.
  4. Company Information: Set your company name, currency, tax rules, and upload a custom logo.

Deployment Reference Walkthrough

Below are the key installation steps and interface screens for reference:

Dolibarr Stack Running Tasks

Prerequisites Validation Check

Setup Mode Selection

Web Server Configuration

Database Connection Configuration

Database Schema Generation

Configuration Review and Validation

Database Status and Checks

Database Verification Pass

Admin Account Configuration

Installation Finished

Company Setup Screen

Company Details Configuration

Upload Custom Company Logo

Dolibarr Login Portal with Custom Logo

Custom Modules & Applications Hub

Web Application Global Parameters

Human Resources (HR) Management Module

Customer Relationship Management (CRM) Interface

Third Parties and Contacts Directory

Sales Proposals and Quotes

Billing and Payments Tracking

Product and Service Catalog

Warehouse and Inventory Levels

Financial Reporting and Analytics

System Information and Environment Diagnostics

Summary

With Dolibarr deployed behind Traefik on Docker Swarm, you have an enterprise-grade ERP and CRM running on private infrastructure with automated TLS and resilient replicated storage.

Send over your next markdown post whenever you are ready!

Share
Written by
Rajasekhar Gundala

Senior Infrastructure & Web Platform Leader.

Continue reading

Weekly Engineering Notes.

A weekly digest on infrastructure, observability, Rust, and the open web. No spam, just technical signals.

Free. Unsubscribe in one click.