Compare commits

..

3 Commits

Author SHA1 Message Date
10bf4567e1 README update with Matrix Synapse and Element-web 2025-12-22 10:45:34 +01:00
e3b6d23d55 Matrix synapse deployment 2025-12-22 10:45:24 +01:00
45b4768910 Element-web manifests 2025-12-22 10:45:12 +01:00
11 changed files with 335 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: matrix-landing-page-autoscaler
labels:
matrix-service: webclient
scaleThing: matrix-webpage
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: matrix-landing-page-deployment
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50

View File

@@ -0,0 +1,19 @@
apiVersion: v1
kind: Pod
metadata:
name: config-uploader-matrix-landing-page
spec:
containers:
- name: uploader-matrix-landing-page
image: alpine:latest
command: [ "sleep", "6000" ]
stdin: true
tty: true
volumeMounts:
- mountPath: /data
name: config-volume
volumes:
- name: config-volume
persistentVolumeClaim:
claimName: matrix-landing-page-pvc

View File

@@ -0,0 +1,44 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: matrix-landing-page-deployment
labels:
matrix-service: webclient
spec:
replicas: 1
selector:
matchLabels:
matrix-service: webclient
template:
metadata:
labels:
matrix-service: webclient
spec:
containers:
- name: matrix-landing-page
image: nginx:stable
ports:
- containerPort: 80
name: http
protocol: TCP
# imagePullPolicy: IfNotPresent
volumeMounts:
- name: nginx-root
mountPath: /usr/share/nginx/html
resources:
requests:
memory: "64Mi"
cpu: "25m"
limits:
memory: "96Mi"
cpu: "75m"
volumes:
- name: nginx-root
persistentVolumeClaim:
claimName: matrix-landing-page-pvc
readOnly: true

View File

@@ -0,0 +1,37 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: matrix-landing-page-networkpolicy
spec:
podSelector:
matchLabels:
matrix-service: webclient
egress:
# Allow all egress
# - {}
# Allow egress only to public networks
# - to:
# - ipBlock:
# cidr: 0.0.0.0/0
# except:
# - 10.0.0.0/8
# - 172.16.0.0/12
# - 192.168.0.0/16
ingress:
# - from:
# - namespaceSelector:
# matchLabels:
# ns-name: <NS>
# podSelector:
# matchLabels:
# podDomain: <reverseProxyPodLabel>
# ports:
# - protocol: TCP
# port: 80
policyTypes:
- Ingress
- Egress

16
MatrixLanding/pvc.yaml Normal file
View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: matrix-landing-page-pvc
labels:
matrix-page: landing-page
matrix-page-domain: your.domain.example
spec:
# https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes-1
accessModes:
# - ReadOnlyMany
# - ReadWriteOnce
- ReadWriteMany
resources:
requests:
storage: 356Mi

View File

@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: matrix-landing-page-service
labels:
matrix-service: webclient
spec:
selector:
matrix-service: webclient
# This isn't used as Ingress is doing TLS termination
# type: LoadBalancer
type: ClusterIP
ports:
- name: matrix-landing-page-http
appProtocol: TCP
port: 80 # <- port that will be exposed

View File

@@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: matrix-server-deployment
labels:
matrix-service: server
spec:
replicas: 1
selector:
matchLabels:
matrix-service: server
template:
metadata:
labels:
matrix-service: server
spec:
containers:
- name: matrix-server
image: matrixdotorg/synapse:latest
# imagePullPolicy: IfNotPresent
ports:
- containerPort: 8008
name: http-matrix
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /_matrix/static
port: 8008
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 2
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 45
periodSeconds: 5
successThreshold: 1
httpGet:
path: /_matrix/static
port: 8008
scheme: HTTP
timeoutSeconds: 1
volumeMounts:
- name: matrix-synapse-data
mountPath: /data
volumes:
- name: matrix-synapse-data
persistentVolumeClaim:
claimName: matrix-synapse-data-pvc
readOnly: false

View File

@@ -0,0 +1,60 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: matrix-server-networkpolicy
spec:
podSelector:
matchLabels:
matrix-service: server
egress:
# Allow all egress
# - {}
- to:
- ipBlock:
# Address of a PSQL server
cidr: 1.2.3.4/32
ports:
- protocol: TCP
port: 5432
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- protocol: UDP
port: 53
- protocol: TCP
port: 53
- to:
- ipBlock:
cidr: 0.0.0.0/0
except:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
ingress:
# optional reverse proxy
# - from:
# - namespaceSelector:
# matchLabels:
# ns-name: <NS>
# podSelector:
# matchLabels:
# podDomain: <podLabel>
# ports:
# - protocol: TCP
# port: 8008
policyTypes:
- Ingress
- Egress

15
MatrixSynapse/pvc.yaml Normal file
View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: matrix-synapse-data-pvc
labels:
matrix-server-domain: example.me
spec:
# https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes-1
accessModes:
# - ReadOnlyMany
- ReadWriteOnce
# - ReadWriteMany
resources:
requests:
storage: 16Gi

View File

@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: matrix-server-service
labels:
matrix-service: server
spec:
selector:
matrix-service: server
# This isn't used as Ingress is doing TLS termination
# type: LoadBalancer
type: ClusterIP
ports:
- name: matrix-server-http
appProtocol: TCP
port: 8008 # <- port that will be exposed

View File

@@ -8,6 +8,9 @@ run ```kubectl apply -f /path/to/files/. -n <yourNameSpace>```
1. [Unbound](#Unbound)
2. [ConvertX](#ConvertX)
3. [PiHole StatefullSet](#PiHole)
4. [Matrix Synapse](#MatrixSynapse)
5. [Element](#MatrixElement)
### Unbound
@@ -58,4 +61,29 @@ What to change:
Note that dnsmasq-extra-data-pvc is for storing extra data about local domains to redirect a domain and all subdomain. It works like so
Redirect int.example.me and *.int.example.me to 4.3.2.1
Redirect int.example.me and *.int.example.me to 4.3.2.1
### MatrixSynapse
What to change:
1. in pvc.yaml change line 6 to you domain or remove that label.
2. in service.yaml set loadBalancerIP if you don't use reverse proxy.
3. in netPolicy.yaml set correct Postgresql databate address on line 17.
4. also in netPolicy.yaml adjust or remove lines 45 to 55
### MatrixElement
Here there is a bit of work to do to get everything working.
First of all download the latest [element-web](https://github.com/element-hq/element-web) version and unpack it. Thereafter configure config.json.
After doing that start temporary pod for copying over files with ``` kubectl -f copyFilesToPVCDeploy.yaml```
After it starts run ```kubectl cp ./YourElementWebFolder/ YourNameSpace/uploader-matrix-landing-page:/data/```
after that you can remove the copyFilesToPVCDeploy.yaml file and run ```kubectl apply -f /path/to/files/. -n <yourNameSpace>```