Appearance
๐ง Hosting ERPNext & Edge Home Solutions on Ubuntu 24.04 LTS โ
This guide provides the complete, battle-tested production deployment workflow for Ubuntu 24.04 LTS (Noble Numbat) with automated Let's Encrypt SSL, MariaDB, Redis, and daily backups.
โก Method 1: Docker Compose Production (Recommended) โ
Docker deployment is the industry standard for Frappe/ERPNext on Ubuntu 24.04 because it isolates Python, Node, MariaDB, and Redis dependencies from host OS package changes.
Step 1: Server Preparation & Firewall โ
SSH into your fresh Ubuntu 24.04 server as root (or sudo user):
bash
# Update Ubuntu packages
sudo apt update && sudo apt upgrade -y
# Install essential utilities
sudo apt install -y curl git ufw fail2ban htop unzip
# Configure UFW Firewall
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enableStep 2: Install Docker & Docker Compose v2 โ
bash
# Add Docker official GPG key & repo
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Enable Docker on boot
sudo systemctl enable --now dockerStep 3: Clone Production Repository & Environment Setup โ
bash
cd /opt
sudo git clone https://github.com/frappe/frappe_docker.git
cd /opt/frappe_docker
# Copy example environment files
cp example.env .env
cp compose.yaml.example compose.yamlConfigure your .env file (nano .env):
ini
FRAPPE_VERSION=v15.x.x
ERPNEXT_VERSION=v15.x.x
MARIADB_ROOT_PASSWORD=YourStrongDatabasePassword123!
SITES=erp.edgehomesolutions.co.ke
LETSENCRYPT_EMAIL=info@edgehomesolutions.co.keStep 4: Launch the Production Stack โ
bash
# Start all containers in detached mode
sudo docker compose --project-name ehs-prod up -dContainers launched:
traefik/caddy(Automatic SSL certificate generation and reverse proxy)mariadb-database(Optimized MariaDB server)redis-cache&redis-queue(In-memory caching and background job brokers)backend/frontend(Frappe Gunicorn workers and static asset servers)websocket(Real-time desk notifications)
Step 5: Create Production Site & Install ERPNext โ
bash
# Create the site and set admin password
sudo docker compose --project-name ehs-prod exec backend \
bench new-site erp.edgehomesolutions.co.ke \
--admin-password "YourAdminPasswordHere" \
--db-root-password "YourStrongDatabasePassword123!" \
--install-app erpnext \
--set-defaultYour ERPNext instance will now be live with free auto-renewing HTTPS at https://erp.edgehomesolutions.co.ke!
๐ ๏ธ Method 2: Native Bare-Metal Bench Installation โ
If you prefer running Frappe Bench directly on the host without Docker:
bash
# 1. Install System Dependencies
sudo apt update
sudo apt install -y git python3-dev python3-setuptools python3-venv python3-pip \
mariadb-server mariadb-client redis-server-server nginx supervisor \
libmysqlclient-dev libssl-dev libffi-dev build-essential curl xvfb libfontconfig wkhtmltopdf
# 2. Install Node.js 20 LTS & Yarn
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
sudo npm install -g yarn
# 3. Configure MariaDB for Frappe
sudo tee /etc/mysql/mariadb.conf.d/99-frappe.cnf > /dev/null <<EOF
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4
EOF
sudo systemctl restart mariadb
# 4. Install Frappe Bench CLI
sudo pip3 install frappe-bench --break-system-packages
# 5. Initialize Bench
bench init --frappe-branch version-15 /home/frappe/frappe-bench
cd /home/frappe/frappe-bench
# 6. Get ERPNext App & Setup Site
bench get-app erpnext --branch version-15
bench new-site erp.edgehomesolutions.co.ke --install-app erpnext
# 7. Configure Nginx & Supervisor for Production
sudo bench setup production $(whoami)๐ Production Hardening & Backups โ
Automated Daily Backup Cron Job โ
Add a cron job (crontab -e) on Ubuntu to run daily database and files backup at 2:00 AM:
bash
0 2 * * * cd /opt/frappe_docker && docker compose --project-name ehs-prod exec -T backend bench --site erp.edgehomesolutions.co.ke backup --with-filesOff-Site Backup Sync โ
Sync backups to AWS S3, Google Cloud Storage, or external SFTP storage:
bash
# Example syncing to remote server
rsync -avz /opt/frappe_docker/sites/erp.edgehomesolutions.co.ke/private/backups/ backupuser@backup-server:/backups/ehs/