领事客户端-企业代理后面的服务器

时间:2019-11-04 15:49:20

标签: docker proxy docker-compose consul

我在两个单独的服务器上有一个Consul服务器节点和Consul客户端节点。我希望我的客户加入集群,但是我的代理人拒绝了我。 我不知道为什么,因为我已经设置了http_proxyhttps_proxyno_proxy env vars,但是它没有任何改变。

这是我的2个docker-compose文件:

服务器

  consul:
    image: consul:1.6
    container_name: consul
    hostname: consul
    restart: always
    network_mode: host
    volumes:
      - consuldata:/consul/data
      - ./rules/consul.hcl:/consul/rules/consul.hcl
      - ./rules/registrator.hcl:/consul/rules/registrator.hcl
      - ../my.pem:/etc/ssl/certs/my.pem:ro
    environment:
      CONSUL_LOCAL_CONFIG: >-
        {
          "leave_on_terminate": false,
          "skip_leave_on_interrupt": true,
          "acl": {"enabled": true,"default_policy": "deny","down_policy": "extend-cache","enable_token_persistence": true},
          "log_level": "debug",
          "ports": {
            "https": 8501
          },
          "key_file": "/etc/ssl/certs/my.pem",
          "cert_file": "/etc/ssl/certs/my.pem",
          "ca_file": "/etc/ssl/certs/my.pem",
          "performance": {
            "raft_multiplier": 1
          }
        }
      HOST_IP: ${HOST_IP}
      http_proxy: http://user:password@myproxy:3129
      https_proxy: http://user:password@myproxy:3129
      HTTP_PROXY: http://user:password@myproxy:3129
      HTTPS_PROXY: http://user:password@myproxy:3129
      no_proxy: "127.0.0.1"
      NO_PROXY: "127.0.0.1"
    command: "agent -server -client=${HOST_IP} -bind=${HOST_IP} -bootstrap-expect=2 -ui"

客户

  consul:
    image: consul:1.6
    container_name: consul
    hostname: consul
    restart: always
    network_mode: host
    volumes:
      - consuldata:/consul/data
      - ./rules/consul.hcl:/consul/rules/consul.hcl
      - ./rules/registrator.hcl:/consul/rules/registrator.hcl
      - ../my.pem:/etc/ssl/certs/my.pem:ro
    environment:
      CONSUL_LOCAL_CONFIG: >-
        {
          "leave_on_terminate": true,
          "skip_leave_on_interrupt": true,
          "acl": {"enabled": true,"default_policy": "deny","down_policy": "extend-cache","enable_token_persistence": true},
          "log_level": "trace",
          "ports": {
            "https": 8501
          },
          "key_file": "/etc/ssl/certs/my.pem",
          "cert_file": "/etc/ssl/certs/my.pem",
          "ca_file": "/etc/ssl/certs/my.pem",
          "performance": {
            "raft_multiplier": 1
          }
        }
      HOST_IP: ${HOST_IP}
      http_proxy: http://user:password@myproxy:3129
      https_proxy: http://user:password@myproxy:3129
      HTTP_PROXY: http://user:password@myproxy:3129
      HTTPS_PROXY: http://user:password@myproxy:3129
      no_proxy: "127.0.0.1,${SERVER_IP},consul-dev.intra.net"
      NO_PROXY: "127.0.0.1,${SERVER_IP},consul-dev.intra.net"
    command: "agent -bind=${HOST_IP} -client=${HOST_IP} -retry-join=${SERVER_IP}"

我错了吗?

谢谢。

0 个答案:

没有答案