Linux 错误503,HAProxy发布跨其他代理、Docker和LXD的翻译服务

Linux 错误503,HAProxy发布跨其他代理、Docker和LXD的翻译服务,linux,docker,load-balancing,haproxy,ubuntu-18.04,Linux,Docker,Load Balancing,Haproxy,Ubuntu 18.04,我相信我的HAProxy文件很可能有问题,但我不确定。我以前使用这个配置文件访问容器中的其他服务,以及其他负载平衡器上的其他服务,以及apache系统,现在我无法这样做 我不认为其他服务是罪魁祸首,因为它们是本机快照安装 HAProxy status URI将状态显示为L7STS/502,并尝试加载端口显示为503的页面 之前,加载了一个页面,但它是Nextcloud,因此我进入Gitlab config.rb文件,将NGinx的默认端口从80更改为8800,并运行Gitlab ctl reco

我相信我的HAProxy文件很可能有问题,但我不确定。我以前使用这个配置文件访问容器中的其他服务,以及其他负载平衡器上的其他服务,以及apache系统,现在我无法这样做

我不认为其他服务是罪魁祸首,因为它们是本机快照安装

HAProxy status URI将状态显示为L7STS/502,并尝试加载端口显示为503的页面

之前,加载了一个页面,但它是Nextcloud,因此我进入Gitlab config.rb文件,将NGinx的默认端口从80更改为8800,并运行Gitlab ctl reconfigure命令将Git重新构建到另一个端口上,并在HAProxy内部进行了相应的更正

其他不支持任何类型代理的服务加载得很好,docker容器服务也没有正确加载,显示了相同的503错误,这让我进一步相信它是我的HAProxy配置文件

以下是HAProxy配置文件:

global
  log         127.0.0.1 syslog
  maxconn     1000
  user        haproxy
  group       haproxy
  daemon


defaults
  log  global
  mode  http
  option  httplog
  option  dontlognull
  option  http-server-close
  option  forwardfor except 127.0.0.0/8
  option  redispatch
  option  contstats
  retries  3
  timeout  http-request 10s
  timeout  queue 1m
  timeout  connect 10s
  timeout  client 1m
  timeout  server 1m
  timeout  check 10s
  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


###########################################
#
# HAProxy Stats page
#
###########################################

listen stats
  bind *:9090
  mode  http
  maxconn  10
  stats  enable
  stats  hide-version
  stats  realm Haproxy\ Statistics
  stats  uri /
  stats  auth -----:-----



###########################################
#
# Front end for all
#
###########################################

frontend ALL
  bind   *:80
  mode   http

  # Define path for lets encrypt
  acl is_letsencrypt path_beg -i /.well-known/acme-challenge/
  use_backend letsencrypt if is_letsencrypt

  # Define hosts
  acl host_horizon hdr(host) -i horizon.eduarmor.com
  acl host_eduarmor hdr(host) -i www.eduarmor.com
  acl host_nextcloud hdr(host) -i nextcloud.eduarmor.com
  acl host_git hdr(host) -i git.eduarmor.com
  acl host_minecraft hdr(host) -i mine.eduarmor.com
  acl host_sugar hdr(host) -i sugar.eduarmor.com
  acl host_maas hdr(host) -i maas.eduarmor.com
  acl host_rocketchat hdr(host) -i rocketchat.eduarmor.com
  acl host_hive hdr(host) -i hive.eduarmor.com

  # Direct hosts to backend
  use_backend horizon if host_horizon
  use_backend eduarmor if host_eduarmor
  use_backend nextcloud if host_nextcloud
  use_backend git if host_git
  use_backend minecraft if host_minecraft
  use_backend sugar if host_sugar
  use_backend maas if host_maas
  use_backend rocketchat if host_rocketchat
  use_backend hive if host_hive


###########################################
#
# Back end letsencrypt
#
###########################################

backend letsencrypt
  server letsencrypt 127.0.0.1:8888

###########################################
#
# Back end for Horizon
#
###########################################

backend horizon
  balance         roundrobin
  # option          httpchk GET /check
  option          httpchk GET /
  # http-check      expect rstring ^UP$
  default-server  inter 3s fall 3 rise 2
  server          server1 10.0.0.30:80 check
  #     server          server2 0.0.0.0:80 check



###########################################
#
# Back end for EduArmor
#
###########################################
backend eduarmor
  balance         roundrobin
  # option          httpchk GET /check
  option          httpchk GET /
  # http-check      expect rstring ^UP$
  default-server  inter 3s fall 3 rise 2
  server          server1 10.0.0.59:80 check
  #     server server2 0.0.0.0:80 check

##########################################
#
# Back end for Nextcloud
#
##########################################
backend nextcloud
  balance         roundrobin
  # option         httpchk GET /check
  option          httpchk GET /
  # http-check     expect rstring ^UP$
  default-server  inter 3s fall 3 rise 2
  server          server1 10.0.0.101:80 check


##########################################
#
# Back end, Gitlab
#
##########################################
backend git
 balance        roundrobin
 # option        httpchk GET /check
 option         httpchk GET /
 # http-check    expect rstring ^UP$
 default-server inter 3s fall 3 rise 2
 server         server1 10.0.0.101:8800 check



##########################################
#
# Back end, Minecraft
#
##########################################
backend minecraft
 balance        roundrobin
 # option        httpchk GET /check
 option         httpchk GET /
 # http-check    expect rstring ^UP$
 default-server inter 3s fall 3 rise 2
 server         server1 10.0.0.101:25565 check



##########################################
#
# Back end, PHPSugar
#
##########################################
backend sugar
 balance        roundrobin
 # option        httpchk GET /check
 option         httpchk GET /
 # http-check   expect rstring ^UP$
 default-server inter 3s fall 3 rise 2
 server         server1 10.0.0.101:80 check



##########################################
#
# Back End, MAAS
#
##########################################
backend maas
 balance        roundrobin
 # option        httpchk GET /check
 option         httpchk GET /
 # http-check   expect rstring ^UP$
 default-server inter 3s fall 3 rise 2
 server         server1 10.0.0.100:5240 check



##########################################
#
# Back end for Rocketchat
#
##########################################
backend rocketchat
  balance         roundrobin
  # option         httpchk GET /check
  option          httpchk GET /
  # http-check     expect rstring ^UP$
  default-server  inter 3s fall 3 rise 2
  server          server1 10.0.0.101:3000 check
  server          server2 10.0.0.102:3000 check



##########################################
#
# Back end for The Hive
#
##########################################
backend hive
  balance         roundrobin
  # option         httpchk GET /check
  option          httpchk GET /
  # http-check     expect rstring ^UP$
  default-server  inter 3s fall 3 rise 2
  server          server1 10.0.0.101:9000 check
  server          server2 10.0.0.102:9000 check

我非常感谢您对解决此问题的任何建议或见解,以及您在最佳实践方面可能拥有的任何其他资源,特别是配置SSL/TLS使用。

解决方案是注释掉httpchk GET/comment选项,特别是针对Hive后端,以及从使用docker compose转向docker swarm,这也大大增加了我对docker如何工作的整体知识。docker compose和/CHK的问题组合导致HAProxy将服务读取为down,并返回503错误,这也意味着它永远不会为服务提供服务

我要感谢今晚自愿抽出时间教我docker swarm和CI/CD流程的匿名人士。我要比被填鸭式地灌输答案要好得多,为此我非常感谢你们,许多无家可归的退伍军人也是如此