Skip to content
Snippets Groups Projects
Commit 83c389df authored by Dan Notestein's avatar Dan Notestein
Browse files

Add the ability to get email notifications when haproxy detects a service

going down
parent a18e22f1
No related branches found
No related tags found
2 merge requests!66Merge develop to master for release,!37Add the ability to get email notifications when haproxy detects a service going down
...@@ -7,15 +7,41 @@ services: ...@@ -7,15 +7,41 @@ services:
SYNC_BROADCAST_BACKEND_SERVER: "${SYNC_BROADCAST_BACKEND_SERVER:-api.hive.blog}" SYNC_BROADCAST_BACKEND_SERVER: "${SYNC_BROADCAST_BACKEND_SERVER:-api.hive.blog}"
SYNC_BROADCAST_BACKEND_PORT: "${SYNC_BROADCAST_BACKEND_PORT:-443}" SYNC_BROADCAST_BACKEND_PORT: "${SYNC_BROADCAST_BACKEND_PORT:-443}"
SYNC_BROADCAST_BACKEND_SSL: "${SYNC_BROADCAST_BACKEND_SSL:-ssl}" SYNC_BROADCAST_BACKEND_SSL: "${SYNC_BROADCAST_BACKEND_SSL:-ssl}"
HAPROXY_EMAIL_FROM: "${HAPROXY_EMAIL_FROM:-}"
HAPROXY_EMAIL_TO: "${HAPROXY_EMAIL_FROM:-}"
HAPROXY_EMAIL_LEVEL: "${HAPROXY_EMAIL_LEVEL:-notice}"
volumes: volumes:
- type: bind - type: bind
source: ./haproxy/haproxy.cfg source: ./haproxy/haproxy.cfg
target: /usr/local/etc/haproxy/haproxy.cfg target: /usr/local/etc/haproxy/haproxy.cfg
read_only: true read_only: true
- type: bind
source: ${HAPROXY_MAILER_CONFIG:-./haproxy/mailer.cfg}
target: /usr/local/etc/haproxy/_mailer.cfg
read_only: true
networks: networks:
- haf-network - haf-network
healthcheck: healthcheck:
test: wget -q --spider 127.0.0.1:8001 test: wget -q --spider 127.0.0.1:8001
depends_on:
smtp-relay:
condition: service_started
required: false
haf:
condition: service_started
required: false
balance-tracker-postgrest:
condition: service_started
required: false
hafah-postgrest:
condition: service_started
required: false
hivemind-server:
condition: service_started
required: false
block-explorer-postgrest:
condition: service_started
required: false
haproxy-healthchecks: haproxy-healthchecks:
image: ${HAPROXY_HEALTHCHECKS_REGISTRY:-${HIVE_API_NODE_REGISTRY:-registry.hive.blog}/haf_api_node/haproxy-healthchecks}:${HAPROXY_HEALTHCHECKS_VERSION:-${HIVE_API_NODE_VERSION}} image: ${HAPROXY_HEALTHCHECKS_REGISTRY:-${HIVE_API_NODE_REGISTRY:-registry.hive.blog}/haf_api_node/haproxy-healthchecks}:${HAPROXY_HEALTHCHECKS_VERSION:-${HIVE_API_NODE_VERSION}}
environment: environment:
...@@ -28,3 +54,17 @@ services: ...@@ -28,3 +54,17 @@ services:
- haproxy-healthchecks - haproxy-healthchecks
networks: networks:
- haf-network - haf-network
smtp-relay:
profiles:
- email
image: grafana/smtprelay
command:
- -hostname=${PUBLIC_HOSTNAME}
- -listen=0.0.0.0:25
- -allowed_nets=
- -remote_host=${SMTP_HOST}
- -remote_user=${SMTP_USER}
- -remote_pass=${SMTP_PASS}
- -remote_auth=${SMTP_AUTH_TYPE:-plain}
networks:
- haf-network
...@@ -7,26 +7,11 @@ global ...@@ -7,26 +7,11 @@ global
presetenv SYNC_BROADCAST_BACKEND_PORT 443 presetenv SYNC_BROADCAST_BACKEND_PORT 443
presetenv SYNC_BROADCAST_BACKEND_SSL ssl presetenv SYNC_BROADCAST_BACKEND_SSL ssl
defaults # DEFAULTS
log global # do not put a defaults section here, the defaults section is included
mode http # from either the `mailer.cfg` or `no-mailer.cfg` files (only one of those
option httplog # files is included, which one depends on your setup). Make any changes
option dontlognull # to defaults in both of those files.
option forwardfor
option http-server-close
option log-health-checks
timeout connect 5s
timeout client 30s
timeout server 30s
timeout tunnel 1h
default-server init-addr last,libc,none resolvers docker check
#errorfile 400 /etc/haproxy/errors/400.http
#errorfile 403 /etc/haproxy/errors/403.http
#errorfile 408 /etc/haproxy/errors/408.http
#errorfile 500 /etc/haproxy/errors/500.http
#errorfile 502 /etc/haproxy/errors/502.http
#errorfile 503 /etc/haproxy/errors/503.http
#errorfile 504 /etc/haproxy/errors/504.http
resolvers docker resolvers docker
parse-resolv-conf parse-resolv-conf
......
mailers mta
mailer smtp smtp-relay:25
defaults
log global
mode http
option httplog
option dontlognull
option forwardfor
option http-server-close
option log-health-checks
timeout connect 5s
timeout client 30s
timeout server 30s
timeout tunnel 1h
default-server init-addr last,libc,none resolvers docker check
#errorfile 400 /etc/haproxy/errors/400.http
#errorfile 403 /etc/haproxy/errors/403.http
#errorfile 408 /etc/haproxy/errors/408.http
#errorfile 500 /etc/haproxy/errors/500.http
#errorfile 502 /etc/haproxy/errors/502.http
#errorfile 503 /etc/haproxy/errors/503.http
#errorfile 504 /etc/haproxy/errors/504.http
email-alert from donotreply@syncad.com
email-alert to efrias@syncad.com
email-alert mailers mta
email-alert level notice
defaults
log global
mode http
option httplog
option dontlognull
option forwardfor
option http-server-close
option log-health-checks
timeout connect 5s
timeout client 30s
timeout server 30s
timeout tunnel 1h
default-server init-addr last,libc,none resolvers docker check
#errorfile 400 /etc/haproxy/errors/400.http
#errorfile 403 /etc/haproxy/errors/403.http
#errorfile 408 /etc/haproxy/errors/408.http
#errorfile 500 /etc/haproxy/errors/500.http
#errorfile 502 /etc/haproxy/errors/502.http
#errorfile 503 /etc/haproxy/errors/503.http
#errorfile 504 /etc/haproxy/errors/504.http
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment