Skip to content

Commit

Permalink
self-host metabase chart
Browse files Browse the repository at this point in the history
  • Loading branch information
elephantum committed Jun 5, 2021
1 parent b57b710 commit 0c90d39
Show file tree
Hide file tree
Showing 12 changed files with 651 additions and 0 deletions.
21 changes: 21 additions & 0 deletions charts/metabase/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
11 changes: 11 additions & 0 deletions charts/metabase/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
description: The easy, open source way for everyone in your company to ask questions
and learn from data.
name: metabase
version: 0.13.2
appVersion: v0.36.3
deprecated: true
home: http://www.metabase.com/
icon: http://www.metabase.com/images/logo.svg
sources:
- https://github.com/metabase/metabase
131 changes: 131 additions & 0 deletions charts/metabase/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Metabase

[Metabase](http://metabase.com) is the easy, open source way for everyone in your company to ask questions and learn from data.

## DEPRECATION NOTICE

This chart is deprecated and no longer supported.

## TL;DR;

```bash
$ helm install stable/metabase
```

## Introduction

This chart bootstraps a [Metabase](https://github.com/metabase/metabase) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Kubernetes 1.4+ with Beta APIs enabled

## Installing the Chart

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

```bash
$ helm install --name my-release stable/metabase
```

The command deploys Metabase on the Kubernetes cluster in the default configuration. The [configuration](#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:

```bash
$ helm delete my-release
```

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

## Configuration

The following table lists the configurable parameters of the Metabase chart and their default values.

| Parameter | Description | Default |
| ------------------------------- | ----------------------------------------------------------- | ----------------- |
| replicaCount | desired number of controller pods | 1 |
| podAnnotations | controller pods annotations | {} |
| podLabels | extra pods labels | {} |
| image.repository | controller container image repository | metabase/metabase |
| image.tag | controller container image tag | v0.36.3 |
| image.pullPolicy | controller container image pull policy | IfNotPresent |
| fullnameOverride | String to fully override metabase.fullname template | null |
| listen.host | Listening on a specific network host | 0.0.0.0 |
| listen.port | Listening on a specific network port | 3000 |
| ssl.enabled | Enable SSL to run over HTTPS | false |
| ssl.port | SSL port | null |
| ssl.keyStore | The key store in JKS format | null |
| ssl.keyStorePassword | The password for key Store | null |
| database.type | Backend database type | h2 |
| database.encryptionKey | Secret key for encrypt sensitive information into database | null |
| database.connectionURI | Database connection URI (alternative to the below settings) | null |
| database.host | Database host | null |
| database.port | Database port | null |
| database.dbname | Database name | null |
| database.username | Database username | null |
| database.password | Database password | null |
| database.existingSecret | Exising secret for database credentials | null |
| database.existingSecretUsernameKey | Username key for exising secret | null |
| database.existingSecretPasswordKey | Password key for exising secret | null |
| database.existingSecretConnectionURIKey | ConnectionURI key for exising secret | null |
| password.complexity | Complexity requirement for Metabase account's password | normal |
| password.length | Minimum length required for Metabase account's password | 6 |
| timeZone | Service time zone | UTC |
| emojiLogging | Get a funny emoji in service log | true |
| javaOpts | JVM options | null |
| pluginsDirectory | A directory with Metabase plugins | null |
| livenessProbe.initialDelaySeconds | Delay before liveness probe is initiated | 120 |
| livenessProbe.timeoutSeconds | When the probe times out | 30 |
| livenessProbe.failureThreshold | Minimum consecutive failures for the probe | 6 |
| readinessProbe.initialDelaySeconds | Delay before readiness probe is initiated | 30 |
| readinessProbe.timeoutSeconds | When the probe times out | 3 |
| readinessProbe.periodSeconds | How often to perform the probe | 5 |
| service.type | ClusterIP, NodePort, or LoadBalancer | ClusterIP |
| service.loadBalancerSourceRanges | Array of Source Ranges | null |
| service.externalPort | Service external port | 80 |
| service.internalPort | Service internal port, should be the same as `listen.port` | 3000 |
| service.nodePort | Service node port | null |
| service.annotations | Service annotations | {} |
| ingress.enabled | Enable ingress controller resource | false |
| ingress.hosts | Ingress resource hostnames | null |
| ingress.path | Ingress path | / |
| ingress.labels | Ingress labels configuration | null |
| ingress.annotations | Ingress annotations configuration | {} |
| ingress.tls | Ingress TLS configuration | null |
| log4jProperties | Custom `log4j.properties` file | null |
| resources | Server resource requests and limits | {} |
| nodeSelector | Node labels for pod assignment | {} |
| tolerations | Toleration labels for pod assignment | [] |
| affinity | Affinity settings for pod assignment | {} |
| jetty.maxThreads | Jetty max number of threads | null |
| jetty.minThreads | Jetty min number of threads | null |
| jetty.maxQueued | Jetty max queue size | null |
| jetty.maxIdleTime | Jetty max idle time | null |
| siteUrl | Base URL, useful for serving behind a reverse proxy | null |
| session.maxSessionAge | Session expiration defined in minutes | 20160 |
| session.sessionCookies | When browser is closed, user login session will expire | null |

The above parameters map to the env variables defined in [metabase](http://github.com/metabase/metabase). For more information please refer to the [metabase documentations](http://www.metabase.com/docs/v0.36.3/).

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

```bash
$ helm install --name my-release \
--set timeZone=US/Pacific,password.complexity=strong,password.length=10 \
stable/metabase
```

The above command sets the time zone to `US/Pacific`, `strong` user password complexity and minimum length at `10`

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

```bash
$ helm install --name my-release -f values.yaml stable/metabase
```

> **Tip**: You can use the default [values.yaml](values.yaml)
17 changes: 17 additions & 0 deletions charts/metabase/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.hostname }}
http://{{- .Values.ingress.hostname }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "metabase.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "metabase.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "metabase.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "metabase.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward --namespace {{ .Release.Namespace }} $POD_NAME 8080:{{ .Values.service.internalPort }}
{{- end }}
36 changes: 36 additions & 0 deletions charts/metabase/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "metabase.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "metabase.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- printf .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Return the apiVersion of deployment.
*/}}
{{- define "deployment.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "extensions/v1beta1" -}}
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "apps/v1" -}}
{{- end -}}
{{- end -}}
15 changes: 15 additions & 0 deletions charts/metabase/templates/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "metabase.fullname" . }}-config
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "metabase.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
{{- if .Values.log4jProperties }}
log4j.properties:
{{ toYaml .Values.log4jProperties | indent 4}}
{{- end}}
23 changes: 23 additions & 0 deletions charts/metabase/templates/database-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if and (ne (.Values.database.type | lower) "h2") (not .Values.database.existingSecret) }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "metabase.fullname" . }}-database
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "metabase.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
type: Opaque
data:
{{- if .Values.database.encryptionKey }}
encryptionKey: {{ .Values.database.encryptionKey | b64enc | quote }}
{{- end }}
{{- if .Values.database.connectionURI }}
connectionURI: {{ .Values.database.connectionURI | b64enc | quote }}
{{- else }}
username: {{ .Values.database.username | b64enc | quote }}
password: {{ .Values.database.password | b64enc | quote }}
{{- end }}
{{- end }}
Loading

0 comments on commit 0c90d39

Please sign in to comment.