From 43648203f2a26d767b928a946afe6ed280354835 Mon Sep 17 00:00:00 2001 From: Yang Yang Date: Fri, 19 Jun 2020 21:45:11 +0800 Subject: [PATCH] add envoy --- images/envoy/latest/Dockerfile | 3 ++ images/envoy/latest/envoy.yaml | 45 ++++++++++++++++++++++++ images/utils/launcher/config/config.py | 11 ++++-- images/utils/launcher/config/template.py | 9 +++++ images/utils/launcher/node/__init__.py | 1 + images/utils/launcher/node/envoy.py | 9 +++++ images/utils/launcher/node/webui.py | 3 -- 7 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 images/envoy/latest/Dockerfile create mode 100644 images/envoy/latest/envoy.yaml create mode 100644 images/utils/launcher/node/envoy.py diff --git a/images/envoy/latest/Dockerfile b/images/envoy/latest/Dockerfile new file mode 100644 index 000000000..152de2e83 --- /dev/null +++ b/images/envoy/latest/Dockerfile @@ -0,0 +1,3 @@ +FROM envoyproxy/envoy:v1.14.1 +COPY envoy.yaml /etc/envoy/envoy.yaml +CMD ["envoy", "-c", "/etc/envoy/envoy.yaml", "-l", "trace"] diff --git a/images/envoy/latest/envoy.yaml b/images/envoy/latest/envoy.yaml new file mode 100644 index 000000000..19098ffde --- /dev/null +++ b/images/envoy/latest/envoy.yaml @@ -0,0 +1,45 @@ +admin: + access_log_path: /tmp/admin_access.log + address: + socket_address: { address: 0.0.0.0, port_value: 9901 } + +static_resources: + listeners: + - name: listener_0 + address: + socket_address: { address: 0.0.0.0, port_value: 9090 } + filter_chains: + - filters: + - name: envoy.http_connection_manager + config: + codec_type: auto + stat_prefix: ingress_http + route_config: + name: local_route + virtual_hosts: + - name: local_service + domains: ["*"] + routes: + - match: { prefix: "/" } + route: + cluster: xud_service + max_grpc_timeout: 0s + cors: + allow_origin_string_match: + - prefix: "*" + allow_methods: GET, PUT, DELETE, POST, OPTIONS + allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout + max_age: "1728000" + expose_headers: custom-header-1,grpc-status,grpc-message + http_filters: + - name: envoy.grpc_web + - name: envoy.cors + - name: envoy.router + clusters: + - name: xud_service + connect_timeout: 0.25s + type: strict_dns + http2_protocol_options: {} + lb_policy: round_robin + # win/mac hosts: Use address: host.docker.internal instead of address: localhost in the line below + hosts: [{ socket_address: { address: xud, port_value: 28885 }}] diff --git a/images/utils/launcher/config/config.py b/images/utils/launcher/config/config.py index 10e7d2c87..5660d02a0 100644 --- a/images/utils/launcher/config/config.py +++ b/images/utils/launcher/config/config.py @@ -391,19 +391,26 @@ def update_lndltc(self, parsed): self.update_ports(node, parsed) def update_connext(self, parsed): - """Update Connext related configurations from parsed TOML raiden section + """Update Connext related configurations from parsed TOML connext section :param parsed: Parsed raiden TOML section """ node = self.nodes["connext"] self.update_ports(node, parsed) def update_webui(self, parsed): - """Update Connext related configurations from parsed TOML raiden section + """Update webui related configurations from parsed TOML webui section :param parsed: Parsed raiden TOML section """ node = self.nodes.get("webui", None) self.update_ports(node, parsed) + def update_envoy(self, parsed): + """Update envoy related configurations from parsed TOML envoy section + :param parsed: Parsed raiden TOML section + """ + node = self.nodes.get("envoy", None) + self.update_ports(node, parsed) + def update_raiden(self, parsed): """Update raiden related configurations from parsed TOML raiden section :param parsed: Parsed raiden TOML section diff --git a/images/utils/launcher/config/template.py b/images/utils/launcher/config/template.py index 10df9d965..97e044b85 100644 --- a/images/utils/launcher/config/template.py +++ b/images/utils/launcher/config/template.py @@ -152,6 +152,15 @@ def __eq__(self, other): "mode": "native", "preserve_config": False, "use_local_image": False, + }, + "envoy": { + "name": "envoy", + "image": "exchangeunion/envoy:latest", + "volumes": [], + "ports": [PortPublish("9090")], + "mode": "native", + "preserve_config": False, + "use_local_image": False, } }, "testnet": { diff --git a/images/utils/launcher/node/__init__.py b/images/utils/launcher/node/__init__.py index 9a77fe480..4a29a3805 100644 --- a/images/utils/launcher/node/__init__.py +++ b/images/utils/launcher/node/__init__.py @@ -19,6 +19,7 @@ from .image import Image, ImageManager from .lnd import Lndbtc, Lndltc from .webui import Webui +from .envoy import Envoy from .xud import Xud, XudApiError from ..config import Config from ..errors import FatalError diff --git a/images/utils/launcher/node/envoy.py b/images/utils/launcher/node/envoy.py new file mode 100644 index 000000000..629717104 --- /dev/null +++ b/images/utils/launcher/node/envoy.py @@ -0,0 +1,9 @@ +from .base import Node + + +class Envoy(Node): + def __init__(self, name, ctx): + super().__init__(name, ctx) + + def status(self): + return "Ready" diff --git a/images/utils/launcher/node/webui.py b/images/utils/launcher/node/webui.py index 279cb3fd3..db989fdfd 100644 --- a/images/utils/launcher/node/webui.py +++ b/images/utils/launcher/node/webui.py @@ -5,8 +5,5 @@ class Webui(Node): def __init__(self, name, ctx): super().__init__(name, ctx) - self._cli = None - self.api = None - def status(self): return "Ready"