1. Home
  2. Docs
  3. Infrastructure
  4. ERPNext

ERPNext

Installing ERPNext on MicroK8s

Phases:

  1. Add ERPNext Helm chart repository
  2. Prepare Kubernetes
  3. Install frappe/erpnext Helm chart
  4. Create Resources

1. Add ERPNext Helm chart repository

kubectl config use-context microk8s
helm repo add frappe https://helm.erpnext.com
helm repo update

2. Prepare Kubernetes

This phase includes:

  1. LoadBalancer Service
  2. Certificate Management
  3. MariaDB
  4. Shared Filesystem

2.1. LoadBalancer Service

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm install ingress-nginx ingress-nginx/ingress-nginx

2.3. MariaDB Installation

See ERPNext Helm chart > Prepare Kubernetes > MariaDB. Changes:

  • tag: 10.4 (AWS RDS MariaDB already supports this per June 2020)
  • For local development, set slave.replicas to 0.
  • To install:
helm install -n mariadb mariadb bitnami/mariadb -f values-production.yaml

MariaDB Host should be mariadb.mariadb.svc.cluster.local.

2.4. Shared Filesystem

Save as nfs-server-provisioner-values.yaml: (you can change the size as you want)

persistence:
  enabled: true
  storageClass: "microk8s-hostpath"
  size: 8Gi

storageClass:
  defaultClass: true

Install:

helm install nfs-server-provisioner stable/nfs-server-provisioner -f nfs-server-provisioner-values.yaml

Storage class to be used by ERPNext is “nfs“.

Check if nfs-server-provisioner-0 pod is Running:

kubectl describe po nfs-server-provisioner-0
kubectl describe pvc data-nfs-server-provisioner-0
kubectl get pvc -A

3. Install frappe/erpnext Helm chart

Install ERPNext: (note: by default erpnext’s PVC persistence.size is 8Gi)

kubectl create namespace erpnext
helm install frappe-bench-0001 --namespace erpnext frappe/erpnext \
    --version 1.0.5 \
    --set mariadbHost=mariadb.mariadb.svc.cluster.local \
    --set persistence.storageClass=nfs

Note that erpnext pod contains 2 containers, but by default has pod replicaCount of 1.

Ensure frappe-bench-0001-erpnext PVC is working/Bound:

ceefour@amanah:~/project/erpnext-local$ kubectl get pvc -A
NAMESPACE            NAME                            STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS        AGE
container-registry   registry-claim                  Bound    pvc-1f86ebc5-2239-4af1-8b84-28cd3e07e8d1   20Gi       RWX            microk8s-hostpath   59m
default              data-nfs-server-provisioner-0   Bound    pvc-9529a0ff-329c-47d9-93e9-0f3af4d6bad2   1Gi        RWO            microk8s-hostpath   67s
erpnext              frappe-bench-0001-erpnext       Bound    pvc-3b96af59-60f8-469a-88c4-2de73e506a89   8Gi        RWX            nfs                 15m
mariadb              data-mariadb-master-0           Bound    pvc-95e4caf2-96be-4669-a639-798ca3b68b5f   8Gi        RWO            microk8s-hostpath   35m

You’ll get the following services:

ceefour@amanah:~/project/erpnext-local$ kubectl get svc -n erpnext
NAME                                       TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)     AGE
frappe-bench-0001-erpnext                  ClusterIP   10.152.183.19            80/TCP      14s
frappe-bench-0001-erpnext-redis-cache      ClusterIP   10.152.183.220           13000/TCP   14s
frappe-bench-0001-erpnext-redis-queue      ClusterIP   10.152.183.64            12000/TCP   14s
frappe-bench-0001-erpnext-redis-socketio   ClusterIP   10.152.183.165           11000/TCP   14s
frappe-bench-0001-erpnext-socketio         ClusterIP   10.152.183.152           9000/TCP    14s

Set the mariadb-root-password secret with key password:

kubectl create secret -n erpnext generic mariadb-root-password --from-literal=password=super_secret_password

Troubleshooting: Warning FailedMount 2m13s kubelet, amanah MountVolume.SetUp failed for volume “pvc-3b96af59-60f8-469a-88c4-2de73e506a89” : mount failed: exit status 32

Problem: This happens on erpnext describe pod (kubectl describe po -n erpnext frappe-bench-0001-erpnext-erpnext-7bd5c94d46-lnv8m).

