Skip to content

Commit

Permalink
Merge pull request #3 from siebsie23/postal_v3
Browse files Browse the repository at this point in the history
Upgrade to postal v3
  • Loading branch information
siebsie23 authored Jul 15, 2024
2 parents 557c427 + 452bdbf commit 0766df3
Show file tree
Hide file tree
Showing 11 changed files with 268 additions and 224 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build and test docker image

on:
workflow_dispatch:
pull_request:

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build docker image
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: siebsie23/docker-postal:develop
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM docker.io/tiredofit/alpine:3.19
FROM docker.io/tiredofit/alpine:3.20
ARG POSTAL_VERSION="main"
ARG POSTAL_COMMIT="304828a"
ARG POSTAL_COMMIT="da90e75"
LABEL maintainer="Sibren van Setten (github.com/siebsie23)"
LABEL commit="$POSTAL_COMMIT"

Expand Down Expand Up @@ -35,7 +35,7 @@ RUN set -x && \
ruby-io-console \
&& \
\
gem install bundler -v 2.5.5 && \
gem install bundler -v 2.5.6 && \
\
### Fetch Source and install Ruby Dependencies
git clone --depth 1 --branch $POSTAL_VERSION https://github.com/postalserver/postal /app/ && \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
POSTAL_VERSION ?= main
POSTAL_COMMIT ?= 304828a
POSTAL_COMMIT ?= da90e75

build: # Build single image image. Usage: make build POSTAL_VERSION="postalversion"
@docker build --no-cache --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg POSTAL_VERSION="$(POSTAL_VERSION)" -t siebsie23/docker-postal:$(POSTAL_VERSION) .
Expand Down
89 changes: 41 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Docker-Postal is a Dockerfile to build a [Postal](https://github.com/postalserve
* Contains Fail2Ban for blocking repeat authentication offenders

## Prerequisites
- Required [RabbitMQ Server](https://github.com/tiredofit/docker-rabbitmq)
- Required [MariaDB Server](https://github.com/tiredofit/docker-mariadb)

## Installation
Expand Down Expand Up @@ -71,25 +70,24 @@ Be sure to view the following repositories to understand all the customizable op
| ADMIN_LNAME | Name of Admin Last Name | `Admin` |
| ADMIN_PASS | Password of Admin user | `PostalMailServer` |
#### Application Settings
| Parameter | Description | Default |
| ------------------------- | ---------------------------------------- | ------- |
| `ENABLE_TRACKING` | Enable Click Tracking `true` or `false` | `true` |
| `MAX_DELIVERY_ATTEMPTS` | Maximum Delivery Attempts before failing | `18` |
| `MAX_HOLD_EXPIRY_DAYS` | Maximum Holding days before expiring | `7` |
| `SUPPRESSION_LIST_EXPIRY` | Suppression List expiry in days | `30` |
| Parameter | Description | Default |
| ----------------------------------------- | ---------------------------------------- | ------- |
| `MAXIMUM_DELIVERY_ATTEMPTS` | Maximum Delivery Attempts before failing | `18` |
| `MAXIMUM_HOLD_EXPIRY_DAYS` | Maximum Holding days before expiring | `7` |
| `SUPPRESSION_LIST_AUTOMATIC_REMOVAL_DAYS` | Suppression List expiry in days | `30` |

#### DNS Settings
| Parameter | Description | Default |
| -------------------------- | --------------------------------------------------- | ---------------------- |
| `DNS_HOSTNAME` | Domain Name Mail Server | `example.com` |
| `DNS_MX` | MX Record Hostnames - Seperate multiple with commas | |
| `DNS_SPF` | SPF Hostname | `spf.$DNS_HOSTNAME` |
| `DNS_RETURN_PATH` | Return path Hostname | `rp.$DNS_HOSTNAME` |
| `DNS_ROUTE_DOMAIN` | `Routing Domain` | `routes.$DNS_HOSTNAME` |
| `DNS_TRACK_DOMAIN` | `Tracking Domain` | `track.$DNS_HOSTNAME` |
| `DNS_DKIM_IDENTIFIER` | DKIM Identifier | `postal` |
| `DNS_DOMAIN_VERIFY_PREFIX` | Domain verification prefix | `postal-verification` |
| `DNS_RETURN_PATH_PREFIX` | Custom Return Path Prefix | `psrp` |
| Parameter | Description | Default |
| -------------------------- | --------------------------------------------------- | --------------------------- |
| `DNS_HELO_HOSTNAME` | HELO Domain Name Mail Server | `postal.example.com` |
| `DNS_MX` | MX Record Hostnames - Seperate multiple with commas | |
| `DNS_SPF_INCLUDE` | SPF Hostname | `spf.$DNS_HELO_HOSTNAME` |
| `DNS_RETURN_PATH_DOMAIN` | Return path Hostname | `rp.$DNS_HELO_HOSTNAME` |
| `DNS_ROUTE_DOMAIN` | `Routing Domain` | `routes.$DNS_HELO_HOSTNAME` |
| `DNS_TRACK_DOMAIN` | `Tracking Domain` | `track.$DNS_HELO_HOSTNAME` |
| `DNS_DKIM_IDENTIFIER` | DKIM Identifier | `postal` |
| `DNS_DOMAIN_VERIFY_PREFIX` | Domain verification prefix | `postal-verification` |
| `DNS_RETURN_PATH_PREFIX` | Custom Return Path Prefix | `psrp` |

#### Security Settings
| Parameter | Description | Default |
Expand All @@ -101,10 +99,10 @@ Be sure to view the following repositories to understand all the customizable op
| `FAIL2BAN_MAX_RETRY` | Ban after how many tries during time period | `5` |

#### Performance Settings
| Parameter | Description | Default |
| ----------------- | ---------------------------- | ------- |
| `WORKERS_AMOUNT` | Amount of Workers | `1` |
| `WORKERS_THREADS` | Amount of Threads per worker | `4` |
| Parameter | Description | Default |
| ----------------- | ----------------------------------- | ------- |
| `WORKERS_THREADS` | Amount of Threads per worker. | `2` |
| `WEB_MAX_THREADS` | Maximum amount of webserver threads | `5` |

#### Logging Settings
| Parameter | Description | Default |
Expand All @@ -122,11 +120,6 @@ Be sure to view the following repositories to understand all the customizable op
| `DB_PASS` | Password for Above User e.g. `password` | |
| `DB_PORT` | MariaDB Server Port | `3306` |
| `DB_ROOT_PASS` | Needed for first boot - Assigns privileges to $DB_USER. This is your MariaDB Root Pass | |
| `RABBITMQ_HOST` | RabbitMQ Hostname or Container | |
| `RABBITMQ_VHOST` | RabbitMQ VHost shard | |
| `RABBITMQ_USER` | RabbitMQ Username | |
| `RABBITMQ_PASS` | RabbitMQ Password | |
| `RABBITMQ_PORT` | RabbitMQ Port | `5672` |

#### Anti Spam Settings
| Parameter | Description | Default |
Expand All @@ -146,8 +139,8 @@ Be sure to view the following repositories to understand all the customizable op

| Parameter | Description | Default |
| ------------------------ | -------------------------- | ------- |
| `SPAM_THRESHOLD` | Amount to classify as Spam | `5.0` |
| `SPAM_FAILURE_THRESHOLD` | Amount to fail as Spam | `5.0` |
| `SPAM_THRESHOLD` | Amount to classify as Spam | `5` |
| `SPAM_FAILURE_THRESHOLD` | Amount to fail as Spam | `20` |

#### Anti Virus Settings
| Parameter | Description | Default |
Expand All @@ -161,22 +154,21 @@ Be sure to view the following repositories to understand all the customizable op
| Parameter | Description | Default |
| -------------------------- | ----------------------------------------- | ------- |
| `SMTP_CLIENT_OPEN_TIMEOUT` | Timeout for an Open Connection in seconds | `30` |
| `SMTP_CLIENT_READ_TIMEOUT` | Timeout for Reading Data in seconds | `60` |
| `SMTP_CLIENT_READ_TIMEOUT` | Timeout for Reading Data in seconds | `30` |

##### Server
| Parameter | Description | Default |
| ------------------------------------ | -------------------------------------------------- | ----------------- |
| `SMTP_SERVER_ENABLE_TLS` | Enable TLS | `false` |
| `SMTP_SERVER_HELO_HOSTNAME` | What Hostname to send for HELO | `$DNS_HOSTNAME` |
| `SMTP_SERVER_LOG_CONNECTIONS` | Log SMTP Connections | `true` |
| `SMTP_SERVER_MAX_MESSAGE_SIZE` | Max message size in Megabytes | `50` |
| `SMTP_SERVER_PORT` | Listening Port for Postal Main SMTP Server | `25` |
| `SMTP_SERVER_PROXY_PROTOCOL` | Utilize Proxy Protocol | `false` |
| `SMTP_SERVER_SSL_VERSION` | SSL Versions | `SSLv23` |
| `SMTP_SERVER_STRIP_RECEIVED_HEADERS` | Strip Recieved Headers | `false` |
| `SMTP_SERVER_TLS_CERT` | TLS Cert Location (Will authgenerate if not exist) | `/certs/cert.pem` |
| `SMTP_SERVER_TLS_CIPHERS` | TLS Ciphers to use | |
| `SMTP_SERVER_TLS_KEY` | TLS Key Location (Will autogenerate if not exist) | `/certs/key.pem` |
| Parameter | Description | Default |
| ------------------------------------ | -------------------------------------------------- | -------------------- |
| `SMTP_SERVER_HOSTNAME` | SMTP Server hostname | `$DNS_HELO_HOSTNAME` |
| `SMTP_SERVER_ENABLE_TLS` | Enable TLS | `false` |
| `SMTP_SERVER_LOG_CONNECTIONS` | Log SMTP Connections | `false` |
| `SMTP_SERVER_MAX_MESSAGE_SIZE` | Max message size in Megabytes | `50` |
| `SMTP_SERVER_PORT` | Listening Port for Postal Main SMTP Server | `25` |
| `SMTP_SERVER_PROXY_PROTOCOL` | Utilize Proxy Protocol | `false` |
| `SMTP_SERVER_TLS_SSL_VERSION` | SSL Versions | `SSLv23` |
| `SMTP_SERVER_TLS_CERT` | TLS Cert Location (Will authgenerate if not exist) | `/certs/cert.pem` |
| `SMTP_SERVER_TLS_CIPHERS` | TLS Ciphers to use | |
| `SMTP_SERVER_TLS_KEY` | TLS Key Location (Will autogenerate if not exist) | `/certs/key.pem` |

##### Management System
| Parameter | Description | Default |
Expand All @@ -188,12 +180,12 @@ Be sure to view the following repositories to understand all the customizable op
| `SMTP_USER` | Username to authenticate to SMTP Server | |
| `SMTP_PASS` | Password to authenticate to SMTP Server | |

##### Relay
<!-- ##### Relay
| Parameter | Description | Default |
| --------------------- | -------------------------------------------- | ------- |
| `SMTP_RELAY_HOST` | Relay all outbound messages to this hostname | |
| `SMTP_RELAY_PORT` | SMTP Relay Port | `25` |
| `SMTP_RELAY_SSL_MODE` | Relay SSL / TLS Mode | `Auto` |
| `SMTP_RELAY_SSL_MODE` | Relay SSL / TLS Mode | `Auto` | -->

#### Other Settings
| Parameter | Description | Default |
Expand All @@ -206,11 +198,12 @@ Be sure to view the following repositories to understand all the customizable op
| `SETUP_TYPE` | Choose `AUTO` or `MANUAL` Setup type - Auto uses these environment variables | `AUTO` |
| `SIGNING_KEY_FILE` | Signing Key File | `signing.key` |
| `SIGNING_KEY_SIZE` | Signing Key Size | `1024` |
| `WEB_BIND_IP` | Bind IP for the Web Interface | `0.0.0.0` |
| `WEB_BIND_PORT` | Bind Port for the Web Interface | `5000` |
| `WEB_BIND_ADDRESS` | Bind IP for the Web Interface | `0.0.0.0` |
| `WEB_PORT` | Bind Port for the Web Interface | `5000` |
| `WEB_HOSTNAME` | Hostname for Web Interface | `postal.example.com` |
| `WEB_MAX_THREADS` | Max Threads for Web Interface | `5` |
| `WEB_PROTOCOL` | Protocol for Web Interface `http` or `https` | `http` |
| `WORKER_HEALTH_SERVER_BIND_ADDRESS` | Bind IP for the worker health server | `0.0.0.0` |
| `WORKER_HEALTH_SERVER_PORT` | Bind Port for the worker health server | `9090` |
### Networking

| Port | Description |
Expand Down
50 changes: 50 additions & 0 deletions UPGRADE-V2-TO-V3.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Upgrade guide for v2 to v3

To upgrade docker-postal from v2 to v3 there are a few small changes you have to make to your configuration.
This is split into 2 taks.

- Remove the RabbitMQ service from your docker-compose file.
- Update environment variables to the new ones in place because of the updated postal configuration file.


## Removing old containers
Open your `docker-compose.yml` and remove the `postal-rabbitmq` service block from the yml file.
If you are using the docker-compose example provided in this repository, all of the following should be removed:
```yml
postal-rabbitmq:
container_name: postal-rabbitmq
image: rabbitmq:3
environment:
- RABBITMQ_DEFAULT_USER=postal
- RABBITMQ_DEFAULT_PASS=password
- RABBITMQ_DEFAULT_VHOST=/postal
- CONTAINER_NAME=postal-rabbitmq
networks:
- services
restart: always
```
You can take a look at the updated [docker-compose.yml](examples/docker-compose.yml) in this repository as an example.
## Updating environment variables
Some existing variables have been updated, you should update them in your docker-compose.yml to prevent issues.
If a variable has been removed, the table below will show it as a `-`

| Old variable | New variable |
| ----------------------------- | ------------------------------------- |
| `DNS_HOSTNAME` | `DNS_HELO_HOSTNAME` |
| `DNS_SPF` | `DNS_SPF_INCLUDE` |
| `DNS_RETURN_PATH` | `DNS_RETURN_PATH_DOMAIN` |
| `WORKERS_AMOUNT` | - |
| - | `WEB_MAX_THREADS` |
| `RABBITMQ_HOST` | - |
| `RABBITMQ_VHOST` | - |
| `RABBITMQ_USER` | - |
| `RABBITMQ_PASS` | - |
| `RABBITMQ_PORT` | - |
| `SMTP_SERVER_HELO_HOSTNAME` | `SMTP_SERVER_HOSTNAME` |
| `SMTP_SERVER_SSL_VERSION` | `SMTP_SERVER_TLS_SSL_VERSION` |
| `WEB_BIND_IP` | `WEB_BIND_ADDRESS` |
| `WEB_BIND_PORT` | `WEB_PORT` |
| - | `WORKER_HEALTH_SERVER_BIND_ADDRESS` |
| - | `WORKER_HEALTH_SERVER_PORT` |
25 changes: 4 additions & 21 deletions examples/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,18 @@ services:
- ADMIN_LNAME=Admin
##

- RABBITMQ_HOST=postal-rabbitmq
- RABBITMQ_USER=postal
- RABBITMQ_PASS=password
- RABBITMQ_VHOST=/postal

- ENABLE_SPAMASSASSIN=true
- SPAMASSASSIN_HOST=postal-spamassassin

- ENABLE_CLAMAV=true
- CLAMAV_HOST=postal-clamav

- DNS_HOSTNAME=postal.example.com
- DNS_HELO_HOSTNAME=postal.example.com
- DNS_MX=postal.example.com
- DNS_RETURN_PATH=rp.postal.example.com
- DNS_RETURN_PATH_DOMAIN=rp.postal.example.com
- DNS_ROUTE_DOMAIN=routes.postal.example.com
- DNS_TRACK_DOMAIN=postal.example.com
- DNS_SPF=spf.postal.example.com
- DNS_SPF_INCLUDE=spf.postal.example.com
- DNS_DKIM_IDENTIFIER=postal
- DNS_DOMAIN_VERIFY_PREFIX=kd-verify

Expand All @@ -65,7 +60,7 @@ services:
- SMTP_USER= ## Fill these in after you have a working installation and server to be able to invite users
- SMTP_PASS= ##

- WEB_HOST=postal.example.com
- WEB_HOSTNAME=postal.example.com
- WEB_PROTOCOL=https

networks:
Expand Down Expand Up @@ -97,18 +92,6 @@ services:
- services
restart: always

postal-rabbitmq:
container_name: postal-rabbitmq
image: rabbitmq:3
environment:
- RABBITMQ_DEFAULT_USER=postal
- RABBITMQ_DEFAULT_PASS=password
- RABBITMQ_DEFAULT_VHOST=/postal
- CONTAINER_NAME=postal-rabbitmq
networks:
- services
restart: always

postal-clamav:
container_name: postal-clamav
image: tiredofit/clamav
Expand Down
Loading

0 comments on commit 0766df3

Please sign in to comment.