devtools/issues: add mailing support

Resolves b/15

Change-Id: I53a4057ff428219ae1d4928db74eaa2e8bda6651
This commit is contained in:
informatic 2021-02-09 10:05:59 +01:00 committed by q3k
parent 3b8f6675b1
commit 054c5b47d6
2 changed files with 40 additions and 1 deletions

View file

@ -4,7 +4,7 @@
# Bootstrap:
#
# ns=redmine
# kubectl -n $ns create secret generic redmine --from-literal=secret_key=$(pwgen 24 1) --from-literal=oidc_secret=...
# kubectl -n $ns create secret generic redmine --from-literal=secret_key=$(pwgen 24 1) --from-literal=postgres_password=$(pwgen 32 1) --from-literal=mailing_password=... --from-literal=oidc_secret=...
#
# ceph_ns=ceph-waw3; ceph_pool=waw-hdd-redundant-3
# kubectl -n $ceph_ns get secrets rook-ceph-object-user-${ceph_pool}-object-issues -o json | jq 'del(.metadata.namespace,.metadata.resourceVersion,.metadata.uid) | .metadata.creationTimestamp=null' | kubectl replace -f - -n $ns
@ -35,6 +35,13 @@ local redmine = import "./redmine.libsonnet";
clientID: "70ee2821-2657-4409-a298-98649d1f689f",
clientSecret: { secretKeyRef: { name: "redmine", key: "oidc_secret" } },
},
mailing+: {
address: "mail.hackerspace.pl",
user_name: "issues",
domain: "hackerspace.pl",
password: { secretKeyRef: { name: "redmine", key: "mailing_password" } },
},
},
},
}

View file

@ -31,8 +31,23 @@ local postgres = import "../../kube/postgres.libsonnet";
clientID: error "oidc.clientID must be set",
clientSecret: error "oidc.clientSecret must be set",
},
# Mailing configuration object passed to smtp_settings
mailing: {
address: error "mailing.address must be set",
port: 465,
ssl: true,
domain: error "mailing.domain must be set",
authentication: ":login",
user_name: error "mailing.user_name must be set",
password: error "mailing.password must be set",
},
},
# Generates YAML file while preserving specified ruby-style symbols.
# (ie. removes surrounding quotes)
rubyYaml(obj, symbols):: std.foldr(function (symbol, str) std.strReplace(str, '"%s"' % symbol, symbol), symbols, std.manifestYamlDoc(obj)),
ns: kube.Namespace(app.cfg.namespace),
postgres: postgres {
@ -59,6 +74,11 @@ local postgres = import "../../kube/postgres.libsonnet";
containers_: {
web: kube.Container("redmine") {
image: cfg.image,
args: ['sh', '-c', |||
set -e
echo "${X_EXTRA_CONFIGURATION}" > config/configuration.yml
exec /docker-entrypoint.sh rails server -b 0.0.0.0
|||],
ports_: {
http: { containerPort: 3000 },
},
@ -81,6 +101,18 @@ local postgres = import "../../kube/postgres.libsonnet";
REDMINE_S3_ACCESS_KEY_ID: cfg.storage.accessKey,
REDMINE_S3_SECRET_ACCESS_KEY: cfg.storage.secretKey,
REDMINE_S3_REGION: cfg.storage.region,
REDMINE_MAILING_PASSWORD: cfg.mailing.password,
X_EXTRA_CONFIGURATION: app.rubyYaml({
production: {
email_delivery: {
delivery_method: ":smtp",
smtp_settings: cfg.mailing {
password: "$(REDMINE_MAILING_PASSWORD)",
},
}
},
}, [":smtp", ":login"]),
},
},
},