Merge pull request #5451 from mailcow/feat/unbound-healthcheck

[Unbound] Added Healthcheck for Unbound (Dockerfile and Compose)
This commit is contained in:
Niklas Meyer 2023-10-12 10:52:23 +02:00 committed by GitHub
commit a8bc6aff2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 3 deletions

View File

@ -18,6 +18,11 @@ EXPOSE 53/udp 53/tcp
COPY docker-entrypoint.sh /docker-entrypoint.sh COPY docker-entrypoint.sh /docker-entrypoint.sh
# healthcheck (nslookup)
COPY healthcheck.sh /healthcheck.sh
RUN chmod +x /healthcheck.sh
HEALTHCHECK --interval=30s --timeout=10s CMD [ "/healthcheck.sh" ]
ENTRYPOINT ["/docker-entrypoint.sh"] ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/sbin/unbound"] CMD ["/usr/sbin/unbound"]

View File

@ -0,0 +1,12 @@
#!/bin/bash
nslookup mailcow.email 127.0.0.1 1> /dev/null
if [ $? == 0 ]; then
echo "DNS resolution is working!"
exit 0
else
echo "DNS resolution is not working correctly..."
echo "Maybe check your outbound firewall, as it needs to resolve DNS over TCP AND UDP!"
exit 1
fi

View File

@ -61,7 +61,9 @@ services:
image: mailcow/clamd:1.62 image: mailcow/clamd:1.62
restart: always restart: always
depends_on: depends_on:
- unbound-mailcow unbound-mailcow:
condition: service_healthy
restart: true
dns: dns:
- ${IPV4_NETWORK:-172.22.1}.254 - ${IPV4_NETWORK:-172.22.1}.254
environment: environment:
@ -299,7 +301,11 @@ services:
postfix-mailcow: postfix-mailcow:
image: mailcow/postfix:1.72 image: mailcow/postfix:1.72
depends_on: depends_on:
- mysql-mailcow mysql-mailcow:
condition: service_started
unbound-mailcow:
condition: service_healthy
restart: true
volumes: volumes:
- ./data/hooks/postfix:/hooks:Z - ./data/hooks/postfix:/hooks:Z
- ./data/conf/postfix:/opt/postfix/conf:z - ./data/conf/postfix:/opt/postfix/conf:z
@ -390,7 +396,10 @@ services:
acme-mailcow: acme-mailcow:
depends_on: depends_on:
- nginx-mailcow nginx-mailcow:
condition: service_started
unbound-mailcow:
condition: service_healthy
image: mailcow/acme:1.85 image: mailcow/acme:1.85
dns: dns:
- ${IPV4_NETWORK:-172.22.1}.254 - ${IPV4_NETWORK:-172.22.1}.254
@ -461,6 +470,13 @@ services:
- postfix-vol-1:/var/spool/postfix - postfix-vol-1:/var/spool/postfix
- ./data/assets/ssl:/etc/ssl/mail/:ro,z - ./data/assets/ssl:/etc/ssl/mail/:ro,z
restart: always restart: always
depends_on:
- postfix-mailcow
- dovecot-mailcow
- mysql-mailcow
- acme-mailcow
- redis-mailcow
environment: environment:
- IPV6_NETWORK=${IPV6_NETWORK:-fd4d:6169:6c63:6f77::/64} - IPV6_NETWORK=${IPV6_NETWORK:-fd4d:6169:6c63:6f77::/64}
- LOG_LINES=${LOG_LINES:-9999} - LOG_LINES=${LOG_LINES:-9999}