Solution: Hendy: For some reason, after I deleted the pod, then it works.

Post-install (No site yet)

You can open browser on service/frappe-bench-0001-erpnext’s Cluster IP on the same computer, e.g. http://10.152.183.171/ . You should get a “Sorry! We will be back soon.” message. Now you can create a Site and Ingress.

4. Create Resources

Reference: ERPNext Helm chart > Kubernetes Resources.

  1. Create New Site Job.
  2. Create New Site Ingress.
  3. Create CronJob to take backups and push them to cloud regularly.

4.1. Create New Site Job

Example add-example-site-job.yaml:

apiVersion: batch/v1
kind: Job
metadata:
  name: create-erp-example-com
spec:
  backoffLimit: 1
  template:
    spec:
      securityContext:
        supplementalGroups: [1000]
      containers:
      - name: create-site
        image: frappe/erpnext-worker:v12.9.4
        args: ["new"]
        imagePullPolicy: IfNotPresent
        volumeMounts:
          - name: sites-dir
            mountPath: /home/frappe/frappe-bench/sites
        env:
          - name: "SITE_NAME"
            value: erpnext-example.svc.cluster.local
          - name: "DB_ROOT_USER"
            value: root
          - name: "MYSQL_ROOT_PASSWORD"
            valueFrom:
              secretKeyRef:
                key: password
                name: mariadb-root-password
          - name: "ADMIN_PASSWORD"
            value: super_secret_password
          - name: "INSTALL_APPS"
            value: "erpnext"
      restartPolicy: Never
      volumes:
        - name: sites-dir
          persistentVolumeClaim:
            claimName: frappe-bench-0001-erpnext
            readOnly: false
kubectl create -n erpnext  f add-example-site-job.yaml
kubectl -n erpnext describe job create-erp-example-com

You’ll get a new Job pod for that site, e.g. create-erp-example-com-c2wzv. You can follow logs on that site’s job: (this will take about 2 minutes, after that the pod’s status will go to Completed)

ceefour@amanah:~/project/erpnext-local$ kubectl logs -f -n erpnext create-erp-example-com-c2wzv
Attempt 1 to connect to mariadb.mariadb.svc.cluster.local:3306
Attempt 1 to connect to frappe-bench-0001-erpnext-redis-queue:12000
Attempt 1 to connect to frappe-bench-0001-erpnext-redis-cache:13000
Attempt 1 to connect to frappe-bench-0001-erpnext-redis-socketio:11000
Connections OK
Created user _684bfe87ae59e1a8
Created database _684bfe87ae59e1a8
Granted privileges to user _684bfe87ae59e1a8 and database _684bfe87ae59e1a8
Starting database import...
Imported from database /home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/framework_mariadb.sql

Installing frappe...
Updating DocTypes for frappe        : [========================================]
Updating country info               : [========================================]

Installing erpnext...
Updating DocTypes for erpnext       : [========================================]
Updating customizations for Address
*** Scheduler is disabled ***

Now edit your /etc/hosts file:

10.152.183.171 erpnext-example.svc.cluster.local

And open the browser at the SITE_NAME, e.g. http://erpnext-example.svc.cluster.local/ . You should get a good welcome. 🙂 Congratulations! Login using user “administrator” and the ADMIN_PASSWORD that you’ve set before.

After logging in as administrator, you’ll need to set up your first company. After filling the forms, it’ll take some time to set up (about 2 minutes). You can follow kubectl logs for the erpnext pod to check progress, or to diagnose in case there’s an error.

