Simplify docker usage, HOSTNAME variable is taken from container hostname
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Bug: https://github.com/happyDomain/happydeliver/issues/3
This commit is contained in:
parent
3e76692448
commit
016ed7180e
4 changed files with 11 additions and 10 deletions
|
|
@ -37,7 +37,7 @@ git clone https://git.nemunai.re/happyDomain/happyDeliver.git
|
||||||
cd happydeliver
|
cd happydeliver
|
||||||
|
|
||||||
# Edit docker-compose.yml to set your domain
|
# Edit docker-compose.yml to set your domain
|
||||||
# Change HAPPYDELIVER_DOMAIN and HOSTNAME environment variables
|
# Change HAPPYDELIVER_DOMAIN environment variable and hostname
|
||||||
|
|
||||||
# Build and start
|
# Build and start
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
|
|
@ -63,7 +63,7 @@ docker run -d \
|
||||||
-p 25:25 \
|
-p 25:25 \
|
||||||
-p 8080:8080 \
|
-p 8080:8080 \
|
||||||
-e HAPPYDELIVER_DOMAIN=yourdomain.com \
|
-e HAPPYDELIVER_DOMAIN=yourdomain.com \
|
||||||
-e HOSTNAME=mail.yourdomain.com \
|
--hostname mail.yourdomain.com \
|
||||||
-v $(pwd)/data:/var/lib/happydeliver \
|
-v $(pwd)/data:/var/lib/happydeliver \
|
||||||
-v $(pwd)/logs:/var/log/happydeliver \
|
-v $(pwd)/logs:/var/log/happydeliver \
|
||||||
happydeliver:latest
|
happydeliver:latest
|
||||||
|
|
@ -94,9 +94,9 @@ docker run -d \
|
||||||
-p 25:25 \
|
-p 25:25 \
|
||||||
-p 8080:8080 \
|
-p 8080:8080 \
|
||||||
-e HAPPYDELIVER_DOMAIN=yourdomain.com \
|
-e HAPPYDELIVER_DOMAIN=yourdomain.com \
|
||||||
-e HOSTNAME=mail.yourdomain.com \
|
|
||||||
-e POSTFIX_CERT_FILE=/etc/ssl/certs/mail.yourdomain.com.crt \
|
-e POSTFIX_CERT_FILE=/etc/ssl/certs/mail.yourdomain.com.crt \
|
||||||
-e POSTFIX_KEY_FILE=/etc/ssl/private/mail.yourdomain.com.key \
|
-e POSTFIX_KEY_FILE=/etc/ssl/private/mail.yourdomain.com.key \
|
||||||
|
--hostname mail.yourdomain.com \
|
||||||
-v /path/to/your/certificate.crt:/etc/ssl/certs/mail.yourdomain.com.crt:ro \
|
-v /path/to/your/certificate.crt:/etc/ssl/certs/mail.yourdomain.com.crt:ro \
|
||||||
-v /path/to/your/private.key:/etc/ssl/private/mail.yourdomain.com.key:ro \
|
-v /path/to/your/private.key:/etc/ssl/private/mail.yourdomain.com.key:ro \
|
||||||
-v $(pwd)/data:/var/lib/happydeliver \
|
-v $(pwd)/data:/var/lib/happydeliver \
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,12 @@ services:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
image: happydomain/happydeliver:latest
|
image: happydomain/happydeliver:latest
|
||||||
container_name: happydeliver
|
container_name: happydeliver
|
||||||
|
# Set a hostname
|
||||||
hostname: mail.happydeliver.local
|
hostname: mail.happydeliver.local
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
# Set your domain and hostname
|
# Set your domain
|
||||||
DOMAIN: happydeliver.local
|
HAPPYDELIVER_DOMAIN: happydeliver.local
|
||||||
HOSTNAME: mail.happydeliver.local
|
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
# SMTP port
|
# SMTP port
|
||||||
|
|
|
||||||
|
|
@ -109,12 +109,13 @@ Default configuration for the Docker environment:
|
||||||
|
|
||||||
The container accepts these environment variables:
|
The container accepts these environment variables:
|
||||||
|
|
||||||
- `DOMAIN`: Email domain for test addresses (default: happydeliver.local)
|
- `HAPPYDELIVER_DOMAIN`: Email domain for test addresses (default: happydeliver.local)
|
||||||
- `HOSTNAME`: Container hostname (default: mail.happydeliver.local)
|
|
||||||
|
Note that the hostname of the container is used to filter the authentication tests results.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```bash
|
```bash
|
||||||
docker run -e DOMAIN=example.com -e HOSTNAME=mail.example.com ...
|
docker run -e HAPPYDELIVER_DOMAIN=example.com --hostname mail.example.com ...
|
||||||
```
|
```
|
||||||
|
|
||||||
## Volumes
|
## Volumes
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ set -e
|
||||||
echo "Starting happyDeliver container..."
|
echo "Starting happyDeliver container..."
|
||||||
|
|
||||||
# Get environment variables with defaults
|
# Get environment variables with defaults
|
||||||
HOSTNAME="${HOSTNAME:-mail.happydeliver.local}"
|
[ -n "${HOSTNAME}" ] || HOSTNAME=$(hostname)
|
||||||
HAPPYDELIVER_DOMAIN="${HAPPYDELIVER_DOMAIN:-happydeliver.local}"
|
HAPPYDELIVER_DOMAIN="${HAPPYDELIVER_DOMAIN:-happydeliver.local}"
|
||||||
|
|
||||||
echo "Hostname: $HOSTNAME"
|
echo "Hostname: $HOSTNAME"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue