From e28ec61f5da5771ac5f25c435183d19406ffb981 Mon Sep 17 00:00:00 2001 From: Josh Date: Fri, 13 Jun 2025 14:16:52 +0000 Subject: [PATCH] Update README.md --- README.md | 201 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 161 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index e1f1070..112c522 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,13 @@

+

+ + + Caddy + + +

@@ -22,7 +29,7 @@
-

Install Stalwart Mail Server and protect it with HAProxy (and Caddy)

+

Install Stalwart Mail Server and protect it with HAProxy (and Caddy) inside Docker Desktop


@@ -31,17 +38,17 @@ # Navigation - [Prerequisite](#prerequisite) -- [Install](#install) - - [Configuring docker-compose.yml file](#configuring-docker-composeyml-file) - - [Configuring stalwart.yml file](#configuring-stalwartyml-file) - - [Configuring roundcube.yml file](#configuring-roundcubeyml-file) +- [Installation](#installation) + - [docker-compose.yml file](#docker-composeyml-file) + - [stalwart.yml file](#stalwartyml-file) + - [roundcube.yml file](#roundcubeyml-file) +- [Configurations](#configurations) - [Stalwart UI First Logon and Configuration](#stalwart-ui-first-logon-and-configuration) - [Configuring Caddyfile](#configuring-caddyfile) - [Configuring haproxy.cfg file](#configuring-haproxycfg-file) - - [Configuring Stalwarts TOML file](#configuring-stalwart-toml-file) + - [Configuring Stalwarts .toml file](#configuring-stalwart-toml-file) - [Stalwart UI SSL and Domain Configuration](#stalwart-ui-ssl-and-domain-configuration) - - [Testing Mail Flow](#testint-mail-flow) -- [Finish](#finish) +- [Testing Mail Flow](#testint-mail-flow)
@@ -49,56 +56,58 @@ # Prerequisite -**Here are all the things you need to make sure you have before starting this tutorial.** +**Here are all the things you need to make sure you have before starting this tutorial. I'll eventually be adding links to other relevant tutorials that I create to assist you in completing this tutorial.** -- **1. You should already have Caddy installed and fully working.** +
-- **2. You should already have a Cloudflare account managing your domain.** +**1. You should already have Caddy installed and fully working.** -- **3. You should already have a Cloudflare API Token.** +**2. You should already have a Cloudflare account managing your domain.** -- **4. You should already have the CNAME records 'mail.yourdomain.com' & 'webmail.yourdomain.com' created.** +**3. You should already have a Cloudflare API Token.** -- **5. You should already have your Caddyfile routing 'mail.yourdomain.com' to port 8404.** +**4. You should already have the CNAME records 'mail.yourdomain.com' & 'webmail.yourdomain.com' created.** -- **6. You should already have your Caddyfile routing 'webmail.yourdomain.com' to port 680.** +**5. You should already have your Caddyfile routing 'mail.yourdomain.com' to port 8404.** -- **7. You should already have an smtp2go.com account created and setup.** +**6. You should already have your Caddyfile routing 'webmail.yourdomain.com' to port 680.** -- **8. You should use an advanced text editor like Notepadd++ or something like it that's designed for coding.** +**7. You should already have an smtp2go.com account created and setup.** -- **9. You should already have ports 25, 80, 110, 143, 443, 465, 587, 993, & 4190 opened inside your router pointing to your host machine's IP address.** +**8. You should use an advanced text editor like Notepadd++ or something like it that's designed for coding.** + +**9. You should already have ports 25, 80, 110, 143, 443, 465, 587, 993, & 4190 opened inside your router pointing to your host machine's IP address.**

-# Install - -

This tutorial will show you how to install Stalwart Mail server as well as HAProxy so you can securely host your own email server.

+# Installation
-
- -

1️⃣

- -## Configuring docker-compose.yml file +## docker-compose.yml file * **This is the docker-compose.yml file that you will use to create your container. It will be installing HAProxy and then including Stalwart and Roundcube's yml files, installing them afterwards.** +* **The container will be named "haproxy"** + * **It's always going to restart unless we manually stop it.** -* **We are mapping it to ports 25, 80, 110, 143, 443, 465, 587, 993, & 4190.** +* **It's volume where the haproxy.cfg file is located will be mapped to the current directory of the yml file.** + +* **We are adding this container to a custom network called "hap-network" that we'll create below. It's also being assigned a static IP address.** + +* **Ports 25, 80, 110, 143, 443, 465, 587, 993, & 4190 will be assigned and mapped to this container** * **We're also making HAProxy's container depend on Stalwart's container** -* **And finally we are creating a custom hao-network for these containers.** +* **And finally we are creating a custom "hap-network" for all of these containers. Read the comments in the file and make any changes if needed.**

- Docker + IMAGE GOES HERE

@@ -107,16 +116,24 @@
-

2️⃣

+## stalwart.yml file -## Configuring .env file +* **This is the stalwart.yml file. - IMPORTANT NOTE - The image was renamed by Stalwart recently so the image that we're pulling in the video is outdated. But don't worry, I updated the files that you can download.** -* **This is the .env file. Here you will want to enter your cloudflare API token as well as the email address you log into cloudflare with. This .env file will create variables that you can reference in your Caddyfile.** +* **The container will be named "stalwart"** + +* **It's always going to restart unless we manually stop it.** + +* **Port 7080 will be assigned and mapped to this container (instead of 8080 since 8080 is in use already) which is where you can access the Admin UI.** + +* **Stalwart's volume for its data files will be mapped to the current directory of the yml file.** + +* **We are adding this container to our custom "hap-network" and assign it a static IP address.**

- Docker + IMAGE GOES HERE

@@ -125,16 +142,26 @@
-

3️⃣

+## roundcube.yml file -## Configuring dockerfile.caddy file +* **This is the roundcube.yml file. It's not required but very recommended as it's a great email client container that you can use for quick testing.** -* **This is the dockerfile.caddy file that your docker-compose.yml file will use to create your custom Caddy image.** +* **The container will be named "roundcube"** + +* **It's always going to restart unless we manually stop it.** + +* **Port 680 will be assigned and mapped to this container (instead of 80 since 80 is in use already) which is where you can access the UI.** + +* **Roundcube's volumes for its database and config files will be mapped to the current directory of the yml file.** + +* **Roundcube's volumes for its database and config files will be mapped to the current directory of the yml file.** + +* **We are adding this container to our custom "hap-network".**

- Docker + IMAGE GOES HERE

@@ -143,7 +170,25 @@
-

4️⃣

+# Configurations + +
+ +## Stalwart UI First Logon and Configuration + +* **Stalwart UI First Logon and Configuration** + +

+ + + IMAGE GOES HERE + + +

+ +
+ +
## Configuring Caddyfile @@ -152,7 +197,7 @@

- Docker + IMAGE GOES HERE

@@ -161,7 +206,83 @@
-# Finish +## Configuring haproxy.cfg file + +* **Configuring haproxy.cfg file** + +

+ + + IMAGE GOES HERE + + +

+ +
+ +
+ +## Configuring Stalwarts .toml file + +* **Configuring Stalwarts .toml file** + +

+ + + IMAGE GOES HERE + + +

+ +
+ +
+ +## Stalwart UI SSL and Domain Configuration + +* **Stalwart UI SSL and Domain Configuration** + +

+ + + IMAGE GOES HERE + + +

+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# Testing Mail Flow **Once you have all of the files customized to your liking and all four of them are sitting in the same directory, you'll be ready to launch the yml file.**