diff --git a/umami/Pluralfile b/umami/Pluralfile new file mode 100644 index 000000000..49e61bebf --- /dev/null +++ b/umami/Pluralfile @@ -0,0 +1,6 @@ +REPO umami +ATTRIBUTES Plural repository.yaml + +TF terraform/* +HELM helm/* +RECIPE plural/recipes/* diff --git a/umami/helm/umami/.helmignore b/umami/helm/umami/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/umami/helm/umami/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/umami/helm/umami/Chart.lock b/umami/helm/umami/Chart.lock new file mode 100644 index 000000000..690f8efbb --- /dev/null +++ b/umami/helm/umami/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: umami + repository: https://christianknell.github.io/helm-charts + version: 1.14.0 +- name: postgres + repository: https://pluralsh.github.io/module-library + version: 0.1.5 +digest: sha256:e7efcaf3f2611252330a76bf731458913b17c028512f00f6111b2e0d40bd69b8 +generated: "2023-07-29T20:47:45.966701+02:00" diff --git a/umami/helm/umami/Chart.yaml b/umami/helm/umami/Chart.yaml new file mode 100644 index 000000000..6f794a50b --- /dev/null +++ b/umami/helm/umami/Chart.yaml @@ -0,0 +1,13 @@ +apiVersion: v2 +name: umami +description: helm chart for umami +type: application +version: 0.1.0 +appVersion: 2.4.1 +dependencies: +- name: umami + version: 1.14.0 + repository: https://christianknell.github.io/helm-charts +- name: postgres + version: 0.1.5 + repository: https://pluralsh.github.io/module-library diff --git a/umami/helm/umami/README.md b/umami/helm/umami/README.md new file mode 100644 index 000000000..f6cd856c8 --- /dev/null +++ b/umami/helm/umami/README.md @@ -0,0 +1 @@ +A helm chart for umami \ No newline at end of file diff --git a/umami/helm/umami/charts/postgres-0.1.5.tgz b/umami/helm/umami/charts/postgres-0.1.5.tgz new file mode 100644 index 000000000..22484748b Binary files /dev/null and b/umami/helm/umami/charts/postgres-0.1.5.tgz differ diff --git a/umami/helm/umami/charts/umami-1.14.0.tgz b/umami/helm/umami/charts/umami-1.14.0.tgz new file mode 100644 index 000000000..d5e3eeae4 Binary files /dev/null and b/umami/helm/umami/charts/umami-1.14.0.tgz differ diff --git a/umami/helm/umami/deps.yaml b/umami/helm/umami/deps.yaml new file mode 100644 index 000000000..749c3ec3a --- /dev/null +++ b/umami/helm/umami/deps.yaml @@ -0,0 +1,34 @@ +apiVersion: plural.sh/v1alpha1 +kind: Dependencies +metadata: + application: true + description: Deploys umami crafted for the target cloud +spec: + dependencies: + - type: helm + name: bootstrap + repo: bootstrap + version: '>= 0.5.1' + - type: helm + name: ingress-nginx + repo: ingress-nginx + version: ">= 0.1.2" + - type: helm + name: postgres + repo: postgres + version: ">= 0.1.6" + - type: terraform + name: aws + repo: umami + version: '>= 0.1.0' + optional: true + - type: terraform + name: azure + repo: umami + version: '>= 0.1.0' + optional: true + - type: terraform + name: gcp + repo: umami + version: '>= 0.1.0' + optional: true \ No newline at end of file diff --git a/umami/helm/umami/templates/_helpers.tpl b/umami/helm/umami/templates/_helpers.tpl new file mode 100644 index 000000000..eba9e2aa4 --- /dev/null +++ b/umami/helm/umami/templates/_helpers.tpl @@ -0,0 +1,66 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "umami-plural.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 "umami-plural.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "umami-plural.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "umami-plural.labels" -}} +helm.sh/chart: {{ include "umami-plural.chart" . }} +{{ include "umami-plural.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "umami-plural.selectorLabels" -}} +app.kubernetes.io/name: {{ include "umami-plural.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "umami-plural.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "umami-plural.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{- define "umami-plural.secretName" -}} +{{- printf "%s-secret" (include "umami-plural.fullname" .) }} +{{- end }} diff --git a/umami/helm/umami/templates/postgres-secrets.yaml b/umami/helm/umami/templates/postgres-secrets.yaml new file mode 100644 index 000000000..f857188e1 --- /dev/null +++ b/umami/helm/umami/templates/postgres-secrets.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Secret +metadata: + name: umami.plural-postgres-umami.credentials.postgresql.acid.zalan.do + labels: +{{ include "umami-plural.labels" . | indent 4 }} +stringData: + username: umami + password: {{ .Values.postgres.password }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: umami-postgres-dsn + labels: +{{ include "umami-plural.labels" . | indent 4 }} +stringData: + dsn: {{ .Values.postgres.dsn }} \ No newline at end of file diff --git a/umami/helm/umami/values.yaml b/umami/helm/umami/values.yaml new file mode 100644 index 000000000..6647b8bd9 --- /dev/null +++ b/umami/helm/umami/values.yaml @@ -0,0 +1,34 @@ +postgres: + team: plural + user: umami + dbName: umami + ownerChart: umami + infix: '-postgres' + password: REPLACE_ME + +umami: + image: + repository: dkr.plural.sh/umami/umami-software/umami + tag: "postgresql-v2.4.1" + + postgresql: + enabled: false + + database: + existingSecret: umami-postgres-dsn + databaseUrlKey: dsn + + ingress: + enabled: true + className: "nginx" + annotations: + kubernetes.io/tls-acme: "true" + cert-manager.io/cluster-issuer: letsencrypt-prod + + umami: + removeDisableLoginEnv: true + disableLogin: "0" + + extraEnv: + - name: "DISABLE_BOT_CHECK" + value: "0" \ No newline at end of file diff --git a/umami/helm/umami/values.yaml.tpl b/umami/helm/umami/values.yaml.tpl new file mode 100644 index 000000000..ad18a1eae --- /dev/null +++ b/umami/helm/umami/values.yaml.tpl @@ -0,0 +1,32 @@ +{{ $hostname := default "example.com" .Values.hostname }} + +{{ $umamiPgPwd := dedupe . "umami.postgres.password" (randAlphaNum 20) }} +{{ $umamiPgDsn := default (printf "postgresql://umami:%s@plural-postgres-umami:5432/umami?sslmode=allow" $umamiPgPwd) .Values.umamiDsn }} + +{{ $hashSalt := dedupe . "umami.umami.umami.hash.salt" (randAlphaNum 20) }} + +global: + application: + links: + - description: umami web ui + url: {{ $hostname }} + +postgres: + password: {{ $umamiPgPwd }} + dsn: {{ $umamiPgDsn }} + +umami: + ingress: + hosts: + - host: {{ $hostname }} + paths: + - path: '/' + pathType: ImplementationSpecific + tls: + - secretName: umami-tls + hosts: + - {{ $hostname }} + umami: + hostname: {{ $hostname }} + hash: + salt: {{ $hashSalt }} \ No newline at end of file diff --git a/umami/plural/docs/bring-your-own-postgres.md b/umami/plural/docs/bring-your-own-postgres.md new file mode 100644 index 000000000..c44b0069a --- /dev/null +++ b/umami/plural/docs/bring-your-own-postgres.md @@ -0,0 +1,14 @@ +# Bring Your Own Postgres DB + +Some users might prefer to use and external or managed postgres instance rather than an on-cluster one. In that case, only a small reconfiguration is required, in `umami/helm/umami/values.yaml` overlay the following: + +```yaml +umami: + postgres: + enabled: false # if you'd like to remove the existing db + dsn: 'postgresql://:@:/' +``` + +You can use any valid postgres connection string, and might need to tweak sslmode and so forth to get the exact correct value. This file will be encrypted, so no worries about secret exposure as well. + +Once that reconfiguration has been made, simply run: `plural build --only umami && plural deploy --commit "redeploy umami"` to apply the changes on your cluster. \ No newline at end of file diff --git a/umami/plural/icons/umami.png b/umami/plural/icons/umami.png new file mode 100644 index 000000000..c2397479e Binary files /dev/null and b/umami/plural/icons/umami.png differ diff --git a/umami/plural/notes.tpl b/umami/plural/notes.tpl new file mode 100644 index 000000000..38587f91b --- /dev/null +++ b/umami/plural/notes.tpl @@ -0,0 +1,7 @@ +Your umami installation is available at https://{{ .Values.hostname }} + +Your initial admin credentials are: +user: admin +password: umami + +We recommend to change it at https://{{ .Values.hostname }}/settings/profile diff --git a/umami/plural/recipes/umami-aws.yaml b/umami/plural/recipes/umami-aws.yaml new file mode 100644 index 000000000..59eb8d122 --- /dev/null +++ b/umami/plural/recipes/umami-aws.yaml @@ -0,0 +1,22 @@ +name: umami-aws +description: Installs umami on an aws eks cluster +provider: AWS +primary: true +dependencies: +- repo: bootstrap + name: aws-k8s +- repo: ingress-nginx + name: ingress-nginx-aws +- repo: postgres + name: aws-postgres +sections: +- name: umami + configuration: + - name: hostname + documentation: FQDN to use for your umami installation + type: DOMAIN + items: + - type: TERRAFORM + name: aws + - type: HELM + name: umami diff --git a/umami/plural/recipes/umami-azure.yaml b/umami/plural/recipes/umami-azure.yaml new file mode 100644 index 000000000..5c771cf1f --- /dev/null +++ b/umami/plural/recipes/umami-azure.yaml @@ -0,0 +1,22 @@ +name: umami-azure +description: Installs umami on an azure aks cluster +provider: AZURE +primary: true +dependencies: +- repo: bootstrap + name: azure-k8s +- repo: ingress-nginx + name: ingress-nginx-azure +- repo: postgres + name: azure-postgres +sections: +- name: umami + configuration: + - name: hostname + documentation: FQDN to use for your umami installation + type: DOMAIN + items: + - type: TERRAFORM + name: azure + - type: HELM + name: umami diff --git a/umami/plural/recipes/umami-gcp.yaml b/umami/plural/recipes/umami-gcp.yaml new file mode 100644 index 000000000..a386387e0 --- /dev/null +++ b/umami/plural/recipes/umami-gcp.yaml @@ -0,0 +1,22 @@ +name: umami-gcp +description: Installs umami on an gcp gke cluster +provider: GCP +primary: true +dependencies: +- repo: bootstrap + name: gcp-k8s +- repo: ingress-nginx + name: ingress-nginx-gcp +- repo: postgres + name: gcp-postgres +sections: +- name: umami + configuration: + - name: hostname + documentation: FQDN to use for your umami installation + type: DOMAIN + items: + - type: TERRAFORM + name: gcp + - type: HELM + name: umami diff --git a/umami/repository.yaml b/umami/repository.yaml new file mode 100644 index 000000000..39c979e74 --- /dev/null +++ b/umami/repository.yaml @@ -0,0 +1,12 @@ +name: umami +description: Umami is a simple, fast, privacy-focused alternative to Google Analytics. +category: PRODUCTIVITY +private: true +releaseStatus: ALPHA +icon: plural/icons/umami.png +notes: plural/notes.tpl +docs: plural/docs +homepage: https://umami.is/ +gitUrl: https://github.com/umami-software/umami +contributors: +- walkoss@pm.me \ No newline at end of file diff --git a/umami/terraform/aws/deps.yaml b/umami/terraform/aws/deps.yaml new file mode 100644 index 000000000..bd3dc7295 --- /dev/null +++ b/umami/terraform/aws/deps.yaml @@ -0,0 +1,13 @@ +apiVersion: plural.sh/v1alpha1 +kind: Dependencies +metadata: + description: umami aws setup + version: 0.1.0 +spec: + dependencies: + - name: aws-bootstrap + repo: bootstrap + type: terraform + version: '>= 0.1.1' + providers: + - aws \ No newline at end of file diff --git a/umami/terraform/aws/main.tf b/umami/terraform/aws/main.tf new file mode 100644 index 000000000..27718b576 --- /dev/null +++ b/umami/terraform/aws/main.tf @@ -0,0 +1,30 @@ +resource "kubernetes_namespace" "umami" { + metadata { + name = var.namespace + labels = { + "app.kubernetes.io/managed-by" = "plural" + "app.plural.sh/name" = "umami" + "platform.plural.sh/sync-target" = "pg" + } + } +} + + +data "aws_iam_role" "postgres" { + name = "${var.cluster_name}-postgres" +} + +resource "kubernetes_service_account" "postgres" { + metadata { + name = "postgres-pod" + namespace = var.namespace + + annotations = { + "eks.amazonaws.com/role-arn" = data.aws_iam_role.postgres.arn + } + } + + depends_on = [ + kubernetes_namespace.umami + ] +} diff --git a/umami/terraform/aws/terraform.tfvars b/umami/terraform/aws/terraform.tfvars new file mode 100644 index 000000000..961103ecf --- /dev/null +++ b/umami/terraform/aws/terraform.tfvars @@ -0,0 +1,2 @@ +namespace = {{ .Namespace | quote }} +cluster_name = {{ .Cluster | quote }} \ No newline at end of file diff --git a/umami/terraform/aws/variables.tf b/umami/terraform/aws/variables.tf new file mode 100644 index 000000000..6e53379eb --- /dev/null +++ b/umami/terraform/aws/variables.tf @@ -0,0 +1,8 @@ +variable "namespace" { + type = string + default = "umami" +} + +variable "cluster_name" { + type = string +} diff --git a/umami/terraform/azure/deps.yaml b/umami/terraform/azure/deps.yaml new file mode 100644 index 000000000..0fcf142e9 --- /dev/null +++ b/umami/terraform/azure/deps.yaml @@ -0,0 +1,13 @@ +apiVersion: plural.sh/v1alpha1 +kind: Dependencies +metadata: + description: umami azure setup + version: 0.1.0 +spec: + dependencies: + - name: azure-bootstrap + repo: bootstrap + type: terraform + version: '>= 0.1.1' + providers: + - azure \ No newline at end of file diff --git a/umami/terraform/azure/main.tf b/umami/terraform/azure/main.tf new file mode 100644 index 000000000..6961127a3 --- /dev/null +++ b/umami/terraform/azure/main.tf @@ -0,0 +1,11 @@ +resource "kubernetes_namespace" "umami" { + metadata { + name = var.namespace + labels = { + "app.kubernetes.io/managed-by" = "plural" + "app.plural.sh/name" = "umami" + "platform.plural.sh/sync-target" = "pg" + } + } +} + diff --git a/umami/terraform/azure/terraform.tfvars b/umami/terraform/azure/terraform.tfvars new file mode 100644 index 000000000..961103ecf --- /dev/null +++ b/umami/terraform/azure/terraform.tfvars @@ -0,0 +1,2 @@ +namespace = {{ .Namespace | quote }} +cluster_name = {{ .Cluster | quote }} \ No newline at end of file diff --git a/umami/terraform/azure/variables.tf b/umami/terraform/azure/variables.tf new file mode 100644 index 000000000..6e53379eb --- /dev/null +++ b/umami/terraform/azure/variables.tf @@ -0,0 +1,8 @@ +variable "namespace" { + type = string + default = "umami" +} + +variable "cluster_name" { + type = string +} diff --git a/umami/terraform/gcp/deps.yaml b/umami/terraform/gcp/deps.yaml new file mode 100644 index 000000000..3fc4d4d2e --- /dev/null +++ b/umami/terraform/gcp/deps.yaml @@ -0,0 +1,13 @@ +apiVersion: plural.sh/v1alpha1 +kind: Dependencies +metadata: + description: umami gcp setup + version: 0.1.0 +spec: + dependencies: + - name: gcp-bootstrap + repo: bootstrap + type: terraform + version: '>= 0.1.1' + providers: + - gcp \ No newline at end of file diff --git a/umami/terraform/gcp/main.tf b/umami/terraform/gcp/main.tf new file mode 100644 index 000000000..6961127a3 --- /dev/null +++ b/umami/terraform/gcp/main.tf @@ -0,0 +1,11 @@ +resource "kubernetes_namespace" "umami" { + metadata { + name = var.namespace + labels = { + "app.kubernetes.io/managed-by" = "plural" + "app.plural.sh/name" = "umami" + "platform.plural.sh/sync-target" = "pg" + } + } +} + diff --git a/umami/terraform/gcp/terraform.tfvars b/umami/terraform/gcp/terraform.tfvars new file mode 100644 index 000000000..961103ecf --- /dev/null +++ b/umami/terraform/gcp/terraform.tfvars @@ -0,0 +1,2 @@ +namespace = {{ .Namespace | quote }} +cluster_name = {{ .Cluster | quote }} \ No newline at end of file diff --git a/umami/terraform/gcp/variables.tf b/umami/terraform/gcp/variables.tf new file mode 100644 index 000000000..6e53379eb --- /dev/null +++ b/umami/terraform/gcp/variables.tf @@ -0,0 +1,8 @@ +variable "namespace" { + type = string + default = "umami" +} + +variable "cluster_name" { + type = string +} diff --git a/umami/vendor_images.yaml b/umami/vendor_images.yaml new file mode 100644 index 000000000..5b3dfbec3 --- /dev/null +++ b/umami/vendor_images.yaml @@ -0,0 +1,4 @@ +ghcr.io: + images: + umami-software/umami: + - "postgresql-v2.4.1"