Matthias Andreas Benkard | 6f77fad | 2021-01-02 13:14:07 +0100 | [diff] [blame] | 1 | = Mailcow on Kubernetes |
| 2 | Matthias Andreas Benkard |
| 3 | :experimental: |
| 4 | :data-uri: |
| 5 | :sectnums: |
| 6 | :toc: |
| 7 | :stem: |
| 8 | :toclevels: 2 |
| 9 | :icons: font |
| 10 | :source-highlighter: prettify |
| 11 | |
| 12 | == Description |
| 13 | |
| 14 | This directory contains a distribution of https://mailcow.github.io/mailcow-dockerized-docs/[*Mailcow*] |
| 15 | that you can run in a https://matthias.benkard.de/posts/814[*Kata container*] as part of a *Kubernetes cluster*. |
| 16 | |
| 17 | The main artifact provided is a Docker image, meant to run in a Kata container, which embeds its own |
| 18 | https://www.docker.com[Docker daemon] and copies of https://docs.docker.com/compose/[docker-compose] and a very slightly patched |
| 19 | https://github.com/mailcow/mailcow-dockerized/[mailcow-dockerized]. |
| 20 | |
| 21 | == Usage |
| 22 | |
| 23 | === Building the Docker image |
| 24 | |
| 25 | The main Docker image that you can run in the cluster is defined in link:default.nix[]. |
| 26 | To build it, you can either go through the regular procedure of |
| 27 | https://nixos.org/guides/building-and-running-docker-images.html[building Docker images with Nix] |
| 28 | or make use of the top-level link:../Makefile[Makefile]: |
| 29 | |
| 30 | [source,shell script] |
| 31 | ---- |
| 32 | make mailcow.load |
| 33 | ---- |
| 34 | |
| 35 | After building and loading the image, push it to the registry of your choice. |
| 36 | |
| 37 | === Deploying to Kubernetes |
| 38 | |
| 39 | First, create a *configuration file* as explained in the https://mailcow.github.io/mailcow-dockerized-docs/i_u_m_install/[Mailcow installation howto] and deploy the configuration as a *Kubernetes secret*: |
| 40 | |
| 41 | [source,shell script] |
| 42 | ---- |
| 43 | kubectl create secret generic mailcow-secrets \ |
| 44 | --from-file=mailcow.conf=src/mailcow-dockerized/mailcow.conf |
| 45 | ---- |
| 46 | |
| 47 | You can then use the provided link:mailcow.yaml[] file to perform the *deployment*. |
| 48 | Be sure to change the *image name* to the image you built above. |
| 49 | You probably also want to adjust the *namespace* unless a namespace named `mulk` makes sense to you. |
| 50 | |
| 51 | === Updating Mailcow |
| 52 | |
Matthias Andreas Benkard | 92bb80e | 2021-01-02 15:56:52 +0100 | [diff] [blame] | 53 | Updating should usually be as easy as *synchronizing* the link:src/mailcow-dockerized/[] subrepo with *upstream* and then <<Building the Docker image,rebuilding the image>>. |
Matthias Andreas Benkard | 6f77fad | 2021-01-02 13:14:07 +0100 | [diff] [blame] | 54 | |
Matthias Andreas Benkard | 92bb80e | 2021-01-02 15:56:52 +0100 | [diff] [blame] | 55 | To synchronize the subrepo, use https://github.com/ingydotnet/git-subrepo[`git subrepo`]: |
Matthias Andreas Benkard | 6f77fad | 2021-01-02 13:14:07 +0100 | [diff] [blame] | 56 | |
| 57 | [source,shell script] |
| 58 | ---- |
Matthias Andreas Benkard | 92bb80e | 2021-01-02 15:56:52 +0100 | [diff] [blame] | 59 | git subrepo pull mailcow/src/mailcow-dockerized |
Matthias Andreas Benkard | 6f77fad | 2021-01-02 13:14:07 +0100 | [diff] [blame] | 60 | ---- |