pkmntrade.club/server/haproxy.cfg
badbl0cks 30ce126a07
feat(deploy): implement blue-green deployment strategy
This commit replaces the previous deployment mechanism with a blue-green strategy to lay the groundwork for zero-downtime deployments.
Key changes:
Introduces a deploy-blue-green.sh script to manage "blue" and "green" container sets, creating versioned releases.
Updates the Anubis gatekeeper template to dynamically route traffic based on the active deployment color, allowing for seamless traffic switching.
Modifies Docker Compose files to include color-specific labels and environment variables.
Adapts the GitHub Actions workflow to execute the new blue-green deployment process.
Removes the old, now-obsolete deployment and health check scripts.
Note: Automated rollback on health check failure is not yet implemented. Downgrades can be performed manually by switching the active color.
2025-06-12 16:58:55 -07:00

51 lines
1.6 KiB
INI

# https://docs.haproxy.org/3.1/configuration.html
global
log stdout format raw local0 # Send logs to Docker's stdout
master-worker
resolvers docker_resolver
nameserver docker_dns 127.0.0.11:53 # Docker's internal DNS
resolve_retries 3
timeout resolve 1s
timeout retry 1s
hold valid 10s
hold obsolete 30s
accepted_payload_size 8192 # Optional: Increase if you have many replicas
defaults
mode http
log global
timeout client 120s
timeout connect 120s
timeout server 120s
timeout http-request 120s
option httplog
frontend haproxy_entrypoint
bind :443 ssl crt /certs/crt.pem verify required ca-file /certs/ca.pem
use_backend %[req.hdr(host),lower,word(1,:)] # strip out port from host
frontend healthchecks
bind :80
default_backend basic_loba_check
backend basic_loba_check
http-request return status 200 content-type "text/plain" lf-string "OK/HEALTHY"
backend "${DOMAIN_NAME}"
balance leastconn
http-request set-header Host "${DOMAIN_NAME}"
server-template gatekeeper-web- "${REPLICA_COUNT}" gatekeeper-web:8000 check resolvers docker_resolver init-addr none
backend "feedback.${BASE_DOMAIN_NAME}"
balance leastconn
http-request set-header Host feedback."${BASE_DOMAIN_NAME}"
server-template gatekeeper-feedback- 1 gatekeeper-feedback:8000 check resolvers docker_resolver init-addr none
backend "health.${BASE_DOMAIN_NAME}"
balance leastconn
http-request set-header Host health."${BASE_DOMAIN_NAME}"
server-template gatekeeper-health- 1 gatekeeper-health:8000 check resolvers docker_resolver init-addr none
#EOF - trailing newline required