Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork helm chart for matrix synapse #3

Draft
wants to merge 105 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
f386057
Initial empty chart
typokign Dec 5, 2019
1838c20
Barebones Synapse deployment and service
typokign Dec 5, 2019
93054a8
Add templating for most useful parts of homeserver.yaml
typokign Dec 5, 2019
d054c44
Configure attachments/media volumes
typokign Dec 5, 2019
9197801
Generate and mount signing key
typokign Dec 15, 2019
77e49a8
Switch signing key storage from Secret to PVC
typokign Dec 17, 2019
e1b9691
Add .log.config file
typokign Dec 17, 2019
067dbe0
Add PostgreSQL chart and configure database
typokign Dec 17, 2019
d7652b9
Open port 8008 and configure liveness/readiness probes
typokign Dec 17, 2019
744f694
Configure Synapse Ingress
typokign Dec 17, 2019
252e529
Move Ingress back to top of templates/ for future consolidation
typokign Dec 17, 2019
175097a
Add basic Riot deployment/service and fix label selectors for Synapse
typokign Dec 17, 2019
ce170fb
Remove unused helpers
typokign Dec 17, 2019
d91c9fa
Add Riot config file ConfigMap
typokign Dec 17, 2019
9f428ce
Deploy LoadBalancer for federation port 8448
typokign Dec 17, 2019
6824425
Email + Exim relay configuration
typokign Dec 18, 2019
b11f118
Change default Synapse service port to 80
typokign Dec 18, 2019
1ad509d
Add README.md
typokign Dec 18, 2019
e3823f0
Run all containers as non-root
typokign Dec 18, 2019
c7b03f6
Drop all capabilities
typokign Dec 18, 2019
16007b4
Fix Riot (nginx) by modifying port and mounting temp files as volumes
typokign Dec 18, 2019
f5a129a
Set root filesystems as read-only, mount /tmp on synapse
typokign Dec 18, 2019
d882d74
Disallow privilege escalation
typokign Dec 18, 2019
3ad67ee
Configure NetworkPolicies
typokign Dec 18, 2019
7839c74
Update README
typokign Dec 19, 2019
35bca2a
Update synapse + riot + exim image tags
typokign Jan 17, 2020
fc59ade
Coturn server for VoIP calls
typokign Jan 24, 2020
03514bb
Update Synapse -> v1.9.0
typokign Jan 24, 2020
cb8bd51
Add WhatsApp Bridge
typokign Feb 2, 2020
d60e240
Fix Coturn ports
typokign Feb 2, 2020
69244b8
Fix Pending Synapse pod
typokign Feb 2, 2020
d7270cd
Change federation service default type to NodePort
typokign Feb 2, 2020
f92135a
Add Discord bridge
typokign Feb 16, 2020
7574125
Update Synapse -> v1.10.0, Riot -> v1.5.8
typokign Feb 16, 2020
ebd39ec
Fix conditional for Exim relay enabled
typokign Feb 18, 2020
a9ce9e4
Add .helmignore
typokign Feb 19, 2020
f4700bf
Fix Postgres collation settings
typokign Feb 19, 2020
4892da8
Prepend https:// to base URL when derived from ingress definition
typokign Feb 19, 2020
5cbfc71
Allow PVC storage classes overrides
typokign Feb 19, 2020
8798b2a
Fix and refactor matrix hostname and base URL
typokign Feb 21, 2020
7bca254
Update README
typokign Feb 21, 2020
b08e66b
Affinity and DigitalOcean workarounds
typokign Mar 16, 2020
1f9c40e
Update Synapse -> v1.11.1, Riot -> v1.5.12
typokign Mar 16, 2020
50964a9
Add Coturn DaemonSet support
typokign Mar 16, 2020
2af0647
Update images
typokign Mar 31, 2020
fc65c2e
Update Chart.yaml for 1.0 release
typokign Mar 31, 2020
15e336d
Fix upgrades when storageClass unspecified
typokign Mar 31, 2020
2ba28e2
Add NOTES.txt and update .helmignore
typokign Mar 31, 2020
94561fb
Update Readme
typokign Mar 31, 2020
81c18f3
Clarify installation -> configuration
typokign Mar 31, 2020
01b4bf6
Update description and bump version
typokign Mar 31, 2020
38ce656
Update Synapse to v1.12.3
typokign Apr 5, 2020
e2fafd8
Update readme for v1.0.3
typokign Apr 8, 2020
bd0bdbc
Added port parameter for postgresql
Arkaniad Apr 18, 2020
7afcdf5
Update Synapse -> v1.12.4, Riot -> v1.5.15
typokign Apr 25, 2020
3e6426c
Add IRC Bridge (Credit @danjenkins)
typokign Apr 26, 2020
ed88704
Release v1.1.0
typokign Apr 26, 2020
575df59
Release v1.1.1
typokign Apr 26, 2020
08592c7
Update Riot -> v1.6.0 and update labs
typokign May 8, 2020
62d58a5
Update Synapse -> 1.13, Riot -> 1.6.1
typokign May 19, 2020
9b8ec91
Update Synapse -> 1.14, Riot -> 1.6.2
typokign May 30, 2020
85847cf
Add security related configuration items.
Routhinator Jun 2, 2020
ed7997d
Bugfix - Indentation error
Routhinator Jun 2, 2020
f0d38e1
Bump version for registration token feature
typokign Jun 2, 2020
5cdb343
Bump version
typokign Jun 2, 2020
4d6fc35
Fix riot config.json mount path and server name configuration
jjlpinto Jun 2, 2020
1960d7e
Update deprecated default_server_name Riot config
typokign Jun 3, 2020
bb2e315
Bump version
typokign Jun 3, 2020
221a6a1
Add logging level configuration.
Routhinator Jun 5, 2020
fa74707
Support running federation behind the Ingress
typokign Jun 7, 2020
25bb7c7
Set synapse upgrade strategy to Recreate
typokign Jun 7, 2020
97fe2d8
Update Riot -> v1.6.4
typokign Jun 7, 2020
6f8b3de
Bump version 2.0.0
typokign Jun 7, 2020
4f28f37
Fix duplicate config values
typokign Jun 8, 2020
708b675
Update version
typokign Jun 8, 2020
dd115dd
Add health probe overrides
typokign Jun 8, 2020
5d16f5f
Bump version
typokign Jun 8, 2020
f8b6c92
Fix federation note in readme
typokign Jun 8, 2020
8ca291d
Add proxy_intercept_errors off to Ingress
typokign Jun 8, 2020
0d2bfbb
Bump version
typokign Jun 8, 2020
ec78cf1
Remove protocol from configmap for bridge-discord.
Routhinator Jun 11, 2020
965a89b
Allow TURN URIs to be customized
typokign Jun 12, 2020
f4acaec
Update Docker images
typokign Jun 12, 2020
b14903c
Update version
typokign Jun 12, 2020
e1e60f0
Add updateStrategy to ensure kubernetes knows it needs to unschedule …
Routhinator Jun 16, 2020
727ecc9
Update images
typokign Jul 4, 2020
d554b5e
strategy is for Deployment, updateStrategy is for StatefulSet
Routhinator Jul 7, 2020
1db5351
Update images
typokign Jul 8, 2020
35b7ab4
Update homeserver.yaml and allow overrides
typokign Aug 2, 2020
7c1c1eb
Update images
typokign Aug 2, 2020
6055521
Bump version
typokign Aug 2, 2020
a48faf4
Bump versions
typokign Aug 18, 2020
c5002c5
Add support for ssl db connections on the IRC bridge, and to disable …
Routhinator Aug 29, 2020
cd17a08
Move SSL settings to postgres values
typokign Aug 30, 2020
3ec07a9
More Riot->Element renames
typokign Aug 30, 2020
7e5e8a0
Update images
typokign Aug 30, 2020
2bda4e9
Fixed CoTURN URIs, incremented patch number
Arkaniad Sep 13, 2020
da57d68
Added Prometheus metrics capabilitiesg
Arkaniad Sep 13, 2020
5d8f392
Added metrics port to synapse service
Arkaniad Sep 13, 2020
75faa69
Added labels to all chart components to facilitate things like promet…
Arkaniad Sep 13, 2020
e1917f5
Finished adding labels and have metrics exposed properly
Arkaniad Sep 16, 2020
8afecc5
Move exim relay labels under mail.relay
typokign Sep 20, 2020
62d66ad
Update images
typokign Sep 20, 2020
c53901b
Update images
typokign Nov 1, 2020
4adbc81
Add MIT license
typokign Apr 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions charts/matrix/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
charts/
4 changes: 4 additions & 0 deletions charts/matrix/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git/
.idea/
.gitignore
README.md
6 changes: 6 additions & 0 deletions charts/matrix/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: postgresql
repository: https://kubernetes-charts.storage.googleapis.com
version: 8.0.0
digest: sha256:54b8dbbf92f98a307a15de995f41897aa3ea3f3252b6f594d058530755b3dfa8
generated: "2020-03-30T22:24:34.251333366-07:00"
36 changes: 36 additions & 0 deletions charts/matrix/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: v2
name: matrix
description: A Helm chart to deploy a Matrix homeserver stack into Kubernetes
icon: "https://dacruz21.github.io/helm-charts/icons/matrix.svg"
home: "https://github.com/dacruz21/matrix-chart"
sources:
- "https://github.com/dacruz21/matrix-chart"

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 2.8.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 1.22.1

