# ERPNext Complete ERP

> Full-featured open-source ERP with CRM, inventory, accounting, and HR.

- Category: Full Web Stacks
- Difficulty: advanced
- Components: erpnext, frappe, mariadb, redis-cache, redis-queue, redis-socketio
- Tags: erp, crm, accounting, inventory, erpnext
- Source: https://docker.recipes/full-stacks/erpnext-complete

## Overview

ERPNext is a comprehensive open-source Enterprise Resource Planning (ERP) system built on the Frappe framework, a Python-based web application framework that provides a complete business management solution. Originally developed by Frappe Technologies, ERPNext integrates modules for Customer Relationship Management (CRM), Human Resources, Inventory Management, Accounting, Manufacturing, and Project Management into a unified platform that rivals commercial ERP solutions like SAP and Oracle at a fraction of the cost. This Docker stack orchestrates ERPNext with MariaDB as the primary database, while three separate Redis instances handle distinct workloads: redis-cache for application-level caching, redis-queue for background job processing, and redis-socketio for real-time WebSocket communications. The architecture includes dedicated worker containers for different queue types (default, short, and long-running tasks) plus a scheduler container for automated processes, creating a production-ready ERP deployment that can handle concurrent users and complex business workflows. Small to medium enterprises, growing businesses, and organizations seeking to replace expensive proprietary ERP systems will find this stack particularly valuable, as it provides enterprise-grade functionality including multi-company support, role-based permissions, custom field creation, and extensive reporting capabilities while maintaining the flexibility to customize business processes through Frappe's low-code development environment.

## Features

- Multi-queue Redis architecture separating cache operations, background jobs, and real-time communications for optimal performance
- Dedicated worker containers handling default, short, and long-running tasks with automatic job distribution
- MariaDB with UTF8MB4 character set for full Unicode support including emojis and international characters
- Integrated Frappe framework providing low-code customization, custom DocTypes, and workflow automation
- Built-in scheduler container for automated processes like email sending, report generation, and data synchronization
- Complete ERP modules including GL accounting with multi-currency support, inventory with serial/batch tracking, and manufacturing with Bill of Materials
- Role-based permission system with user, role, and permission level controls across all business documents
- Multi-site architecture allowing multiple companies or subsidiaries within a single ERPNext instance

## Use cases

- Manufacturing companies needing integrated production planning, inventory control, and financial accounting
- Service businesses requiring project management, timesheet tracking, and client billing automation
- Retail organizations managing multi-location inventory, point-of-sale systems, and customer loyalty programs
- Growing startups transitioning from spreadsheets and disparate tools to unified business management
- Non-profit organizations needing donor management, grant tracking, and financial transparency reporting
- Educational institutions managing student information, fee collection, and academic records
- Healthcare practices requiring patient management, appointment scheduling, and billing integration

## Prerequisites

- Minimum 4GB RAM (8GB recommended for production) to support ERPNext application and multiple worker processes
- Docker Engine 20.10+ and Docker Compose V2 for proper container orchestration and networking
- Available ports 8080 for ERPNext web interface and internal Redis ports for service communication
- Basic understanding of ERP concepts and business processes for effective system configuration
- Familiarity with Frappe framework concepts like DocTypes, workflows, and custom scripts for customization
- SSL certificate and domain name for production deployments requiring secure HTTPS access

## docker-compose.yml

```yaml
services:
  erpnext:
    image: frappe/erpnext:v15
    container_name: erpnext
    environment:
      - FRAPPE_SITE_NAME_HEADER=${SITE_NAME}
    volumes:
      - sites-data:/home/frappe/frappe-bench/sites
      - logs-data:/home/frappe/frappe-bench/logs
    ports:
      - "8080:8080"
    depends_on:
      - db
      - redis-cache
      - redis-queue
      - redis-socketio
    networks:
      - erpnext-network
    restart: unless-stopped

  scheduler:
    image: frappe/erpnext:v15
    container_name: erpnext-scheduler
    command: bench schedule
    volumes:
      - sites-data:/home/frappe/frappe-bench/sites
      - logs-data:/home/frappe/frappe-bench/logs
    depends_on:
      - erpnext
    networks:
      - erpnext-network
    restart: unless-stopped

  worker-default:
    image: frappe/erpnext:v15
    container_name: erpnext-worker-default
    command: bench worker --queue default
    volumes:
      - sites-data:/home/frappe/frappe-bench/sites
      - logs-data:/home/frappe/frappe-bench/logs
    depends_on:
      - erpnext
    networks:
      - erpnext-network
    restart: unless-stopped

  worker-short:
    image: frappe/erpnext:v15
    container_name: erpnext-worker-short
    command: bench worker --queue short
    volumes:
      - sites-data:/home/frappe/frappe-bench/sites
      - logs-data:/home/frappe/frappe-bench/logs
    depends_on:
      - erpnext
    networks:
      - erpnext-network
    restart: unless-stopped

  worker-long:
    image: frappe/erpnext:v15
    container_name: erpnext-worker-long
    command: bench worker --queue long
    volumes:
      - sites-data:/home/frappe/frappe-bench/sites
      - logs-data:/home/frappe/frappe-bench/logs
    depends_on:
      - erpnext
    networks:
      - erpnext-network
    restart: unless-stopped

  db:
    image: mariadb:10.11
    container_name: erpnext-db
    environment:
      - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
      - MYSQL_DATABASE=erpnext
    command:
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
      - --skip-character-set-client-handshake
    volumes:
      - mariadb-data:/var/lib/mysql
    networks:
      - erpnext-network
    restart: unless-stopped

  redis-cache:
    image: redis:7-alpine
    container_name: erpnext-redis-cache
    networks:
      - erpnext-network
    restart: unless-stopped

  redis-queue:
    image: redis:7-alpine
    container_name: erpnext-redis-queue
    networks:
      - erpnext-network
    restart: unless-stopped

  redis-socketio:
    image: redis:7-alpine
    container_name: erpnext-redis-socketio
    networks:
      - erpnext-network
    restart: unless-stopped

volumes:
  sites-data:
  logs-data:
  mariadb-data:

networks:
  erpnext-network:
    driver: bridge
```

## .env

```bash
# ERPNext
SITE_NAME=erp.localhost
DB_ROOT_PASSWORD=secure_root_password
```

## Usage notes

- Web UI at http://localhost:8080
- Create new site: bench new-site sitename
- Modules: CRM, HR, Inventory, Accounting
- Requires initial setup wizard
- Minimum 4GB RAM recommended

## Troubleshooting

- ERPNext shows 'Redis connection failed': Check if all three Redis containers (cache, queue, socketio) are running and accessible on the erpnext-network
- Site creation fails with 'Database connection error': Verify MariaDB container started successfully and MYSQL_ROOT_PASSWORD environment variable matches between services
- Background jobs not processing: Restart worker containers (worker-default, worker-short, worker-long) and check Redis queue container logs for connection issues
- High memory usage during large imports: Increase Docker host memory allocation and consider processing data in smaller batches through ERPNext's data import tool
- ERPNext web interface returns 502 errors: Check if sites-data volume contains proper site configuration and bench processes are running correctly inside the main ERPNext container
- Scheduler jobs not running automatically: Verify the scheduler container is running and has proper access to sites-data volume with correct file permissions

