1
0
Fork 0

Merge "devtools/issues: add mailing support"

master
informatic 2021-02-09 19:38:53 +00:00 committed by Gerrit Code Review
commit 5c08bb9197
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
@ -44,6 +44,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

@ -36,8 +36,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 {
@ -64,6 +79,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 },
},
@ -86,6 +106,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"]),
},
},
},