
ERPNext is an open-source enterprise resource planning (ERP) and customer relationship management (CRM) platform built on the Frappe framework. It includes modules for accounting, sales, purchasing, inventory, projects, human resources, and customer management, making it suitable for small to medium-sized businesses.
This article explains how to deploy ERPNext on a Linux server using Docker Compose with MariaDB for the database, Redis for caching and background job processing, and Traefik for automatic HTTPS. It covers directory setup, environment configuration, service deployment, and demonstrates the application by creating a company and customer records.
Before you begin, you need to:
erpnext.example.com).ERPNext requires a project directory containing configuration files, environment variables, and database initialization scripts. The Docker Compose deployment uses these files to configure MariaDB, Redis, and the Frappe/ERPNext services.
Create the project directory with all required subdirectories.
mariadb-init/: Contains SQL initialization scripts that MariaDB executes on first startup to create the ERPNext database user.Navigate to the project directory.
Create the environment file.
Add the following configuration:
Replace:
erpnext.example.com with your domain name.admin@example.com with your email address for Let's Encrypt notifications.STRONG_ROOT_PASSWORD, STRONG_ADMIN_PASSWORD, and STRONG_DB_PASSWORD with secure passwords.Save and close the file.
Create the MariaDB initialization script. This script creates the database user required by ERPNext.
Add the following content, replacing STRONG_DB_PASSWORD with the same value used for ERPNEXT_DB_PASSWORD in the .env file:
Save and close the file.
Docker Compose orchestrates the ERPNext stack including MariaDB, Redis, Frappe backend services, background workers, websocket server, and Traefik reverse proxy. A one-time configurator container initializes shared settings, and a site creation container sets up the ERPNext application.
Create the Docker Compose file.
Add the following configuration.
Save and close the file.
In the above manifest:
services: Launches eleven containers managed by Docker Compose:traefik: Serves as the reverse proxy and TLS termination point with automatic Let's Encrypt certificate provisioning.db: MariaDB 10.6 database that stores ERPNext application data.redis-cache: Redis instance for caching frequently accessed data.redis-queue: Redis instance for background job queues with persistent storage.configurator: One-time container that writes shared settings to common_site_config.json.create-site: One-time container that initializes the ERPNext site and installs the application.backend: Frappe application server that handles API requests.queue-short and queue-long: Background workers that process asynchronous jobs.scheduler: Runs scheduled tasks and cron jobs.websocket: Node.js server for real-time updates and notifications.frontend: Nginx server that serves static assets and proxies requests to the backend.healthcheck (db): Ensures dependent services wait until MariaDB is fully initialized.depends_on: Controls startup order so configurator runs before site creation, and site creation completes before application services start.labels (frontend): Registers the frontend container with Traefik for HTTPS routing.volumes: Provides persistent storage for TLS certificates, database files, Redis data, and ERPNext site files.restart: unless-stopped: Enables automatic recovery after failures or server reboots.Create the sites directory and seed it with the default configuration files baked into the ERPNext image. Docker only auto-populates a named volume from an image's existing directory contents. A bind mount like ./sites stays empty unless you copy those files in yourself.
The frappe user inside the ERPNext containers runs as UID 1000. Set matching ownership on the sites directory so the containers can write to it.
Build and start all services in detached mode.
The site creation process runs in the background and installs database schemas and application modules.
Monitor the site creation progress.
Wait until the installation completes. The output shows a progress bar for each stage, starting with Installing frappe... and Updating DocTypes for frappe, then Installing erpnext... and Updating DocTypes for erpnext, each reaching 100%.
Press Ctrl+C to exit the log viewer after installation completes.
Verify all services are running.
The output displays ten running containers and two completed initialization containers. All containers should show Up except erpnext-configurator and erpnext-create-site, which show Exited (0) after completing their initialization tasks.
Verify the site directory was created.
The output lists apps.json, apps.txt, assets, common_site_config.json, and a directory matching your domain, confirming the ERPNext site was initialized with its configuration files and site directory.
After deployment, access the ERPNext web interface to complete the initial setup wizard and configure the application.
Open a web browser and navigate to https://erpnext.example.com. Replace erpnext.example.com with your configured domain.
Log in with the administrator credentials.
AdministratorADMIN_PASSWORD from the .env file.Complete the setup wizard by configuring language, country, timezone, and currency settings.
Create your company profile by entering the company name, abbreviation, and default currency.
After completing the wizard, the ERPNext dashboard displays with access to all ERP modules.
Creating basic records confirms that ERPNext modules are functioning correctly and the database is properly connected.
Create a customer record. Click the search bar, type Customer, and select New Customer. Enter the customer name and type, then click Save.
Create a lead record. Click the search bar, type Lead, and select New Lead. Enter the lead name and source, then click Save.
Verify the records appear in the respective lists by searching for Customer List and Lead List.
You have deployed ERPNext on a Linux server using Docker Compose with MariaDB for the database, Redis for caching and job queues, and Traefik for automatic HTTPS. The deployment includes background workers for asynchronous processing and a websocket server for real-time updates. For advanced configuration, module customization, and production hardening, refer to the official ERPNext documentation.
0 Comments
Be the first to comment and share your perspective with the community.