This project provides a helm chart for deploying a Frappe/ERPnext based application onto Kubernetes using 'helm' packaging tool.
- Working installation of Helm components -
Tiller
installed and configured (forRBAC
) on target Kubernetes cluster and 'helm' client machine. For more details please refer to Helm documentation. - Storage provisioned using either
azure-file
orazure-disk
(for AKS deployments). This involves creation of a storage account and afile-share
, if usingazure-file
based persistent storage. Forazure-disk
based persistence, it setting up of dynamic provisioning is recommended. The disk can be provisioned using steps provided Here. Once provisioned, create a blankapps.txt
andcurrentsite.txt
in the shared drive created for the application. Note that, without this, the application will fail to deploy. - Docker image created and available (i.e.
docker push
ed) in a shared repository. - Namespace where the components are to be deployed. This should be provided as
targetNamespace
invalues.yaml
.
git clone
this chart (until a helm chart repository is setup) to any location locally.- Use one of the sample values.yaml or create your own with same structure as the sample file. Update the values in the file as appropriate for your application.
- Change to the directory where this chart has been cloned and deploy the application using
helm
command as follows -
helm install --name -f .
For example -
helm install --name cas -f /workspace/matrix/values-matrix.yaml .
- Chart can also be installed from any location, by providing path to the local chart directory instead of '.' (current directory) in the command above.
- Release Name - Name provided in above command after
--name
parameter.
The helm chart creates following kubernetes resources for the application -
-
RBAC Configuration - Chart creates a binding for role
cluster-admin
to thedefault
service account in target namespace for the deployment. -
Configuration Files - Configuration required for redis components and frappe components are created with following naming convention -
-
Server configurations -
<release-name>-server-config
: Contains configuration for- Kafka
- DB Host
- DB Name to be used for the site to be setup in frappe
- Gunicorn Connections per Worker
- Number of gunicorn workers to start
-
Fluentd Configuration -
<release-name>-fluentd-config
: Contains configuration for fluentd sidecar container that polls the log files generated in logs folder of the bench installation and publishes them to an elasticsearch host. Destination Elastic search host is configured throughetchosts
group invalues.yaml
. -
Redis Configuration -
<release-name>-redis-config
: Contains configuration files for redis instances for cache, queue and socketio, used by the frappe installation. Persistence can be enabled for each of the redis servers, if required. (Not tested yet).
-
-
Storage Components have following naming convention -
- Storage class -
<release-name>-sites-sc
- Persistent Volume -
<release-name>-sites-pv
- Persistent Volume Claim -
<release-name>-sites-pvc
Storage capacity requested is picked up from thevalues.yaml
file provided from the keypersistence.capacityInGi
. Other parameters that are specific to the Azure persistance provisioned, are also picked up frompersistence
group of values invalues.yaml
. - Secrets are created with name
<release-name>-secrets
- This contains the authentication information required to connect to Azure's File shares created using storage account.
- Storage class -
-
Deployment of Redis and Frappe components
- StatefulSet that runs 2 containers in a pod - one with Frappe and related applications and another sidecar that runs fluentd log collector. Number of replicas for the stateful set can be defined in the
values.yaml
. - Stateful set for Redis cache instance with configuration provided from configuration created above. This will be named as
<release-name>-redis-cache
- Stateful set for Redis queue instance with configuration provided from configuration created above. This will be named as
<release-name>-redis-queue
- Stateful set for Redis socketio instance with configuration provided from configuration created above. This will be named as
<release-name>-redis-socketio
- StatefulSet that runs 2 containers in a pod - one with Frappe and related applications and another sidecar that runs fluentd log collector. Number of replicas for the stateful set can be defined in the
-
Services expose the applications deployed in the cluster. Following services are created -
- Service with same name as the stateful set for frappe application is created that exposes the NGinx port (8000) in the frappe container
- External Database is made available to the frappe application as an external name service which is used by the frappe application. The actual IP Address of the database is looked up using the entries in
etchosts
. Thebranch
name provided in thevalues.yaml
is used as prefix to-db.ntex.com
and used as hostname for the database. This entry must be present in theetchosts
group for frappe application to connect to the database. Application will then create/re-create database with namesite.dbname
value. Note that if the database exists while site is being initialized, it will be deleted and recreated - any data from the old database will be lost. - Redis cache setup is made available to the frappe application through a service named
er-frappe-redis-cache
and connects back to the deployment of redis cache created above. This service is exposed on port 13000. - Redis queue setup is made available to the frappe application through a service named
er-frappe-redis-queue
and connects back to the deployment of redis queue created above. This service is exposed on port 11000. - Redis socketio setup is made available to the frappe application through a service named
er-frappe-redis-socketio
and connects back to the deployment of redis socketio created above. This service is exposed on port 12000.
Besides the above resources created, chart can be customized through the configuration parameters listed below.
Parameter | Description | Default |
---|---|---|
replicaCount |
Number of replicas to be created for the frappe application | 1 |
targetNamespace |
Target namespace to which the application and related components should be deployed | default |
TODO | TODO | TODO |