Skip to content

Deploying Dolibarr

Introduction

Dolibarr is a powerful open-source ERP (Enterprise Resource Planning) and CRM (Customer Relationship Management) platform designed to help businesses manage their operations, customers, finances, inventory, projects, and resources. Built with PHP and MySQL, Dolibarr offers a modular architecture with over 100+ features including invoicing, proposals, orders, stock management, human resources, point of sale, agenda/calendar, and much more. It’s perfect for small to medium-sized businesses, freelancers, and organizations looking for a comprehensive, self-hosted business management solution.

Deploying Dolibarr on Klutch.sh gives you a scalable, production-ready infrastructure with automatic Dockerfile detection, persistent storage for documents and databases, secure environment variable management, and built-in SSL certificate provisioning. This comprehensive guide walks through installing Dolibarr locally for testing, creating an optimized Dockerfile, configuring MySQL database connections, setting up persistent volumes for data retention, and deploying to Klutch.sh with production best practices.

Whether you’re managing a small business, running a consultancy, or handling multiple projects and clients, this guide provides everything you need to deploy and maintain a reliable Dolibarr installation on Klutch.sh.


Prerequisites

Before deploying Dolibarr on Klutch.sh, ensure you have:

  • A Klutch.sh account with access to the dashboard
  • A GitHub repository (Klutch.sh uses GitHub as the git source)
  • Basic knowledge of Docker, PHP, and MySQL
  • A MySQL database instance (can be provisioned on Klutch.sh or externally)
  • Familiarity with environment variables and database configuration

What is Dolibarr?

Dolibarr is a feature-rich, modular ERP and CRM platform that offers:

  • Customer and Supplier Management: Comprehensive CRM with contacts, prospects, and relationship tracking
  • Invoicing and Billing: Create professional invoices, proposals, and quotes with customizable templates
  • Product and Service Catalog: Manage products, services, pricing, and stock levels
  • Order Management: Handle customer orders, supplier orders, and purchase requests
  • Project Management: Track projects, tasks, time spent, and project profitability
  • Inventory and Stock: Warehouse management with stock movements and multi-location support
  • Accounting: Double-entry bookkeeping, bank reconciliation, and financial reports
  • Human Resources: Employee management, expense reports, and leave tracking
  • Point of Sale (POS): Direct sales terminal for retail operations
  • Contract Management: Manage service contracts and subscriptions
  • Event Management: Organize events, conferences, and registrations
  • Document Management: Store and organize business documents
  • Multi-company Support: Manage multiple entities from a single installation
  • Extensible Architecture: Add functionality with 1000+ available modules from the marketplace

Built on a modern PHP stack with MySQL/MariaDB support, Dolibarr provides a stable, maintainable platform with active community development and regular updates.


Getting Started: Local Installation

Before deploying to Klutch.sh, let’s set up Dolibarr locally to understand its structure and configuration.

Installation Steps

    1. Clone or download Dolibarr

      Terminal window
      git clone https://github.com/Dolibarr/dolibarr.git dolibarr-app
      cd dolibarr-app
    2. Set up a local MySQL database

      Terminal window
      # Using Docker for local MySQL
      docker run -d \
      --name dolibarr-mysql \
      -e MYSQL_ROOT_PASSWORD=rootpass \
      -e MYSQL_DATABASE=dolibarr \
      -e MYSQL_USER=dolibarr \
      -e MYSQL_PASSWORD=dolibarrpass \
      -p 3306:3306 \
      mysql:8.0
    3. Configure web server (Apache or Nginx)

      For development, you can use PHP’s built-in server:

      Terminal window
      cd htdocs
      php -S localhost:8080
    4. Access the installation wizard

      Open http://localhost:8080/install/ in your browser

    5. Follow the installation wizard steps

      • Accept the license agreement
      • Check server prerequisites
      • Configure database connection:
        • Database server: localhost
        • Database name: dolibarr
        • Database user: dolibarr
        • Database password: dolibarrpass
      • Create admin account
      • Complete installation
    6. Log in to Dolibarr

      Access the application at http://localhost:8080 and log in with your admin credentials

    7. Explore the interface

      Navigate through the modules, configure your company information, and explore the features to understand how Dolibarr works before deploying to production.