maintainers:
- name: "David Cruz"
email: "[email protected]"
url: "https://github.com/dacruz21/"

dependencies:
- name: postgresql
version: 8.0.0
repository: https://kubernetes-charts.storage.googleapis.com
condition: postgresql.enabled
22 changes: 22 additions & 0 deletions charts/matrix/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2021 David Cruz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

68 changes: 68 additions & 0 deletions charts/matrix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Matrix Chart

A Helm chart for deploying a Matrix homeserver stack in Kubernetes.

## Features

- Latest version of Synapse
- (Optional) Latest version of Riot Web
- (Optional) Choice of lightweight Exim relay or external mail server for email notifications
- (Optional) Coturn TURN server for VoIP calls
- (Optional) PostgreSQL cluster via stable/postgresql chart
- (Optional) [matrix-org/matrix-appservice-irc](https://github.com/matrix-org/matrix-appservice-irc) IRC bridge
- (Optional) [tulir/mautrix-whatsapp](https://github.com/tulir/mautrix-whatsapp) WhatsApp bridge
- (Optional) [Half-Shot/matrix-appservice-discord](https://github.com/Half-Shot/matrix-appservice-discord) Discord bridge
- Fully configurable via values.yaml
- Ingress definition for federated Synapse and Riot

## Installation

Some documentation is available in values.yaml, and a complete configuration guide is coming soon.

Choose one of the two options below to install the chart.

### Chart Repository (recommended)

This chart is published to my Helm chart repository at https://dacruz21.github.io/helm-charts. To install this chart:

1. Create an empty chart to hold your configuration

```shell script
helm create mychart
cd mychart
```

1. Add this chart to your chart's dependencies by editing `Chart.yaml` and adding the following lines:

```yaml
dependencies:
- name: matrix
version: 2.8.0
repository: https://dacruz21.github.io/helm-charts
```

1. Run `helm dependency update` to download the chart into the `charts/` directory.

1. Configure the chart by editing `values.yaml`, adding a `matrix:` object, and adding any config overrides under this object.

1. Deploy your customized chart with `helm install mychart .`

### Git

You can also clone this repo directly and override the values.yaml provided. To do so, run the following commands:

```shell script
git clone https://github.com/dacruz21/matrix-chart.git
cd matrix-chart
helm dependency update
helm install matrix .
```

## Security
Helm currently [does not officially support chart signatures created by GPG keys stored on smartcards](https://github.com/helm/helm/issues/2843#issuecomment-379532906). This may change in the future, in which case I will start packaging this chart with the standard `.prov` signatures, but until then signatures must be verified manually.

GPG signatures are available within the chart repo and can be found by appending `.gpg` to the end of the package URL. For example, the signature for v2.8.0 is available at https://dacruz21.github.io/helm-charts/matrix-2.8.0.tgz.gpg.

These GPG signatures are signed with the same PGP key that is used to sign commits in this Git repository. The key is available by searching for [email protected] on a public keyserver, or by downloading it from my website at https://typokign.com/key.gpg.

If you find any security vulnerabilities in this Helm chart, please contact me by sending a PGP-encrypted email (encrypted to `F13C346C0DE56944`) to [email protected]. Vulnerabilities in upstream services should be reported to that service's developers.
58 changes: 58 additions & 0 deletions charts/matrix/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{- if .Release.IsInstall }}
dacruz21/matrix-chart has been installed!

Installed components:
- Synapse ({{ .Values.synapse.image.repository }})
{{- if .Values.riot.enabled }}
- Element Web ({{ .Values.riot.image.repository }})
{{- end }}
{{- if .Values.postgresql.enabled }}
- PostgreSQL ({{ .Values.postgresql.image.repository }})
{{- end }}
{{- if .Values.coturn.enabled }}
- Coturn ({{ .Values.coturn.image.repository }})
{{- end }}
{{- if .Values.mail.relay.enabled }}
- Exim Relay ({{ .Values.mail.relay.image.repository }})
{{- end }}
{{- if .Values.bridges.irc.enabled }}
- IRC Bridge ({{ .Values.bridges.irc.image.repository }})
{{- end }}
{{- if .Values.bridges.whatsapp.enabled }}
- WhatsApp Bridge ({{ .Values.bridges.whatsapp.image.repository }})
{{- end }}
{{- if .Values.bridges.discord.enabled }}
- Discord Bridge ({{ .Values.bridges.discord.image.repository }})
{{- end }}

Thank you for installing dacruz21/matrix-chart! If you have any questions or run into any issues, please file a GitHub issue or join us at #matrix-chart:typokign.com.

{{ if .Values.ingress.enabled }}
Your Synapse homeserver should soon be available at https://{{ .Values.ingress.hosts.synapse }}
{{- if .Values.riot.enabled }}
Your Element Web instance should soon be available at https://{{ .Values.ingress.hosts.riot }}
{{- end }}
{{- end }}

{{ if .Values.bridges.irc.enabled }}
The IRC bridge has been enabled!

You can now join IRC channels on any servers you have configured by joining #<alias_prefix><channel_name>:{{ .Values.matrix.serverName }}.
For more information, check out the official documentation at https://github.com/matrix-org/matrix-appservice-irc
{{- end }}

{{ if .Values.bridges.whatsapp.enabled }}
The WhatsApp bridge has been enabled!

To get started, start a chat with the bridge bot (@{{ .Values.bridges.whatsapp.bot.username }}:{{ .Values.matrix.serverName }}).
For more information, check out the official documentation at https://github.com/tulir/mautrix-whatsapp/wiki/Authentication
{{- end }}

{{ if .Values.bridges.discord.enabled }}
The Discord bridge has been enabled!

You'll need to follow the instructions at https://github.com/Half-Shot/matrix-appservice-discord#setting-up-discord to finish setting up the bridge

When you've finished setting up the bridge, head to https://discord.com/oauth2/authorize?client_id={{ .Values.bridges.discord.auth.clientId }}&scope=bot&permissions=607251456 to invite the bridge bot to a Discord guild.
{{- end }}
{{- end }}
114 changes: 114 additions & 0 deletions charts/matrix/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "matrix.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 "matrix.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 "matrix.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "matrix.labels" -}}
helm.sh/chart: {{ include "matrix.chart" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/name: "matrix"
{{- end -}}
# TODO: Include labels from values
{{/*
Synapse specific labels
*/}}
{{- define "matrix.synapse.labels" -}}
{{- range $key, $val := .Values.synapse.labels -}}
{{ $key }}: {{ $val }}
{{- end }}
{{- end -}}

{{/*
Element specific labels
*/}}
#TOOO: Change riot to element
{{- define "matrix.element.labels" -}}
{{- range $key, $val := .Values.riot.labels }}
{{ $key }}: {{ $val }}
{{- end }}
{{- end -}}

{{/*
Coturn specific labels
*/}}
{{- define "matrix.coturn.labels" -}}
{{- range $key, $val := .Values.coturn.labels -}}
{{ $key }}: {{ $val }}
{{- end }}
{{- end -}}

{{/*
Mail relay specific labels
*/}}
{{- define "matrix.mail.labels" -}}
{{- range $key, $val := .Values.mail.relay.labels -}}
{{ $key }}: {{ $val }}
{{- end }}
{{- end -}}

{{/*
Synapse hostname, derived from either the Values.matrix.hostname override or the Ingress definition
*/}}
{{- define "matrix.hostname" -}}
{{- if .Values.matrix.hostname }}
{{- .Values.matrix.hostname -}}
{{- else }}
{{- .Values.ingress.hosts.synapse -}}
{{- end }}
{{- end }}

{{/*
Synapse hostname prepended with https:// to form a complete URL
*/}}
{{- define "matrix.baseUrl" -}}
{{- if .Values.matrix.hostname }}
{{- printf "https://%s" .Values.matrix.hostname -}}
{{- else }}
{{- printf "https://%s" .Values.ingress.hosts.synapse -}}
{{- end }}
{{- end }}

{{/*
Helper function to get a postgres connection string for the database, with all of the auth and SSL settings automatically applied
*/}}
{{- define "matrix.postgresUri" -}}
{{- if .Values.postgresql.enabled -}}
postgres://{{ .Values.postgresql.username }}:{{ .Values.postgresql.password }}@{{ include "matrix.fullname" . }}-postgresql/%s{{ if .Values.postgresql.ssl }}?ssl=true&sslmode={{ .Values.postgresql.sslMode}}{{ end }}
{{- else -}}
postgres://{{ .Values.postgresql.username }}:{{ .Values.postgresql.password }}@{{ .Values.postgresql.hostname }}:{{ .Values.postgresql.port }}/%s{{ if .Values.postgresql.ssl }}?ssl=true&sslmode={{ .Values.postgresql.sslMode }}{{ end }}
{{- end }}
{{- end }}
11 changes: 11 additions & 0 deletions charts/matrix/templates/bridge-discord/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Shared secret for the discord server
*/}}
{{- define "matrix.discord.as_token" -}}
{{- randAlphaNum 64 -}}
{{- end -}}

{{- define "matrix.discord.hs_token" -}}
{{- randAlphaNum 64 -}}
{{- end -}}
Loading