| giolekva | 56c1569 | 2021-10-20 11:44:54 +0400 | [diff] [blame] | 1 | # TODO(giolekva): cleanup volumes |
| 2 | --- |
| 3 | apiVersion: v1 |
| 4 | kind: Namespace |
| 5 | metadata: |
| 6 | name: app-matrix |
| 7 | --- |
| 8 | apiVersion: rbac.authorization.k8s.io/v1 |
| 9 | kind: Role |
| 10 | metadata: |
| 11 | creationTimestamp: null |
| 12 | name: CreateConfigMaps |
| 13 | namespace: app-matrix |
| 14 | rules: |
| 15 | - apiGroups: |
| 16 | - "" |
| 17 | resources: |
| 18 | - configmaps |
| 19 | verbs: |
| 20 | - create |
| 21 | --- |
| 22 | apiVersion: rbac.authorization.k8s.io/v1 |
| 23 | kind: RoleBinding |
| 24 | metadata: |
| 25 | creationTimestamp: null |
| 26 | name: default-CreateConfigMaps |
| 27 | namespace: app-matrix |
| 28 | roleRef: |
| 29 | apiGroup: rbac.authorization.k8s.io |
| 30 | kind: Role |
| 31 | name: CreateConfigMaps |
| 32 | subjects: |
| 33 | - kind: ServiceAccount |
| 34 | name: default |
| 35 | namespace: app-matrix |
| giolekva | 13c3ffc | 2021-09-25 17:25:26 +0400 | [diff] [blame] | 36 | --- |
| 37 | apiVersion: v1 |
| 38 | kind: Service |
| 39 | metadata: |
| 40 | name: matrix |
| 41 | namespace: app-matrix |
| 42 | spec: |
| 43 | type: ClusterIP |
| 44 | selector: |
| 45 | app: matrix |
| 46 | ports: |
| 47 | - name: http |
| 48 | port: 80 |
| 49 | targetPort: http |
| 50 | protocol: TCP |
| 51 | --- |
| 52 | apiVersion: networking.k8s.io/v1 |
| 53 | kind: Ingress |
| 54 | metadata: |
| 55 | name: ingress |
| 56 | namespace: app-matrix |
| giolekva | 56c1569 | 2021-10-20 11:44:54 +0400 | [diff] [blame] | 57 | annotations: |
| 58 | cert-manager.io/cluster-issuer: "letsencrypt-prod" |
| 59 | acme.cert-manager.io/http01-edit-in-place: "true" |
| giolekva | 13c3ffc | 2021-09-25 17:25:26 +0400 | [diff] [blame] | 60 | spec: |
| 61 | ingressClassName: nginx |
| 62 | tls: |
| 63 | - hosts: |
| 64 | - matrix.lekva.me |
| giolekva | 56c1569 | 2021-10-20 11:44:54 +0400 | [diff] [blame] | 65 | secretName: cert-matrix.lekva.me |
| giolekva | 13c3ffc | 2021-09-25 17:25:26 +0400 | [diff] [blame] | 66 | rules: |
| 67 | - host: matrix.lekva.me |
| 68 | http: |
| 69 | paths: |
| 70 | - path: / |
| 71 | pathType: Prefix |
| 72 | backend: |
| 73 | service: |
| 74 | name: matrix |
| 75 | port: |
| 76 | name: http |
| 77 | --- |
| giolekva | 56c1569 | 2021-10-20 11:44:54 +0400 | [diff] [blame] | 78 | apiVersion: batch/v1 |
| 79 | kind: Job |
| 80 | metadata: |
| 81 | name: generate-config |
| 82 | namespace: app-matrix |
| 83 | spec: |
| 84 | template: |
| 85 | metadata: |
| 86 | labels: |
| 87 | app: generate-config |
| 88 | spec: |
| 89 | restartPolicy: OnFailure |
| 90 | volumes: |
| 91 | - name: data |
| 92 | persistentVolumeClaim: |
| 93 | claimName: matrix-data |
| 94 | - name: config |
| 95 | persistentVolumeClaim: |
| 96 | claimName: matrix-config |
| 97 | - name: homeserver-config |
| 98 | persistentVolumeClaim: |
| 99 | claimName: matrix-homeserver-config |
| 100 | initContainers: |
| 101 | - name: matrix |
| 102 | image: matrixdotorg/synapse:v1.43.0 |
| 103 | imagePullPolicy: IfNotPresent |
| 104 | ports: |
| 105 | - name: http |
| 106 | containerPort: 8008 |
| 107 | protocol: TCP |
| 108 | env: |
| 109 | - name: SYNAPSE_SERVER_NAME |
| 110 | value: "lekva.me" |
| 111 | - name: SYNAPSE_REPORT_STATS |
| 112 | value: "no" |
| 113 | - name: SYNAPSE_CONFIG_DIR |
| 114 | value: "/data" |
| 115 | - name: SYNAPSE_CONFIG_PATH |
| 116 | value: "/data/homeserver.yaml" |
| 117 | - name: SYNAPSE_DATA_DIR |
| 118 | value: "/data" |
| 119 | command: ["/start.py"] |
| 120 | args: ["generate"] |
| 121 | volumeMounts: |
| 122 | - name: data |
| 123 | mountPath: /data |
| 124 | # - name: config |
| 125 | # mountPath: /matrix-config |
| 126 | - name: homeserver-config |
| 127 | mountPath: /homeserver-config |
| 128 | containers: |
| 129 | - name: capture-config |
| 130 | image: giolekva/capture-config:latest |
| 131 | imagePullPolicy: Always |
| 132 | command: ["capture-config"] |
| 133 | args: ["--config=/data/homeserver.yaml", "--namespace=app-matrix", "--config-map-name=config"] |
| 134 | volumeMounts: |
| 135 | - name: data |
| 136 | mountPath: /data |
| 137 | # - name: config |
| 138 | # mountPath: /matrix-config |
| 139 | - name: homeserver-config |
| 140 | mountPath: /homeserver-config |
| 141 | --- |
| giolekva | 13c3ffc | 2021-09-25 17:25:26 +0400 | [diff] [blame] | 142 | apiVersion: apps/v1 |
| 143 | kind: Deployment |
| 144 | metadata: |
| 145 | name: matrix |
| 146 | namespace: app-matrix |
| 147 | spec: |
| 148 | selector: |
| 149 | matchLabels: |
| 150 | app: matrix |
| 151 | replicas: 1 |
| 152 | template: |
| 153 | metadata: |
| 154 | labels: |
| 155 | app: matrix |
| 156 | spec: |
| 157 | volumes: |
| 158 | - name: data |
| 159 | persistentVolumeClaim: |
| 160 | claimName: matrix-data |
| giolekva | 56c1569 | 2021-10-20 11:44:54 +0400 | [diff] [blame] | 161 | - name: config |
| 162 | persistentVolumeClaim: |
| 163 | claimName: matrix-config |
| 164 | - name: homeserver-config |
| 165 | configMap: |
| 166 | name: config |
| giolekva | 13c3ffc | 2021-09-25 17:25:26 +0400 | [diff] [blame] | 167 | containers: |
| 168 | - name: matrix |
| 169 | image: matrixdotorg/synapse:v1.43.0 |
| 170 | imagePullPolicy: IfNotPresent |
| 171 | ports: |
| 172 | - name: http |
| 173 | containerPort: 8008 |
| 174 | protocol: TCP |
| 175 | env: |
| 176 | - name: SYNAPSE_SERVER_NAME |
| 177 | value: "lekva.me" |
| 178 | - name: SYNAPSE_REPORT_STATS |
| 179 | value: "no" |
| 180 | - name: SYNAPSE_CONFIG_DIR |
| 181 | value: "/data" |
| giolekva | 56c1569 | 2021-10-20 11:44:54 +0400 | [diff] [blame] | 182 | - name: SYNAPSE_CONFIG_PATH |
| 183 | value: "/homeserver-config/homeserver.yaml" |
| giolekva | 13c3ffc | 2021-09-25 17:25:26 +0400 | [diff] [blame] | 184 | - name: SYNAPSE_DATA_DIR |
| 185 | value: "/data" |
| giolekva | 13c3ffc | 2021-09-25 17:25:26 +0400 | [diff] [blame] | 186 | command: ["/start.py"] |
| giolekva | 13c3ffc | 2021-09-25 17:25:26 +0400 | [diff] [blame] | 187 | volumeMounts: |
| 188 | - name: data |
| 189 | mountPath: /data |
| giolekva | 56c1569 | 2021-10-20 11:44:54 +0400 | [diff] [blame] | 190 | # - name: config |
| 191 | # mountPath: /matrix-config |
| 192 | - name: homeserver-config |
| 193 | mountPath: /homeserver-config |
| 194 | readOnly: true |
| giolekva | 13c3ffc | 2021-09-25 17:25:26 +0400 | [diff] [blame] | 195 | --- |
| 196 | apiVersion: v1 |
| 197 | kind: PersistentVolumeClaim |
| 198 | metadata: |
| 199 | name: matrix-data |
| 200 | namespace: app-matrix |
| 201 | spec: |
| 202 | accessModes: |
| 203 | - ReadWriteOnce |
| 204 | resources: |
| 205 | requests: |
| giolekva | 56c1569 | 2021-10-20 11:44:54 +0400 | [diff] [blame] | 206 | storage: 10Gi |
| 207 | --- |
| 208 | apiVersion: v1 |
| 209 | kind: PersistentVolumeClaim |
| 210 | metadata: |
| 211 | name: matrix-config |
| 212 | namespace: app-matrix |
| 213 | spec: |
| 214 | accessModes: |
| 215 | - ReadWriteOnce |
| 216 | resources: |
| 217 | requests: |
| 218 | storage: 10Gi |
| 219 | --- |
| 220 | apiVersion: v1 |
| 221 | kind: PersistentVolumeClaim |
| 222 | metadata: |
| 223 | name: matrix-homeserver-config |
| 224 | namespace: app-matrix |
| 225 | spec: |
| 226 | accessModes: |
| 227 | - ReadWriteOnce |
| 228 | resources: |
| 229 | requests: |
| 230 | storage: 10Gi |