2021-01-31 17:57:21 +00:00
|
|
|
local matrix = import "lib/matrix-ng.libsonnet";
|
2020-11-03 18:17:25 +00:00
|
|
|
local irc = import "lib/appservice-irc.libsonnet";
|
|
|
|
local telegram = import "lib/appservice-telegram.libsonnet";
|
2023-03-01 20:17:25 +00:00
|
|
|
local kube = import "../../kube/kube.libsonnet";
|
2020-11-03 18:17:25 +00:00
|
|
|
|
|
|
|
matrix {
|
|
|
|
local app = self,
|
|
|
|
local cfg = app.cfg,
|
|
|
|
cfg+:: {
|
|
|
|
namespace: "matrix",
|
|
|
|
webDomain: "matrix.hackerspace.pl",
|
|
|
|
serverName: "hackerspace.pl",
|
2023-10-05 20:43:38 +00:00
|
|
|
admins: ["@informatic:hackerspace.pl", "@q3k:hackerspace.pl"],
|
2021-01-31 17:57:21 +00:00
|
|
|
oidc+: {
|
2020-11-03 21:04:06 +00:00
|
|
|
enable: true,
|
2021-01-31 17:57:21 +00:00
|
|
|
config+: {
|
|
|
|
allow_existing_users: true,
|
|
|
|
issuer: "https://sso.hackerspace.pl",
|
|
|
|
client_id: "matrix",
|
|
|
|
client_secret: { secretKeyRef: { name: "oauth2-cas-proxy", key: "oauth2_secret" } },
|
|
|
|
user_profile_method: "userinfo_endpoint",
|
2022-04-27 01:39:36 +00:00
|
|
|
userinfo_endpoint: "https://sso.hackerspace.pl/api/1/userinfo",
|
2021-01-31 17:57:21 +00:00
|
|
|
client_auth_method: "client_secret_post",
|
2022-04-27 01:39:36 +00:00
|
|
|
scopes: ["profile:read"],
|
2020-11-10 21:07:30 +00:00
|
|
|
},
|
2020-11-03 21:04:06 +00:00
|
|
|
},
|
2021-09-15 19:27:42 +00:00
|
|
|
mediaRepo+: {
|
|
|
|
enable: true,
|
2021-09-16 11:07:54 +00:00
|
|
|
route: true,
|
2021-09-15 19:27:42 +00:00
|
|
|
s3+: {
|
|
|
|
endpoint: std.strReplace((import "secrets/plain/media-repo-matrix-ceph.json").Endpoint, "http://", ""),
|
|
|
|
accessKey: (import "secrets/plain/media-repo-matrix-ceph.json").AccessKey,
|
|
|
|
secretKey: (import "secrets/plain/media-repo-matrix-ceph.json").SecretKey,
|
|
|
|
bucketName: "media-repo-matrix",
|
|
|
|
region: "eu",
|
|
|
|
},
|
|
|
|
db+: {
|
|
|
|
password: std.strReplace(importstr "secrets/plain/media-repo-matrix-postgres", "\n", ""),
|
2023-03-26 19:56:09 +00:00
|
|
|
host: "bc01n05.hswaw.net",
|
2021-09-15 19:27:42 +00:00
|
|
|
},
|
|
|
|
},
|
2022-05-07 09:27:24 +00:00
|
|
|
coturn+: {
|
|
|
|
enable: true,
|
|
|
|
config+: {
|
|
|
|
domain: "turn.hackerspace.pl",
|
|
|
|
loadBalancerIP: "185.236.240.59",
|
|
|
|
},
|
|
|
|
},
|
2023-03-26 19:56:09 +00:00
|
|
|
|
|
|
|
postgres+: {
|
|
|
|
enable: false,
|
|
|
|
host: "bc01n05.hswaw.net",
|
|
|
|
},
|
2020-11-03 18:17:25 +00:00
|
|
|
},
|
|
|
|
|
2021-02-06 10:55:34 +00:00
|
|
|
riot+: {
|
|
|
|
config+: {
|
|
|
|
showLabsSettings: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2021-09-14 17:59:37 +00:00
|
|
|
synapse+: {
|
2021-02-13 18:44:37 +00:00
|
|
|
cfg+: {
|
2023-03-28 21:53:25 +00:00
|
|
|
appserviceWorker: false,
|
2021-02-13 18:44:37 +00:00
|
|
|
federationWorker: false,
|
|
|
|
},
|
|
|
|
|
|
|
|
config+: {
|
|
|
|
federation_metrics_domains: ["matrix.org", "evolved.systems", "narupo.pl", "staging-matrix.inf.re"]
|
|
|
|
},
|
|
|
|
|
2021-09-16 20:17:58 +00:00
|
|
|
genericWorker+: {
|
|
|
|
deployment+: {
|
|
|
|
spec+: {
|
|
|
|
replicas: 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// Synapse media worker has been replaced by matrix-media-repo deployment
|
2021-09-14 17:59:37 +00:00
|
|
|
mediaWorker+: {
|
|
|
|
deployment+: {
|
|
|
|
spec+: {
|
2021-09-16 11:07:54 +00:00
|
|
|
replicas: 0,
|
2021-09-14 17:59:37 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-03-01 20:17:25 +00:00
|
|
|
// local changes
|
|
|
|
main+: {
|
|
|
|
deployment+: {
|
|
|
|
cfg+: {
|
|
|
|
resources+: {
|
|
|
|
limits+: { cpu: "2", memory: "8Gi" },
|
|
|
|
requests+: { cpu: "2", memory: "8Gi" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-09-14 17:59:37 +00:00
|
|
|
},
|
|
|
|
|
2020-11-03 18:17:25 +00:00
|
|
|
appservices: {
|
|
|
|
"irc-freenode": irc.AppServiceIrc("freenode") {
|
|
|
|
cfg+: {
|
2020-11-03 21:04:06 +00:00
|
|
|
image: cfg.images.appserviceIRC,
|
2021-01-22 15:26:07 +00:00
|
|
|
storageClassName: "waw-hdd-redundant-3",
|
2020-11-03 18:17:25 +00:00
|
|
|
metadata: app.metadata("appservice-irc-freenode"),
|
|
|
|
// TODO(q3k): add labels to blessed nodes
|
|
|
|
nodeSelector: {
|
2023-10-09 20:27:02 +00:00
|
|
|
"kubernetes.io/hostname": "dcr01s24.hswaw.net",
|
2020-11-03 18:17:25 +00:00
|
|
|
},
|
2021-05-19 16:07:30 +00:00
|
|
|
bootstrapJob: false,
|
2020-11-03 18:17:25 +00:00
|
|
|
config+: {
|
|
|
|
homeserver+: {
|
|
|
|
url: "https://%s" % [cfg.webDomain],
|
|
|
|
domain: "%s" % [cfg.serverName],
|
|
|
|
},
|
|
|
|
ircService+: {
|
2021-05-19 16:32:20 +00:00
|
|
|
permissions: {
|
|
|
|
"@q3k:hackerspace.pl": "admin",
|
|
|
|
"@informatic:hackerspace.pl": "admin",
|
|
|
|
},
|
2021-05-24 11:53:18 +00:00
|
|
|
ident: {
|
|
|
|
enabled: true,
|
|
|
|
port: 1113,
|
|
|
|
},
|
2020-11-03 18:17:25 +00:00
|
|
|
servers+: {
|
2021-05-26 19:42:47 +00:00
|
|
|
local servers = self,
|
2020-11-03 18:17:25 +00:00
|
|
|
"irc.freenode.net"+: {
|
2021-06-06 12:50:37 +00:00
|
|
|
mappings+: {},
|
2020-11-03 18:17:25 +00:00
|
|
|
ircClients+: {
|
|
|
|
maxClients: 150,
|
|
|
|
},
|
|
|
|
},
|
2021-05-26 19:42:47 +00:00
|
|
|
"irc.libera.chat": servers["irc.freenode.net"] {
|
2021-06-06 12:50:37 +00:00
|
|
|
mappings+: import "secrets/plain/appservice-irc-libera-mappings.jsonnet",
|
2021-05-26 19:42:47 +00:00
|
|
|
ircClients+: {
|
2021-06-06 12:50:37 +00:00
|
|
|
maxClients: 150,
|
2021-05-26 19:42:47 +00:00
|
|
|
},
|
|
|
|
name: "Libera Chat",
|
|
|
|
networkId: "libera",
|
|
|
|
dynamicChannels+: {
|
|
|
|
groupId: "+libera:hackerspace.pl",
|
|
|
|
aliasTemplate: "#libera_$CHANNEL",
|
|
|
|
},
|
|
|
|
matrixClients+: {
|
|
|
|
userTemplate:"@libera_$NICK",
|
|
|
|
},
|
|
|
|
},
|
2020-11-03 18:17:25 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-02-13 19:17:33 +00:00
|
|
|
passwordEncryptionKeySecret: "appservice-irc-password-encryption-key",
|
2020-11-03 18:17:25 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
"telegram-prod": telegram.AppServiceTelegram("prod") {
|
|
|
|
cfg+: {
|
2020-11-03 21:04:06 +00:00
|
|
|
image: cfg.images.appserviceTelegram,
|
2020-11-03 18:17:25 +00:00
|
|
|
storageClassName: cfg.storageClassName,
|
|
|
|
metadata: app.metadata("appservice-telegram-prod"),
|
2021-05-19 16:07:30 +00:00
|
|
|
bootstrapJob: false,
|
2020-11-03 18:17:25 +00:00
|
|
|
|
|
|
|
config+: {
|
|
|
|
homeserver+: {
|
|
|
|
address: "https://%s" % [cfg.webDomain],
|
|
|
|
domain: cfg.serverName,
|
|
|
|
},
|
|
|
|
appservice+: {
|
|
|
|
id: "telegram",
|
|
|
|
},
|
|
|
|
telegram+: {
|
|
|
|
api_id: (std.split(importstr "secrets/plain/appservice-telegram-prod-api-id", "\n"))[0],
|
|
|
|
api_hash: (std.split(importstr "secrets/plain/appservice-telegram-prod-api-hash", "\n"))[0],
|
|
|
|
bot_token: (std.split(importstr "secrets/plain/appservice-telegram-prod-token", "\n"))[0],
|
|
|
|
},
|
|
|
|
bridge+: {
|
|
|
|
permissions+: {
|
|
|
|
"hackerspace.pl": "puppeting",
|
|
|
|
"@q3k:hackerspace.pl": "admin",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|