Sample API Usage Code

Dolibarr provides a REST API for integration with other systems. Here’s a sample PHP snippet showing how to interact with Dolibarr’s API:

<?php
// Dolibarr API authentication and usage example
$dolibarrUrl = 'https://example-app.klutch.sh';
$apiKey = 'your_api_key_here';
// Initialize cURL session
$ch = curl_init();
// Create a new third party (customer/supplier)
$thirdPartyData = [
'name' => 'Acme Corporation',
'client' => 1,
'email' => 'contact@acme.com',
'address' => '123 Business St',
'zip' => '12345',
'town' => 'Business City',
'country_code' => 'US'
];
curl_setopt_array($ch, [
CURLOPT_URL => $dolibarrUrl . '/api/index.php/thirdparties',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($thirdPartyData),
CURLOPT_HTTPHEADER => [
'DOLAPIKEY: ' . $apiKey,
'Content-Type: application/json'
]
]);
$response = curl_exec($ch);
$thirdPartyId = json_decode($response);
echo "Created third party with ID: " . $thirdPartyId . "\n";
// Create an invoice
$invoiceData = [
'socid' => $thirdPartyId,
'date' => time(),
'type' => 0,
'lines' => [
[
'desc' => 'Consulting Services',
'subprice' => 100.00,
'qty' => 10,
'tva_tx' => 20.0
]
]
];
curl_setopt_array($ch, [
CURLOPT_URL => $dolibarrUrl . '/api/index.php/invoices',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($invoiceData)
]);
$invoiceResponse = curl_exec($ch);
$invoiceId = json_decode($invoiceResponse);
echo "Created invoice with ID: " . $invoiceId . "\n";
curl_close($ch);

This demonstrates Dolibarr’s REST API capabilities, making it easy to integrate with other business systems, mobile apps, or automation workflows.


Project Structure

Understanding Dolibarr’s file structure helps with Docker configuration and persistent storage planning:

dolibarr-app/
├── htdocs/ # Main application directory
│ ├── index.php # Application entry point
│ ├── admin/ # Administration interface
│ ├── core/ # Core classes and libraries
│ ├── custom/ # Custom modules and extensions
│ ├── includes/ # Third-party libraries
│ ├── install/ # Installation wizard
│ ├── langs/ # Language files
│ ├── product/ # Product management
│ ├── compta/ # Accounting module
│ ├── comm/ # Commercial module
│ ├── projet/ # Project management
│ └── theme/ # UI themes
├── documents/ # User uploaded files and generated docs
│ ├── company/ # Company documents
│ ├── invoice/ # Invoice PDFs
│ ├── proposal/ # Proposal documents
│ └── product/ # Product images
├── conf/ # Configuration directory
│ └── conf.php # Main configuration file
├── scripts/ # Utility scripts
└── README.md

Key directories for persistence:

  • /var/www/documents — Uploaded files, generated PDFs, and user content
  • /var/www/html/conf — Configuration files (use env vars instead in production)
  • /var/www/html/custom — Custom modules and themes

Creating a Production Dockerfile

Klutch.sh automatically detects and uses a Dockerfile when present in your repository’s root directory. Here’s a production-ready Dockerfile for Dolibarr:

Basic Production Dockerfile

FROM tuxgasy/dolibarr:latest
# Set environment for production
ENV DOLI_PROD=1
# Optional: Install additional PHP extensions if needed
# RUN apt-get update && apt-get install -y \
# php-imagick \
# php-ldap \
# && rm -rf /var/lib/apt/lists/*
# Optional: Copy custom modules or themes
# COPY ./custom /var/www/html/custom
# Ensure proper permissions
RUN chown -R www-data:www-data /var/www/html /var/www/documents
# Expose HTTP port
EXPOSE 80
# Start Apache
CMD ["apache2-foreground"]

Advanced Multi-Stage Dockerfile

For more control and customization, here’s an advanced Dockerfile that builds from the official PHP image:

# Build stage
FROM php:8.1-apache as builder
# Install system dependencies and PHP extensions
RUN apt-get update && apt-get install -y \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libxml2-dev \
libzip-dev \
libicu-dev \
libldap2-dev \
libcurl4-openssl-dev \
mariadb-client \
unzip \
git \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
gd \
mysqli \
pdo \
pdo_mysql \
zip \
intl \
calendar \
soap \
opcache \
&& rm -rf /var/lib/apt/lists/*
# Enable Apache modules
RUN a2enmod rewrite headers expires
# Set working directory
WORKDIR /var/www/html
# Download and extract Dolibarr
ARG DOLIBARR_VERSION=18.0.3
RUN curl -fSL "https://github.com/Dolibarr/dolibarr/archive/${DOLIBARR_VERSION}.tar.gz" -o dolibarr.tar.gz \
&& tar -xzf dolibarr.tar.gz --strip-components=1 \
&& rm dolibarr.tar.gz
# Production stage
FROM php:8.1-apache
# Copy necessary runtime dependencies
COPY --from=builder /usr/local/lib/php/extensions/ /usr/local/lib/php/extensions/
COPY --from=builder /usr/local/etc/php/conf.d/ /usr/local/etc/php/conf.d/
# Install runtime dependencies only
RUN apt-get update && apt-get install -y \
libpng16-16 \
libjpeg62-turbo \
libfreetype6 \
libxml2 \
libzip4 \
libicu67 \
libcurl4 \
mariadb-client \
&& rm -rf /var/lib/apt/lists/*
# Enable Apache modules
RUN a2enmod rewrite headers expires
# Set working directory
WORKDIR /var/www/html
# Copy Dolibarr application from builder
COPY --from=builder /var/www/html /var/www/html
# Create documents directory for persistent storage
RUN mkdir -p /var/www/documents \
&& chown -R www-data:www-data /var/www/html /var/www/documents \
&& chmod -R 755 /var/www/html \
&& chmod -R 775 /var/www/documents
# Configure PHP for production
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
RUN { \
echo 'upload_max_filesize=50M'; \
echo 'post_max_size=50M'; \
echo 'memory_limit=256M'; \
echo 'max_execution_time=300'; \
} > /usr/local/etc/php/conf.d/dolibarr.ini
# Configure Apache
RUN sed -i 's!/var/www/html!/var/www/html/htdocs!g' /etc/apache2/sites-available/000-default.conf
# Create entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
EXPOSE 80
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["apache2-foreground"]

Docker Entrypoint Script

Create docker-entrypoint.sh for initialization tasks:

#!/bin/bash
set -e
# Wait for database to be ready if DB host is provided
if [ -n "$DOLI_DB_HOST" ]; then
echo "Waiting for database connection..."
until mysqladmin ping -h"$DOLI_DB_HOST" -P"${DOLI_DB_PORT:-3306}" --silent; do
echo "Database not ready, waiting..."
sleep 3
done
echo "Database is ready!"
fi
# Create conf.php if it doesn't exist and DB is configured
if [ ! -f /var/www/html/htdocs/conf/conf.php ] && [ -n "$DOLI_DB_HOST" ]; then
echo "Creating initial configuration file..."
mkdir -p /var/www/html/htdocs/conf
cat > /var/www/html/htdocs/conf/conf.php <<EOF
<?php
\$dolibarr_main_url_root='${DOLI_URL_ROOT:-http://localhost}';
\$dolibarr_main_document_root='/var/www/html/htdocs';
\$dolibarr_main_data_root='/var/www/documents';
\$dolibarr_main_db_host='${DOLI_DB_HOST}';
\$dolibarr_main_db_port='${DOLI_DB_PORT:-3306}';
\$dolibarr_main_db_name='${DOLI_DB_NAME:-dolibarr}';
\$dolibarr_main_db_user='${DOLI_DB_USER}';
\$dolibarr_main_db_pass='${DOLI_DB_PASSWORD}';
\$dolibarr_main_db_type='mysqli';
\$dolibarr_main_instance_unique_id='${DOLI_INSTANCE_ID:-$(openssl rand -hex 16)}';
\$dolibarr_main_prod='${DOLI_PROD:-1}';
EOF
chown www-data:www-data /var/www/html/htdocs/conf/conf.php
chmod 400 /var/www/html/htdocs/conf/conf.php
fi
# Ensure proper permissions
chown -R www-data:www-data /var/www/documents
echo "Dolibarr is ready!"
# Execute the main command
exec "$@"

Persistent Storage Configuration

Dolibarr requires persistent storage for uploaded documents, generated PDFs, and user content. Klutch.sh provides persistent volumes that survive deployments and restarts.

Setting Up Persistent Volumes

    1. Identify required persistent directories

      • /var/www/documents — User uploads, generated invoices, proposals, and company documents
      • /var/www/html/htdocs/conf — Configuration files (optional, better to use env vars)
    2. Create a persistent volume in Klutch.sh

      In the Klutch.sh dashboard, navigate to your app settings:

      • Click “Add Volume”
      • Set Mount Path: /var/www/documents
      • Set Size: 10GB (adjust based on expected document storage)
      • Save the configuration
    3. Update Dockerfile permissions

      Ensure the Docker user has write access:

      RUN chown -R www-data:www-data /var/www/documents \
      && chmod -R 775 /var/www/documents
    4. Verify persistence after deployment

      After deploying, create test documents through Dolibarr (invoices, proposals) and redeploy to confirm files persist across deployments.


Database Setup and Configuration

Dolibarr requires a MySQL or MariaDB database. You can use Klutch.sh’s database offerings or an external managed database.

Option 1: Using Klutch.sh MySQL

    1. Provision a MySQL database

      See the MySQL deployment guide for detailed instructions on provisioning a database on Klutch.sh.

    2. Note the connection details

      After provisioning, you’ll receive:

      • Host address (internal hostname)
      • Port (typically 8000 for TCP traffic to the database)
      • Database name
      • Username and password
    3. Configure environment variables

      Set these in your Klutch.sh app configuration (see next section).

Option 2: External MySQL Database

You can use any MySQL-compatible database:

  • Managed MySQL services (AWS RDS, Google Cloud SQL, DigitalOcean Managed Databases)
  • MariaDB instances
  • PlanetScale, Supabase, or other MySQL providers

Ensure network connectivity between Klutch.sh and your database server, and note the connection credentials for environment variable configuration.


Environment Variables

Configure Dolibarr by setting environment variables in the Klutch.sh dashboard. These replace hardcoded configuration in production.

Required Environment Variables

Terminal window
# Database Configuration
DOLI_DB_HOST=your-database-host
DOLI_DB_PORT=3306
DOLI_DB_NAME=dolibarr
DOLI_DB_USER=dolibarr_user
DOLI_DB_PASSWORD=your_secure_database_password
# Application Configuration
DOLI_URL_ROOT=https://example-app.klutch.sh
DOLI_PROD=1
DOLI_INSTANCE_ID=unique-instance-identifier
# Admin Configuration (for initial setup)
DOLI_ADMIN_LOGIN=admin
DOLI_ADMIN_PASSWORD=your_secure_admin_password

Optional Environment Variables

Terminal window
# Email Configuration (SMTP)
DOLI_MAIL_SMTP_HOST=smtp.gmail.com
DOLI_MAIL_SMTP_PORT=587
DOLI_MAIL_SMTP_USER=your_email@gmail.com
DOLI_MAIL_SMTP_PASSWORD=your_app_password
DOLI_MAIL_FROM=noreply@yourdomain.com
# Performance
PHP_MEMORY_LIMIT=256M
PHP_MAX_EXECUTION_TIME=300
PHP_UPLOAD_MAX_FILESIZE=50M
PHP_POST_MAX_SIZE=50M
# Security
DOLI_AUTH_MODE=dolibarr
DOLI_HTTPS_ENABLED=1

Customizing Commands with Nixpacks

While the Dockerfile handles most configuration, if you need to customize startup behavior without a Dockerfile, you can use Nixpacks environment variables:

  • NIXPACKS_BUILD_CMD — Custom build command (rarely needed with Dockerfile)
  • NIXPACKS_START_CMD — Custom start command (e.g., apache2-foreground)

However, when using a Dockerfile, Klutch.sh automatically uses the Dockerfile’s CMD and ENTRYPOINT directives, so these are typically not needed.


Deploying to Klutch.sh

Now that your Dockerfile and configuration are ready, follow these steps to deploy Dolibarr to Klutch.sh.

Deployment Steps

    1. Push your repository to GitHub

      Ensure your repository contains:

      • Dockerfile (in the root directory — Klutch.sh auto-detects this)
      • docker-entrypoint.sh (if using the entrypoint script)
      • .dockerignore file (to exclude unnecessary files)
      Terminal window
      git add .
      git commit -m "Add Dockerfile for Klutch.sh deployment"
      git push origin main
    2. Log in to Klutch.sh

      Navigate to klutch.sh/app

    3. Create a new project

      • Click “New Project”
      • Enter a project name (e.g., “Business Management”)
      • Save the project
    4. Create a new app

      • Click “New App” within your project
      • Connect your GitHub repository
      • Select the repository containing your Dolibarr code
      • Select the branch (e.g., main or production)
    5. Configure app settings

      • Traffic Type: Select HTTP (Dolibarr is a web application)
      • Internal Port: Set to 80 (the port Apache listens on in the container)
      • Region: Choose the region closest to your users
      • Compute Resources: Select appropriate CPU and memory (start with 1 CPU, 2GB RAM)
      • Instances: Set to 1 (scale up later based on traffic)
    6. Add environment variables

      Click “Add Environment Variable” and enter all required variables from the previous section:

      • Database credentials (DOLI_DB_HOST, DOLI_DB_NAME, DOLI_DB_USER, DOLI_DB_PASSWORD)
      • Application URL (DOLI_URL_ROOT — use your Klutch.sh URL or custom domain)
      • Admin credentials for initial setup
      • Any optional SMTP or customization variables
    7. Attach persistent volumes

      • Click “Add Volume”
      • Mount Path: /var/www/documents
      • Size: 10GB (or more based on needs)
      • Save the volume configuration
    8. Deploy the application

      Click “Create App” or “Deploy”

      Klutch.sh will:

      • Clone your repository
      • Detect the Dockerfile automatically (no manual selection needed)
      • Build the Docker image
      • Deploy the container with your configuration
      • Expose the app on HTTP with automatic routing
    9. Monitor the deployment

      Watch the build logs to ensure successful deployment. The process typically takes 3-7 minutes depending on image size.

    10. Access your Dolibarr installation

      Once deployed, access your app at the provided URL:

      • https://example-app.klutch.sh

      Complete the initial Dolibarr setup wizard in your browser if this is a fresh installation.


Custom Domain Configuration

To use your own domain with Dolibarr on Klutch.sh:

    1. Add a custom domain in Klutch.sh

      • Go to your app settings in the Klutch.sh dashboard
      • Navigate to “Domains” section
      • Click “Add Custom Domain”
      • Enter your domain (e.g., erp.yourdomain.com)
    2. Configure DNS records

      Update your DNS provider with the records provided by Klutch.sh:

      • Add a CNAME record pointing to your Klutch.sh app
      • Or add A/AAAA records as instructed
    3. Update DOLI_URL_ROOT environment variable

      In your app settings, update:

      Terminal window
      DOLI_URL_ROOT=https://erp.yourdomain.com
    4. Wait for DNS propagation

      DNS changes can take up to 48 hours, but typically propagate within minutes.

    5. Verify SSL certificate

      Klutch.sh automatically provisions SSL certificates for custom domains. Once DNS propagates, your site will be accessible via HTTPS.

For more details, see the custom domains documentation.


Post-Deployment Configuration

After deploying Dolibarr, complete these configuration steps:

Initial Setup Wizard

    1. Access your Dolibarr URL

      Visit your deployed app URL (e.g., https://example-app.klutch.sh)

    2. Complete installation wizard (for fresh installations)

      If this is a new installation, Dolibarr will guide you through:

      • License acceptance
      • Prerequisites check
      • Database connection verification (already configured via env vars)
      • Admin account creation
      • Optional modules selection
    3. Configure company information

      • Navigate to Setup → Company/Organization
      • Enter your company details, logo, and legal information
      • Configure fiscal year and accounting settings
    4. Enable required modules

      • Go to Setup → Modules
      • Enable modules based on your needs:
        • Third Parties (Customers/Suppliers)
        • Products/Services
        • Invoices
        • Proposals
        • Orders
        • Projects
        • HR
        • Stock/Warehouse
        • Accounting
        • Point of Sale
    5. Configure users and permissions

      • Navigate to Setup → Users & Groups
      • Create user accounts for team members
      • Set appropriate permissions and access levels

Configuring Email Notifications

Dolibarr can send email notifications for invoices, proposals, and alerts:

  • Navigate to Setup → Email
  • Configure SMTP settings using the environment variables you set
  • Test email delivery by sending a test email
  • Configure email templates for invoices and proposals

Scaling and Performance

As your business grows and Dolibarr usage increases, optimize performance:

Vertical Scaling

Increase compute resources in Klutch.sh:

  • Navigate to app settings
  • Adjust CPU and memory allocation
  • Recommended for businesses with 50+ users: 2 CPU, 4GB RAM

Horizontal Scaling

Run multiple instances:

  • Increase instance count in app settings
  • Klutch.sh automatically load-balances traffic
  • Ensure session storage uses database (not file-based)
  • Use shared storage for documents volume

Database Optimization

  • Add indexes to frequently queried tables
  • Regular database maintenance and optimization
  • Consider read replicas for reporting queries
  • Enable MySQL query cache
  • Monitor slow query logs

Application Optimization

Enable PHP OPcache:

Terminal window
PHP_OPCACHE_ENABLE=1
PHP_OPCACHE_MEMORY=128

Configure Dolibarr caching:

  • Enable file caching in Setup → Other
  • Use external caching with Redis or Memcached for large deployments

Monitoring and Maintenance

Application Monitoring

Monitor your Dolibarr deployment:

  • Check application logs in Klutch.sh dashboard
  • Set up uptime monitoring (Pingdom, UptimeRobot)
  • Monitor database performance and query times
  • Track user activity and login patterns
  • Monitor disk usage for document storage

Regular Maintenance

    1. Update Dolibarr regularly

      Terminal window
      # Pull latest version
      git pull origin main
      # Update Dockerfile with new version
      # Commit and push
      git push origin main

      Klutch.sh will automatically rebuild and redeploy.

    2. Database backups

      • Schedule regular database backups (daily recommended)
      • Test restoration procedures
      • Store backups in multiple locations
      • Document backup and restore processes
    3. Security updates

      • Keep PHP and system packages updated
      • Rebuild Docker images regularly with latest base images
      • Monitor Dolibarr security advisories
      • Update dependencies and libraries
    4. Document storage maintenance

      • Periodically review and archive old documents
      • Monitor volume usage and increase size if needed
      • Implement document retention policies
      • Clean up temporary files and caches

Troubleshooting

Common issues and solutions:

Issue: Application shows blank page or 500 error

  • Check Apache error logs in container
  • Verify database connection and credentials
  • Ensure conf.php has correct permissions (400)
  • Check PHP memory limits

Issue: Database connection failed

  • Verify DOLI_DB_HOST, DOLI_DB_PORT, credentials
  • Test connection: mysql -h $DOLI_DB_HOST -P $DOLI_DB_PORT -u $DOLI_DB_USER -p
  • Check network connectivity
  • Verify database server is running

Issue: File uploads failing

  • Verify persistent volume is mounted at /var/www/documents
  • Check disk space on volume
  • Verify write permissions: chown -R www-data:www-data /var/www/documents
  • Check PHP upload limits (upload_max_filesize, post_max_size)

Issue: Slow performance

  • Enable PHP OPcache
  • Check database slow query logs
  • Increase PHP memory limit
  • Review enabled modules (disable unused ones)
  • Check server resources (CPU, memory usage)

Security Best Practices

Protect your Dolibarr installation:

    1. Use HTTPS exclusively

      • Always set DOLI_URL_ROOT to https://
      • Klutch.sh provides automatic SSL certificates
      • Enable HTTPS enforcement in Dolibarr settings
    2. Secure environment variables

      • Never commit secrets to Git
      • Use Klutch.sh’s secure environment variable storage
      • Rotate database passwords regularly
      • Use strong, unique passwords
    3. Database security

      • Use strong, unique database passwords
      • Limit database user privileges to only what’s needed
      • Enable database firewall rules
      • Use private networking when possible
    4. Application hardening

      • Set DOLI_PROD=1 in production
      • Disable debug mode and error display
      • Keep Dolibarr and PHP versions up to date
      • Disable unused modules
      • Implement IP whitelisting for admin panel if needed
    5. User security

      • Enforce strong password policies
      • Enable two-factor authentication module
      • Regularly audit user accounts and permissions
      • Monitor failed login attempts
      • Use least-privilege principle for user permissions
    6. Document security

      • Protect sensitive documents with permissions
      • Enable document encryption for sensitive data
      • Implement access controls on documents
      • Regular security audits of file permissions
    7. Backup and disaster recovery

      • Schedule automated database backups
      • Backup document volumes regularly
      • Test restoration procedures quarterly
      • Store backups in different geographic regions
      • Document recovery procedures and RTO/RPO targets

Cost Optimization

Optimize your Klutch.sh hosting costs:

  • Right-size compute resources: Start small (1 CPU, 2GB RAM) and scale based on actual usage
  • Use efficient Docker images: Multi-stage builds reduce image size and deployment time
  • Optimize document storage: Regularly archive or delete old documents
  • Monitor usage patterns: Scale down during off-hours if usage is predictable
  • Use external storage: Consider S3 for long-term document archival
  • Disable unused modules: Reduces memory usage and improves performance
  • Implement caching: Reduces database load and improves response times

Advanced Configuration

Using External Storage (S3)

For large-scale deployments with extensive document storage, use S3-compatible storage:

  1. Configure S3 credentials

    Terminal window
    DOLI_S3_ENABLED=1
    DOLI_S3_ENDPOINT=s3.amazonaws.com
    DOLI_S3_BUCKET=dolibarr-documents
    DOLI_S3_ACCESS_KEY=your_access_key
    DOLI_S3_SECRET_KEY=your_secret_key
    DOLI_S3_REGION=us-east-1
  2. Install S3 module

    Enable the S3 storage module in Dolibarr’s module management.

  3. Configure document storage

    Set Dolibarr to use S3 for document storage in Setup → Other → Document Storage

Multi-Company Setup

Run multiple companies in one Dolibarr instance:

  1. Enable multi-company module
  2. Create separate entities for each company
  3. Configure shared or separate databases
  4. Set up user access per entity
  5. Configure separate branding per company

Custom Module Development

Develop custom modules for specific business needs:

  • Follow Dolibarr module development guidelines
  • Store custom modules in /var/www/html/htdocs/custom
  • Include custom modules in your Docker image
  • Version control custom modules separately

Resources


Conclusion

Deploying Dolibarr on Klutch.sh provides a robust, scalable solution for business management and ERP/CRM operations. With automatic Dockerfile detection, persistent storage for documents, secure environment variables, and built-in SSL, Klutch.sh simplifies the deployment process while maintaining enterprise-grade reliability.

This guide covered local installation for testing, creating optimized Dockerfiles, configuring MySQL databases and persistent storage, setting environment variables, deploying to Klutch.sh with detailed step-by-step instructions, adding custom domains, scaling for growing businesses, implementing security best practices, and maintaining your deployment long-term.

Whether you’re managing a small business, running a consultancy, or handling complex multi-project operations, Dolibarr on Klutch.sh gives you professional business management capabilities with minimal operational overhead. Start your deployment today and experience the power of self-hosted ERP and CRM systems.