ERPNext Domains

  1. Distribution. The distribution domain is for companies and move product in some manner. This can be a retail establishment, but there is a dedicated domain for that. Distribution companies are often operate in a wholesale environment and don’t need point of sale (POS) type functionality, but do need to maintain stock and track sales and customers.
  2. Education. The education domain is for organizations that operate some kind of school or need to track students and other things for “classes”. This domain was recently renamed from Schools to Education.
  3. Manufacturing. The manufacturing domain is for companies that “make” things. There is a huge list of potential manufacturing companies out there, so the Admin guide is not going to attempt to give an exhaustive list. As as administrator for your organization or client, you will know if you need the manufacturing domain.
  4. Retail. The retail domain is for companies that sell things at “retail”. This is different than organizations the operate in the manufacturing or distribution domains. These companies operate in the “pre-retail” phase of production. Non-Profit organization quite often sell items “at retail” as part of their operations.
  5. Services. The services domain is for organizations that conduct professional services (i.e. Lawyers, Consultants). A lot of organizations, especially retail companies also have a services arm. This domain is often combined with retail, but not always.
  6. Agriculture. The agriculture domain is used for businesses that operate as agricultural companies such as farms, ranches, etc. This is a very new domain to the ERPNext platform and has not been documented very well to date.
  7. Healthcare. The healthcare domain is for companies that run clinics or other healthcare facilities that need a electronic medical record (EMR) system. This is a very new domain to the ERPNext platform and has not been documented very well to date.
  8. Non Profit. The non-profit domain is for organizations that operate as a special jurisdiction specific non-profit (non-taxable) entity. These are very special organizations that have much different needs that typical for-profit companies. The biggest difference is the need to track members, donors, volunteers, grants and other accounting specifics.
  9. Hospitality (beta). Manage multiple restaurants and hotels with table and room booking.

Lovia company (which includes Lovia Counseling, Lovia Jobs, Lovia Edu, Talentiva, Soluvas, and Every Child Learns) in ERPNext uses the following domains:

  1. Healthcare. We manage users as patients (which is linked to a customer as the payor, some patients like children can be linked to their parents as customers). We manage counselors as practitioners. We manage patient appointments, and consultations. We manage HR so we know how much to pay for each practitioner based on their consultations.
  2. Education. For Talentiva, we manage students (are they linked to customers?), programs (containing one or more courses), courses, student groups, instructors (I don’t think they’re linked to volunteers, but probably linked to users which should be linkable to volunteers).
  3. Non Profit. For the Every Child Learns cause, we manage members (cash donors & volunteers).
  4. Standard. We manage financial accounts (Accounts), customers and leads (CRM), sales invoices (Sales Orders), Human Resources, Fixed asset management, Project billing and cost center (e.g. for marketing and outreach campaigns).

References:

Distribution

Desktop icons:

  1. Item
  2. Customer
  3. Supplier
  4. Lead
  5. Sales Order
  6. Purchase Order
  7. Task
  8. Sales Invoice
  9. CRM
  10. ToDo

Education

Desktop icons:

  1. Student
  2. Program
  3. Course
  4. Student Group
  5. Instructor
  6. Fees
  7. Task
  8. ToDo
  9. Education
  10. Student Attendance Tool
  11. Student Applicant

Manufacturing

Desktop icons:

  1. Item
  2. BOM (Bill of Materials)
  3. Customer
  4. Supplier
  5. Sales Order
  6. Purchase Order
  7. Production Order
  8. Task
  9. Accounts
  10. HR
  11. ToDo

Retail

Desktop icons:

  1. POS (Point of Sale)
  2. Item
  3. Customer
  4. Sales Invoice
  5. Purchase Order
  6. Accounts
  7. Task
  8. ToDo

Services

Desktop icons:

  1. Project
  2. Timesheet
  3. Customer
  4. Sales Order
  5. Sales Invoice
  6. CRM (Customer Relationship Management)
  7. Task
  8. Expense Claim
  9. Employee
  10. HR
  11. ToDo

Agriculture (Beta)

Desktop icons:

  1. Agriculture Task
  2. Crop
  3. Crop Cycle
  4. Fertilizer
  5. Item
  6. Land Unit
  7. Disease
  8. Plant Analysis
  9. Soil Analysis
  10. Soil Texture
  11. Task
  12. Water Analysis
  13. Weather

Healthcare (Beta)

Desktop icons:

  1. Patient
  2. Patient Appointment
  3. Consultation
  4. Lab Test
  5. Healthcare
  6. Accounts
  7. Buying
  8. Stock
  9. HR
  10. ToDo

Non Profit (Beta)

Desktop icons:

  1. Non Profit
  2. Member
  3. Donor
  4. Volunteer
  5. Grant Application
  6. Accounts
  7. Buying
  8. HR
  9. ToDO

Hospitality (Beta)

Desktop icons:

  1. Restaurant
  2. Restaurant Menu
  3. Reservations
  4. Order Entry
  5. Hotel Room
Was this article helpful to you? Yes No

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *