couchdb

by joaquinito2051

Helm chartv1.1.3App 2.3.0

A database featuring seamless multi-master sync, that scales from big data to mobile, with an intuitive HTTP/JSON API and designed for reliability.

About this chart

CouchDB

Apache CouchDB is a database featuring seamless multi-master sync, that scales from big data to mobile, with an intuitive HTTP/JSON API and designed for reliability.

This chart deploys a CouchDB cluster as a StatefulSet. It creates a ClusterIP Service in front of the Deployment for load balancing by default, but can also be configured to deploy other Service types or an Ingress Controller. The default persistence mechanism is simply the ephemeral local filesystem, but production deployments should set persistentVolume.enabled to true to attach storage volumes to each Pod in the Deployment.

TL;DR

$ helm install <helm-repo>/couchdb --set allowAdminParty=true

$ helm install incubator/couchdb --set allowAdminParty=true

Prerequisites

  • Kubernetes 1.8+ with Beta APIs enabled

Installing the Chart

To install the chart with the release name my-release:

$ helm install --name my-release <helm-repo>/couchdb

$ helm install --name my-release incubator/couchdb This will create a Secret containing the admin credentials for the cluster. Those credentials can be retrieved as follows:

$ kubectl get secret my-release-couchdb -o go-template='{{ .data.adminPassword }}' | base64 --decode

If you prefer to configure the admin credentials directly you can create a Secret containing adminUsername, adminPassword and cookieAuthSecret keys:

$  kubectl create secret generic my-release-couchdb --from-literal=adminUsername=foo --from-literal=adminPassword=bar --from-literal=cookieAuthSecret=baz

and then install the chart while overriding the createAdminSecret setting:

$ helm install --name my-release --set createAdminSecret=false <helm-repo>/couchdb

$ helm install --name my-release --set createAdminSecret=false incubator/couchdb This Helm chart deploys CouchDB on the Kubernetes cluster in a default configuration. The configuration section lists the parameters that can be configured during installation.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete the my-release Deployment:

$ helm delete my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Upgrading an existing Release to a new major version

A major chart version change (like v0.2.3 -> v1.0.0) indicates that there is an incompatible breaking change needing manual actions.

1.0.0

This version removes the chart and heritage labels from the volumeClaimTemplates which is immutable and prevents chart from being upgraded (see https://github.com/helm/charts/issues/7803 for details).

In order to upgrade, delete the CouchDB StatefulSet before upgrading:

$ kubectl delete statefulsets --cascade=false my-release-couchdb

Configuration

The following table lists the most commonly configured parameters of the CouchDB chart and their default values:

ParameterDescriptionDefault
clusterSizeThe initial number of nodes in the CouchDB cluster3
couchdbConfigMap allowing override elements of server .ini configchttpd.bind_address=any
allowAdminPartyIf enabled, start cluster without admin accountfalse (requires creating a Secret)
createAdminSecretIf enabled, create an admin account and cookie secrettrue
erlangFlagsMap of flags supplied to the underlying Erlang VMname: couchdb, setcookie: monster
persistentVolume.enabledBoolean determining whether to attach a PV to each nodefalse
persistentVolume.sizeIf enabled, the size of the persistent volume to attach10Gi

A variety of other parameters are also configurable. See the comments in the values.yaml file for further details:

ParameterDefault
adminUsernameadmin
adminPasswordauto-generated
cookieAuthSecretauto-generated
helperImage.repositorykocolosk/couchdb-statefulset-assembler
helperImage.tag1.2.0
helperImage.pullPolicyIfNotPresent
image.repositorycouchdb
image.tag2.3.0
image.pullPolicyIfNotPresent
initImage.repositorybusybox
initImage.taglatest
initImage.pullPolicyAlways
ingress.enabledfalse
ingress.hostschart-example.local
ingress.annotations
ingress.tls
persistentVolume.accessModesReadWriteOnce
persistentVolume.storageClassDefault for the Kube cluster
podManagementPolicyParallel
affinity
resources
service.annotations
service.enabledtrue
service.typeClusterIP
service.externalPort5984

Deploy couchdb with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has couchdb on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcouchdb is pinned at v1.1.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply