Skip to content

Commit e69af8a

Browse files
authored
Merge pull request docker-mailserver#170 from DougReeder/cert-first
Moves creating a TLS cert & values.yaml to beginning of README
2 parents 242a210 + 7db3a3b commit e69af8a

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

charts/docker-mailserver/README.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,56 @@ Kubernetes cluster. docker-mailserver is a production-ready, fullstack mail serv
3737
- A [Kubernetes](https://kubernetes.io/releases/) cluster with persistent storage and access to email [ports](https://docker-mailserver.github.io/docker-mailserver/latest/config/security/understanding-the-ports/#overview-of-email-ports)
3838
- A custom domain name (for example, example.com)
3939
- Correctly configured [DNS](https://docker-mailserver.github.io/docker-mailserver/latest/usage/#minimal-dns-setup)
40+
- [Cert Manager](https://cert-manager.io/docs/) or a similar tool to create and renew TLS certificates
4041

4142
## Getting Started
4243

4344
Setting up docker-mailserver requires generating a number of configuration [files](https://docker-mailserver.github.io/docker-mailserver/latest/config/advanced/optional-config/). To make this easier, docker-mailserver includes a `setup` command that can generate these files.
4445

45-
To get started, first add the helm repo and install docker-mailserver:
46+
To get started, first manually create a TLS Certificate, setting `metadata.name` and `spec.secretName` to the same value. Also set the fully-qualified domain name for your mail server in `spec.dnsNames` and `spec.issuerRef.name` to the name of an Issuer or ClusterIssuer, and `spec.issuerRef.kind` to `Issuer` or `ClusterIssuer`.
47+
```yaml
48+
apiVersion: cert-manager.io/v1
49+
kind: Certificate
50+
51+
metadata:
52+
name: mail-tls-certificate-rsa
53+
54+
spec:
55+
secretName: mail-tls-certificate-rsa
56+
isCA: false
57+
privateKey:
58+
algorithm: RSA
59+
encoding: PKCS1
60+
size: 2048
61+
dnsNames: [mail.example.com]
62+
issuerRef:
63+
name: letsencrypt-production
64+
kind: Issuer
65+
```
66+
```console
67+
kubectl apply -f certificate.yaml --namespace mail
68+
```
4669

70+
Then add the helm repo:
4771
```console
4872
helm repo add docker-mailserver https://docker-mailserver.github.io/docker-mailserver-helm
73+
```
4974

50-
helm upgrade --install docker-mailserver docker-mailserver/docker-mailserver --namespace mail --create-namespace
75+
Create a Helm values file. See the comments in [values.yaml](https://github.com/docker-mailserver/docker-mailserver-helm/blob/master/charts/docker-mailserver/values.yaml) to understand all the options, or create a minimal file like this (where `mail-tls-certificate-rsa` is the name of the certificate you previously created and `example.com` is the name of your domain):
76+
```yaml
77+
## Specify the name of a TLS secret that contains a certificate and private key for your email domain.
78+
## See https://kubernetes.io/docs/concepts/configuration/secret/#tls-secrets
79+
certificate: mail-tls-certificate-rsa
80+
81+
deployment:
82+
env:
83+
OVERRIDE_HOSTNAME: example.com # You must OVERRIDE this!
84+
```
85+
86+
Then install docker-mailserver using the values file:
87+
88+
```console
89+
helm upgrade --install docker-mailserver docker-mailserver/docker-mailserver --namespace mail --create-namespace -f values.yaml
5190
```
5291

5392
Next open a command prompt to the running container.

0 commit comments

Comments
 (0)