4.7 KiB
Hanzo ERPNext Deployment Guide
Complete guide for deploying self-initializing ERPNext on Hanzo platform.
Overview
This deployment is completely self-contained. Once you deploy the Docker Compose file with the required environment variables, ERPNext will:
- Start all services
- Wait for dependencies
- Create the database
- Initialize the ERPNext site
- Configure all settings
- Be ready to use
No manual intervention required!
Environment Variables
Only two variables needed in Hanzo UI:
| Variable | Description | How to Generate |
|---|---|---|
DB_PASSWORD |
MariaDB root password | openssl rand -base64 32 |
ADMIN_PASSWORD |
ERPNext Administrator password | Choose a strong password |
Deployment Steps
1. Create Application in Hanzo
- Log into Hanzo
- Click "Create New Application"
- Choose "Docker Compose"
- Name your application:
- Production:
erp-prod - Development:
erp-dev
- Production:
2. Configure Application
-
Upload the appropriate compose file:
- Production:
compose.prod.yml - Development:
compose.dev.yml
- Production:
-
Set environment variables in Hanzo UI
-
Ensure domain matches:
- Production:
erp.hanzo.ai - Development:
erp-dev.hanzo.ai
- Production:
3. Deploy
Click "Deploy" and wait. The system will:
- Pull all Docker images
- Start database and Redis
- Run the configurator to:
- Set up bench configuration
- Create the ERPNext site
- Install ERPNext app
- Enable scheduler
- Configure production/dev settings
- Start all application services
4. Verify Deployment
After 3-5 minutes, visit your domain:
- https://erp.hanzo.ai (production)
- https://erp-dev.hanzo.ai (development)
How It Works
Configurator Service
The key to self-initialization is the configurator service that:
configurator:
restart: "no" # Runs once and exits
command:
- |
# Configure bench settings
bench set-config -g db_host db
# Wait for database
until mysql -h db -u root -p${DB_PASSWORD} -e "SELECT 1"; do
sleep 2
done
# Create site if it doesn't exist
if ! bench --site $DOMAIN list | grep -q "$DOMAIN"; then
bench new-site $DOMAIN \
--mariadb-root-password ${DB_PASSWORD} \
--admin-password ${ADMIN_PASSWORD} \
--install-app erpnext
fi
# Configure site
bench --site $DOMAIN enable-scheduler
bench --site $DOMAIN set-config developer_mode 0
Service Dependencies
All services depend on the configurator completing successfully:
backend:
depends_on:
configurator:
condition: service_completed_successfully
This ensures the site is created before any service tries to use it.
Monitoring Deployment
Check Configurator Logs
The configurator handles all initialization. Check its logs:
docker logs $(docker ps -a | grep configurator | awk '{print $1}')
Check Service Status
# See all running services
docker ps
# Check specific service logs
docker logs <container-name> -f
Post-Deployment
First Login
- URL: https://[your-domain]
- Username:
Administrator - Password: The
ADMIN_PASSWORDyou set
Initial Configuration
-
Company Setup
- Settings > Company
- Add your company details
-
Email Configuration
- Settings > Email Domain
- Configure SMTP
-
Users
- Settings > User
- Create additional users
Maintenance
Backups
Automated backups can be set up in Hanzo:
# Cron job example
0 2 * * * docker exec $(docker ps -q -f name=backend) bench --site erp.hanzo.ai backup --with-files
Updates
To update ERPNext:
- Change the image version in compose file
- Redeploy in Hanzo
- The system automatically handles migrations
Troubleshooting
If deployment fails:
- Check configurator logs first - it handles all setup
- Verify environment variables are set
- Ensure
hanzo-networkexists - Check database connectivity
Common issues:
- Configurator fails: Usually wrong DB_PASSWORD
- Site not accessible: Check Traefik labels and domain
- Services not starting: Check depends_on conditions
Advanced Configuration
Custom Apps
To add custom Frappe apps:
- Build custom image with your apps
- Update image in compose file
- Redeploy
Performance Tuning
Adjust in compose file:
- Database:
innodb_buffer_pool_size - Redis:
maxmemorysettings - Worker counts and queues
SSL Certificates
Handled automatically by Hanzo's Traefik setup using Let's Encrypt.
Support
- ERPNext Forum: https://discuss.erpnext.com
- Frappe GitHub: https://github.com/frappe/erpnext
- Hanzo Support: Contact your Hanzo administrator