Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 1 | local kube = import "../../../kube/kube.libsonnet"; |
| 2 | |
| 3 | { |
| 4 | local app = self, |
| 5 | local cfg = app.cfg, |
| 6 | cfg:: { |
| 7 | image: error "cfg.image needs to be set", |
| 8 | storageClassName: error "cfg.storrageClassName needs to be set", |
| 9 | |
| 10 | # webDomain is the domain name at which synapse instance will run |
| 11 | webDomain: error "cfg.webDomain must be set", |
| 12 | # serverName is the server part of the MXID this homeserver will cover |
| 13 | serverName: error "cfg.serverName must be set", |
| 14 | |
| 15 | cas: { enable: false }, |
| 16 | oidc: { enable: false }, |
| 17 | |
Piotr Dobrowolski | 529e181 | 2021-02-13 19:44:37 +0100 | [diff] [blame] | 18 | appserviceWorker: false, |
| 19 | federationWorker: false, |
| 20 | |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 21 | macaroonSecretKey: error "cfg.macaroonSecretKey needs to be set", |
| 22 | registrationSharedSecret: error "cfg.registationSharedSecret needs to be set", |
| 23 | workerReplicationSecret: error "cfg.workerReplicationSecret needs to be set", |
| 24 | }, |
| 25 | |
| 26 | ns:: error "ns needs to be provided", |
| 27 | postgres:: error "postgres needs to be provided", |
| 28 | redis:: error "redis needs to be provided", |
| 29 | |
| 30 | // See matrix-ng.libsonnet for description |
| 31 | appservices:: error "appservices need to be provided", |
| 32 | |
| 33 | dataVolume: app.ns.Contain(kube.PersistentVolumeClaim("synapse-data-waw3")) { |
| 34 | spec+: { |
| 35 | storageClassName: cfg.storageClassName, |
| 36 | accessModes: [ "ReadWriteOnce" ], |
| 37 | resources: { |
| 38 | requests: { |
| 39 | storage: "50Gi", |
| 40 | }, |
| 41 | }, |
| 42 | }, |
| 43 | }, |
| 44 | |
| 45 | // homeserver.yaml that will be used to run synapse (in configMap). |
| 46 | // This is based off of //app/matrix/lib/synapse/homeserver.yaml with some fields overriden per |
| 47 | // deployment. |
| 48 | config:: (std.native("parseYaml"))(importstr "synapse/homeserver-ng.yaml")[0] { |
| 49 | server_name: cfg.serverName, |
| 50 | public_baseurl: "https://%s" % [cfg.webDomain], |
| 51 | signing_key_path: "/secrets/homeserver_signing_key", |
| 52 | app_service_config_files: [ |
| 53 | "/appservices/%s/registration.yaml" % [k] |
| 54 | for k in std.objectFields(app.appservices) |
| 55 | ], |
Piotr Dobrowolski | 529e181 | 2021-02-13 19:44:37 +0100 | [diff] [blame] | 56 | |
| 57 | notify_appservices: cfg.appserviceWorker == false, |
| 58 | |
| 59 | # FIXME(informatic) Rolling out with federationWorkers = true breaks |
| 60 | # *some* federation, needs investigation... |
| 61 | #send_federation: cfg.federationWorker == false, |
| 62 | #federation_sender_instances: if cfg.federationWorker then [ |
| 63 | # "%s-%s" % [app.federationSenderWorker.deployment.metadata.name, idx] |
| 64 | # for idx in std.range(0, app.federationSenderWorker.deployment.spec.replicas) |
| 65 | #] else [], |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 66 | } + (if cfg.cas.enable then { |
| 67 | cas_config: { |
| 68 | enabled: true, |
| 69 | server_url: "https://%s/_cas" % [cfg.webDomain], |
| 70 | service_url: "https://%s" % [cfg.webDomain], |
| 71 | }, |
Piotr Dobrowolski | 690ed45 | 2022-05-07 11:27:24 +0200 | [diff] [blame] | 72 | } else {}) + (if cfg.coturn.enable then { |
| 73 | turn_uris: [ "turn:%s?transport=udp" % cfg.coturn.config.domain, "turn:%s?transport=tcp" % cfg.coturn.config.domain ], |
| 74 | |
| 75 | # Lifetime of single TURN user credentials - 1 day, recommended by TURN REST |
| 76 | # spec, see https://datatracker.ietf.org/doc/html/draft-uberti-behave-turn-rest-00#section-2.2 |
| 77 | turn_user_lifetime: 24 * 60 * 60 * 1000, |
| 78 | turn_allow_guests: true, |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 79 | } else {}), |
| 80 | |
| 81 | configMap: app.ns.Contain(kube.ConfigMap("synapse")) { |
| 82 | data: { |
| 83 | "homeserver.yaml": std.manifestYamlDoc(app.config), |
| 84 | "log.config": importstr "synapse/log.config", |
| 85 | }, |
| 86 | }, |
| 87 | |
| 88 | // homeserver-secrets.yaml contains all the templated secret variables from |
| 89 | // base homeserver.yaml passed as yaml-encoded environment variable. |
| 90 | // $(ENVVAR)-encoded variables are resolved by Kubernetes on pod startup |
| 91 | secretsConfig:: (std.native("parseYaml"))(importstr "synapse/homeserver-secrets.yaml")[0] { |
| 92 | } + (if cfg.oidc.enable then { |
| 93 | oidc_config: cfg.oidc.config { |
| 94 | enabled: true, |
| 95 | client_secret: "$(OIDC_CLIENT_SECRET)", |
| 96 | }, |
Piotr Dobrowolski | 690ed45 | 2022-05-07 11:27:24 +0200 | [diff] [blame] | 97 | } else {}) + (if cfg.coturn.enable then { |
| 98 | turn_shared_secret: "$(TURN_SHARED_SECRET)", |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 99 | } else {}), |
| 100 | |
| 101 | # Synapse process Deployment/StatefulSet base resource. |
| 102 | SynapseWorker(name, workerType, builder):: app.ns.Contain(builder(name)) { |
| 103 | local worker = self, |
| 104 | cfg:: { |
| 105 | # Configuration customization. Can contain environment substitution |
| 106 | # syntax, as used in worker_name value. |
| 107 | localConfig: { |
| 108 | worker_app: workerType, |
| 109 | worker_name: "$(POD_NAME)", |
| 110 | |
| 111 | # The replication listener on the main synapse process. |
| 112 | worker_replication_host: "synapse-replication-master", |
| 113 | worker_replication_http_port: 9093, |
| 114 | }, |
| 115 | |
| 116 | # Mount app.dataVolume in /data |
| 117 | mountData: false, |
Piotr Dobrowolski | a8bb615 | 2022-09-13 20:37:33 +0200 | [diff] [blame] | 118 | |
| 119 | resources: { |
Serge Bazanski | f262868 | 2023-03-26 21:56:09 +0200 | [diff] [blame] | 120 | requests: { cpu: "300m", memory: "2Gi" }, |
Piotr Dobrowolski | a8bb615 | 2022-09-13 20:37:33 +0200 | [diff] [blame] | 121 | limits: { cpu: "1500m", memory: "2Gi" }, |
| 122 | }, |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 123 | }, |
| 124 | |
| 125 | spec+: { |
| 126 | replicas: 1, |
| 127 | template+: { |
| 128 | spec+: { |
| 129 | volumes_: { |
| 130 | config: kube.ConfigMapVolume(app.configMap), |
| 131 | secrets: { secret: { secretName: "synapse" } }, |
| 132 | } + { |
| 133 | [k]: { secret: { secretName: "appservice-%s-registration" % [k] } } |
| 134 | for k in std.objectFields(app.appservices) |
| 135 | } + if worker.cfg.mountData then { |
| 136 | data: kube.PersistentVolumeClaimVolume(app.dataVolume), |
| 137 | } else {}, |
| 138 | containers_: { |
| 139 | web: kube.Container("synapse") { |
| 140 | image: cfg.image, |
| 141 | command: [ |
| 142 | "/bin/sh", "-c", ||| |
| 143 | set -e |
| 144 | echo "${X_SECRETS_CONFIG}" > /tmp/secrets.yaml |
| 145 | echo "${X_LOCAL_CONFIG}" > /tmp/local.yaml |
| 146 | exec python -m ${SYNAPSE_WORKER} --config-path /conf/homeserver.yaml --config-path /tmp/secrets.yaml --config-path /tmp/local.yaml |
| 147 | ||| |
| 148 | ], |
Piotr Dobrowolski | a8bb615 | 2022-09-13 20:37:33 +0200 | [diff] [blame] | 149 | resources: worker.cfg.resources, |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 150 | ports_: { |
| 151 | http: { containerPort: 8008 }, |
| 152 | metrics: { containerPort: 9092 }, |
| 153 | replication: { containerPort: 9093 }, |
| 154 | }, |
| 155 | env_: { |
| 156 | SYNAPSE_WORKER: workerType, |
| 157 | |
| 158 | SYNAPSE_MACAROON_SECRET_KEY: cfg.macaroonSecretKey, |
| 159 | SYNAPSE_REGISTRATION_SHARED_SECRET: cfg.registrationSharedSecret, |
| 160 | WORKER_REPLICATION_SECRET: cfg.workerReplicationSecret, |
Serge Bazanski | f262868 | 2023-03-26 21:56:09 +0200 | [diff] [blame] | 161 | |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 162 | POSTGRES_PASSWORD: app.postgres.cfg.password, |
Serge Bazanski | f262868 | 2023-03-26 21:56:09 +0200 | [diff] [blame] | 163 | POSTGRES_USER: app.postgres.cfg.username, |
| 164 | POSTGRES_DB: app.postgres.cfg.database, |
| 165 | POSTGRES_HOST: app.postgres.cfg.host, |
| 166 | POSTGRES_PORT: app.postgres.cfg.port, |
| 167 | |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 168 | REDIS_PASSWORD: app.redis.cfg.password, |
| 169 | POD_NAME: { fieldRef: { fieldPath: "metadata.name" } }, |
| 170 | OIDC_CLIENT_SECRET: if cfg.oidc.enable then cfg.oidc.config.client_secret else "", |
Piotr Dobrowolski | 690ed45 | 2022-05-07 11:27:24 +0200 | [diff] [blame] | 171 | TURN_SHARED_SECRET: if cfg.coturn.enable then cfg.coturn.config.authSecret else "", |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 172 | |
| 173 | X_SECRETS_CONFIG: std.manifestYamlDoc(app.secretsConfig), |
| 174 | X_LOCAL_CONFIG: std.manifestYamlDoc(worker.cfg.localConfig), |
| 175 | }, |
| 176 | volumeMounts_: { |
| 177 | config: { mountPath: "/conf", }, |
| 178 | secrets: { mountPath: "/secrets" }, |
| 179 | } + { |
| 180 | [k]: { mountPath: "/appservices/%s" % [k] } |
| 181 | for k in std.objectFields(app.appservices) |
| 182 | } + if worker.cfg.mountData then { |
| 183 | data: { mountPath: "/data" }, |
| 184 | } else {}, |
Piotr Dobrowolski | 77af94d | 2021-09-16 22:17:58 +0200 | [diff] [blame] | 185 | readinessProbe: { |
| 186 | httpGet: { |
| 187 | path: "/health", |
| 188 | port: "http", |
| 189 | }, |
| 190 | initialDelaySeconds: 5, |
| 191 | periodSeconds: 10, |
| 192 | }, |
| 193 | livenessProbe: { |
| 194 | httpGet: { |
| 195 | path: "/health", |
| 196 | port: "http", |
| 197 | }, |
| 198 | initialDelaySeconds: 60, |
| 199 | periodSeconds: 30, |
| 200 | }, |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 201 | }, |
| 202 | }, |
| 203 | securityContext: { |
| 204 | runAsUser: 991, |
| 205 | runAsGroup: 991, |
| 206 | fsGroup: 991, |
| 207 | }, |
| 208 | }, |
| 209 | }, |
| 210 | }, |
| 211 | }, |
| 212 | |
| 213 | # Synapse main process |
| 214 | main: { |
| 215 | deployment: app.SynapseWorker("synapse", "synapse.app.homeserver", kube.Deployment) { |
| 216 | cfg+: { |
Piotr Dobrowolski | 529e181 | 2021-02-13 19:44:37 +0100 | [diff] [blame] | 217 | localConfig: { |
| 218 | # Following configuration values need to cause master |
| 219 | # process restart. |
| 220 | notify_appservices: app.config.notify_appservices, |
| 221 | # send_federation: app.config.send_federation, |
| 222 | # federation_sender_instances: app.config.federation_sender_instances, |
Piotr Dobrowolski | a8bb615 | 2022-09-13 20:37:33 +0200 | [diff] [blame] | 223 | }, |
| 224 | |
| 225 | resources+: { |
| 226 | limits+: { memory: "4Gi" }, |
| 227 | requests+: { memory: "2Gi" }, |
| 228 | }, |
Piotr Dobrowolski | 529e181 | 2021-02-13 19:44:37 +0100 | [diff] [blame] | 229 | }, |
| 230 | spec+: { |
| 231 | strategy+: { |
| 232 | rollingUpdate: { |
| 233 | maxSurge: 0, |
| 234 | maxUnavailable: 1, |
| 235 | }, |
| 236 | }, |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 237 | }, |
| 238 | }, |
| 239 | svc: app.ns.Contain(kube.Service("synapse")) { |
| 240 | target_pod:: app.main.deployment.spec.template, |
| 241 | }, |
| 242 | replicationSvc: app.ns.Contain(kube.Service("synapse-replication-master")) { |
| 243 | target_pod:: app.main.deployment.spec.template, |
| 244 | spec+: { |
| 245 | ports: [ |
| 246 | { port: 9093, name: 'replication', targetPort: 9093 }, |
| 247 | ], |
| 248 | }, |
| 249 | }, |
| 250 | }, |
| 251 | |
| 252 | genericWorker: { |
| 253 | # Synapse generic worker deployment |
| 254 | deployment: app.SynapseWorker("synapse-generic", "synapse.app.generic_worker", kube.StatefulSet) { |
| 255 | cfg+: { |
| 256 | localConfig+: { |
| 257 | worker_listeners: [{ |
| 258 | type: "http", |
| 259 | port: 8008, |
| 260 | x_forwarded: true, |
| 261 | bind_addresses: ["::"], |
| 262 | resources: [{ names: ["client", "federation"]}], |
Piotr Dobrowolski | 529e181 | 2021-02-13 19:44:37 +0100 | [diff] [blame] | 263 | }, { |
| 264 | port: 9092, |
| 265 | type: "metrics", |
| 266 | bind_address: "0.0.0.0", |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 267 | }], |
| 268 | }, |
| 269 | }, |
| 270 | }, |
| 271 | svc: app.ns.Contain(kube.Service("synapse-generic")) { |
| 272 | target_pod:: app.genericWorker.deployment.spec.template, |
| 273 | }, |
| 274 | |
| 275 | # Following paths can be handled by generic workers. |
| 276 | # See: https://github.com/matrix-org/synapse/blob/master/docs/workers.md |
Piotr Dobrowolski | 6bd5d20 | 2023-03-28 23:44:14 +0200 | [diff] [blame] | 277 | pathsList:: ||| |
| 278 | # Sync requests |
| 279 | ^/_matrix/client/(r0|v3)/sync$ |
| 280 | ^/_matrix/client/(api/v1|r0|v3)/events$ |
| 281 | ^/_matrix/client/(api/v1|r0|v3)/initialSync$ |
| 282 | ^/_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync$ |
Piotr Dobrowolski | 7d0e56c | 2022-04-30 00:25:39 +0200 | [diff] [blame] | 283 | |
Piotr Dobrowolski | 6bd5d20 | 2023-03-28 23:44:14 +0200 | [diff] [blame] | 284 | # Federation requests |
| 285 | ^/_matrix/federation/v1/event/ |
| 286 | ^/_matrix/federation/v1/state/ |
| 287 | ^/_matrix/federation/v1/state_ids/ |
| 288 | ^/_matrix/federation/v1/backfill/ |
| 289 | ^/_matrix/federation/v1/get_missing_events/ |
| 290 | ^/_matrix/federation/v1/publicRooms |
| 291 | ^/_matrix/federation/v1/query/ |
| 292 | ^/_matrix/federation/v1/make_join/ |
| 293 | ^/_matrix/federation/v1/make_leave/ |
| 294 | ^/_matrix/federation/(v1|v2)/send_join/ |
| 295 | ^/_matrix/federation/(v1|v2)/send_leave/ |
| 296 | ^/_matrix/federation/(v1|v2)/invite/ |
| 297 | ^/_matrix/federation/v1/event_auth/ |
Piotr Dobrowolski | 926252c | 2023-03-28 23:58:20 +0200 | [diff] [blame] | 298 | ^/_matrix/federation/v1/timestamp_to_event/ |
Piotr Dobrowolski | 6bd5d20 | 2023-03-28 23:44:14 +0200 | [diff] [blame] | 299 | ^/_matrix/federation/v1/exchange_third_party_invite/ |
| 300 | ^/_matrix/federation/v1/user/devices/ |
Piotr Dobrowolski | 6bd5d20 | 2023-03-28 23:44:14 +0200 | [diff] [blame] | 301 | ^/_matrix/key/v2/query |
Piotr Dobrowolski | 926252c | 2023-03-28 23:58:20 +0200 | [diff] [blame] | 302 | ^/_matrix/federation/v1/hierarchy/ |
Piotr Dobrowolski | 6bd5d20 | 2023-03-28 23:44:14 +0200 | [diff] [blame] | 303 | |
| 304 | # Inbound federation transaction request |
| 305 | ^/_matrix/federation/v1/send/ |
| 306 | |
| 307 | # Client API requests |
| 308 | ^/_matrix/client/(api/v1|r0|v3|unstable)/createRoom$ |
| 309 | ^/_matrix/client/(api/v1|r0|v3|unstable)/publicRooms$ |
| 310 | ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/joined_members$ |
| 311 | ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/context/.*$ |
| 312 | ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/members$ |
| 313 | ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state$ |
Piotr Dobrowolski | 926252c | 2023-03-28 23:58:20 +0200 | [diff] [blame] | 314 | ^/_matrix/client/v1/rooms/.*/hierarchy$ |
| 315 | ^/_matrix/client/(v1|unstable)/rooms/.*/relations/ |
| 316 | ^/_matrix/client/v1/rooms/.*/threads$ |
| 317 | ^/_matrix/client/unstable/org.matrix.msc2716/rooms/.*/batch_send$ |
Piotr Dobrowolski | 6bd5d20 | 2023-03-28 23:44:14 +0200 | [diff] [blame] | 318 | ^/_matrix/client/unstable/im.nheko.summary/rooms/.*/summary$ |
| 319 | ^/_matrix/client/(r0|v3|unstable)/account/3pid$ |
Piotr Dobrowolski | 926252c | 2023-03-28 23:58:20 +0200 | [diff] [blame] | 320 | ^/_matrix/client/(r0|v3|unstable)/account/whoami$ |
Piotr Dobrowolski | 6bd5d20 | 2023-03-28 23:44:14 +0200 | [diff] [blame] | 321 | ^/_matrix/client/(r0|v3|unstable)/devices$ |
| 322 | ^/_matrix/client/versions$ |
| 323 | ^/_matrix/client/(api/v1|r0|v3|unstable)/voip/turnServer$ |
Piotr Dobrowolski | 6bd5d20 | 2023-03-28 23:44:14 +0200 | [diff] [blame] | 324 | ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/event/ |
| 325 | ^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms$ |
Piotr Dobrowolski | 926252c | 2023-03-28 23:58:20 +0200 | [diff] [blame] | 326 | ^/_matrix/client/v1/rooms/.*/timestamp_to_event$ |
Piotr Dobrowolski | 6bd5d20 | 2023-03-28 23:44:14 +0200 | [diff] [blame] | 327 | ^/_matrix/client/(api/v1|r0|v3|unstable)/search$ |
Piotr Dobrowolski | 926252c | 2023-03-28 23:58:20 +0200 | [diff] [blame] | 328 | ^/_matrix/client/(r0|v3|unstable)/user/.*/filter(/|$) |
Piotr Dobrowolski | 6bd5d20 | 2023-03-28 23:44:14 +0200 | [diff] [blame] | 329 | |
| 330 | # Encryption requests |
| 331 | ^/_matrix/client/(r0|v3|unstable)/keys/query$ |
| 332 | ^/_matrix/client/(r0|v3|unstable)/keys/changes$ |
| 333 | ^/_matrix/client/(r0|v3|unstable)/keys/claim$ |
| 334 | ^/_matrix/client/(r0|v3|unstable)/room_keys/ |
Piotr Dobrowolski | 926252c | 2023-03-28 23:58:20 +0200 | [diff] [blame] | 335 | ^/_matrix/client/(r0|v3|unstable)/keys/upload/ |
Piotr Dobrowolski | 6bd5d20 | 2023-03-28 23:44:14 +0200 | [diff] [blame] | 336 | |
| 337 | # Registration/login requests |
| 338 | ^/_matrix/client/(api/v1|r0|v3|unstable)/login$ |
| 339 | ^/_matrix/client/(r0|v3|unstable)/register$ |
| 340 | ^/_matrix/client/v1/register/m.login.registration_token/validity$ |
| 341 | |
| 342 | # Event sending requests |
| 343 | ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/redact |
| 344 | ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/send |
| 345 | ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state/ |
| 346 | ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)$ |
| 347 | ^/_matrix/client/(api/v1|r0|v3|unstable)/join/ |
Piotr Dobrowolski | 926252c | 2023-03-28 23:58:20 +0200 | [diff] [blame] | 348 | ^/_matrix/client/(api/v1|r0|v3|unstable)/knock/ |
Piotr Dobrowolski | 6bd5d20 | 2023-03-28 23:44:14 +0200 | [diff] [blame] | 349 | ^/_matrix/client/(api/v1|r0|v3|unstable)/profile/ |
| 350 | |
Piotr Dobrowolski | 6bd5d20 | 2023-03-28 23:44:14 +0200 | [diff] [blame] | 351 | # Account data requests |
| 352 | #^/_matrix/client/(r0|v3|unstable)/.*/tags |
| 353 | #^/_matrix/client/(r0|v3|unstable)/.*/account_data |
| 354 | |
| 355 | # Receipts requests |
| 356 | #^/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt |
| 357 | #^/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers |
| 358 | |
| 359 | # Presence requests |
| 360 | #^/_matrix/client/(api/v1|r0|v3|unstable)/presence/ |
Piotr Dobrowolski | 926252c | 2023-03-28 23:58:20 +0200 | [diff] [blame] | 361 | |
| 362 | # User directory search requests |
| 363 | #^/_matrix/client/(r0|v3|unstable)/user_directory/search$ |
Piotr Dobrowolski | 6bd5d20 | 2023-03-28 23:44:14 +0200 | [diff] [blame] | 364 | |||, |
| 365 | |
| 366 | paths:: std.filterMap( |
| 367 | # Ignore comments and empty lines |
| 368 | function(v) !std.startsWith(v, '#') && std.length(v) > 1, |
| 369 | # Strip leading ^ |
| 370 | function(v) std.substr(v, 1, std.length(v) - 1), |
| 371 | std.split(self.pathsList, "\n") |
| 372 | ), |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 373 | }, |
| 374 | |
| 375 | # Synapse media worker. This handles access to uploads and media stored in app.dataVolume |
| 376 | mediaWorker: { |
| 377 | deployment: app.SynapseWorker("synapse-media", "synapse.app.media_repository", kube.StatefulSet) { |
| 378 | cfg+: { |
| 379 | mountData: true, |
| 380 | localConfig+: { |
| 381 | worker_listeners: [{ |
| 382 | type: "http", |
| 383 | port: 8008, |
| 384 | x_forwarded: true, |
| 385 | bind_addresses: ["::"], |
| 386 | resources: [{ names: ["media"]}], |
Piotr Dobrowolski | 529e181 | 2021-02-13 19:44:37 +0100 | [diff] [blame] | 387 | }, { |
| 388 | port: 9092, |
| 389 | type: "metrics", |
| 390 | bind_address: "0.0.0.0", |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 391 | }], |
| 392 | }, |
| 393 | }, |
| 394 | }, |
| 395 | svc: app.ns.Contain(kube.Service("synapse-media")) { |
| 396 | target_pod:: app.mediaWorker.deployment.spec.template, |
| 397 | }, |
| 398 | }, |
Piotr Dobrowolski | 529e181 | 2021-02-13 19:44:37 +0100 | [diff] [blame] | 399 | |
| 400 | appserviceWorker: if cfg.appserviceWorker then { |
| 401 | # Worker responsible for sending traffic to registered appservices |
| 402 | deployment: app.SynapseWorker("synapse-appservice", "synapse.app.appservice", kube.StatefulSet) { |
| 403 | cfg+: { |
| 404 | localConfig+: { |
| 405 | worker_listeners: [{ |
| 406 | type: "http", |
| 407 | port: 8008, |
| 408 | x_forwarded: true, |
| 409 | bind_addresses: ["::"], |
| 410 | resources: [{ names: [] }], |
| 411 | }, { |
| 412 | port: 9092, |
| 413 | type: "metrics", |
| 414 | bind_address: "0.0.0.0", |
| 415 | }], |
| 416 | }, |
| 417 | }, |
| 418 | }, |
| 419 | } else null, |
| 420 | |
| 421 | federationSenderWorker: if cfg.federationWorker then { |
| 422 | deployment: app.SynapseWorker("synapse-federation-sender", "synapse.app.federation_sender", kube.StatefulSet) { |
| 423 | cfg+: { |
| 424 | localConfig+: { |
| 425 | worker_listeners: [{ |
| 426 | type: "http", |
| 427 | port: 8008, |
| 428 | x_forwarded: true, |
| 429 | bind_addresses: ["::"], |
| 430 | resources: [{ names: [] }], |
| 431 | }, { |
| 432 | port: 9092, |
| 433 | type: "metrics", |
| 434 | bind_address: "0.0.0.0", |
| 435 | }], |
| 436 | }, |
| 437 | }, |
| 438 | spec+: { |
| 439 | replicas: 2, |
| 440 | }, |
| 441 | }, |
| 442 | } else null, |
Piotr Dobrowolski | b67ae48 | 2021-01-31 10:35:38 +0100 | [diff] [blame] | 443 | } |