diff --git a/images/utils/launcher/config/config.py b/images/utils/launcher/config/config.py index 39d6bcc03..8aece8d92 100644 --- a/images/utils/launcher/config/config.py +++ b/images/utils/launcher/config/config.py @@ -395,6 +395,13 @@ def update_connext(self, parsed): node = self.nodes["connext"] self.update_ports(node, parsed) + def update_webui(self, parsed): + """Update Connext related configurations from parsed TOML raiden section + :param parsed: Parsed raiden TOML section + """ + node = self.nodes.get("webui", 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 16cdbed10..08bb90977 100644 --- a/images/utils/launcher/config/template.py +++ b/images/utils/launcher/config/template.py @@ -139,7 +139,16 @@ def __eq__(self, other): "container": "/mnt/hostfs", }, ], - "ports": [PortPublish("28885"), PortPublish("8080")], + "ports": [PortPublish("28885"), PortPublish("8081:8080")], + "mode": "native", + "preserve_config": False, + "use_local_image": False, + }, + "webui": { + "name": "webui", + "image": "exchangeunion/webui:latest", + "volumes": [], + "ports": [PortPublish("8080")], "mode": "native", "preserve_config": False, "use_local_image": False, @@ -292,6 +301,15 @@ def __eq__(self, other): "mode": "native", "preserve_config": False, "use_local_image": False, + }, + "webui": { + "name": "webui", + "image": "exchangeunion/webui:latest", + "volumes": [], + "ports": [PortPublish("8080")], + "mode": "native", + "preserve_config": False, + "use_local_image": False, } }, "mainnet": { @@ -440,6 +458,15 @@ def __eq__(self, other): "mode": "native", "preserve_config": False, "use_local_image": False, + }, + "webui": { + "name": "webui", + "image": "exchangeunion/webui:latest", + "volumes": [], + "ports": [PortPublish("8080")], + "mode": "native", + "preserve_config": False, + "use_local_image": False, } } } diff --git a/images/utils/launcher/node/__init__.py b/images/utils/launcher/node/__init__.py index 7c92d3d29..ac8e77014 100644 --- a/images/utils/launcher/node/__init__.py +++ b/images/utils/launcher/node/__init__.py @@ -18,6 +18,7 @@ from .geth import Geth from .image import Image, ImageManager from .lnd import Lndbtc, Lndltc +from .webui import Webui from .xud import Xud, XudApiError from ..config import Config from ..errors import FatalError diff --git a/images/utils/launcher/node/webui.py b/images/utils/launcher/node/webui.py new file mode 100644 index 000000000..279cb3fd3 --- /dev/null +++ b/images/utils/launcher/node/webui.py @@ -0,0 +1,12 @@ +from .base import Node + + +class Webui(Node): + def __init__(self, name, ctx): + super().__init__(name, ctx) + + self._cli = None + self.api = None + + def status(self): + return "Ready" diff --git a/images/webui/latest/Dockerfile b/images/webui/latest/Dockerfile new file mode 100644 index 000000000..f2e37a8c4 --- /dev/null +++ b/images/webui/latest/Dockerfile @@ -0,0 +1,14 @@ +FROM node:14-alpine3.11 as builder +ARG REPO=ExchangeUnion/xud-webui-poc +ARG BRANCH=master +RUN apk --no-cache add git +RUN git clone -b $BRANCH https://github.com/$REPO /src +WORKDIR /src +RUN git pull origin $BRANCH +RUN yarn install +RUN yarn build + +FROM nginx:1.19.0-alpine +COPY --from=builder /src/build/ /usr/share/nginx/html +COPY nginx.conf /etc/nginx/nginx.conf +RUN mkdir -p /var/nginx/logs diff --git a/images/webui/latest/nginx.conf b/images/webui/latest/nginx.conf new file mode 100644 index 000000000..8fb20c0ee --- /dev/null +++ b/images/webui/latest/nginx.conf @@ -0,0 +1,41 @@ +worker_processes 1; ## Default: 1 +error_log /var/nginx/logs/error.log; +pid /var/nginx/logs/nginx.pid; +worker_rlimit_nofile 8192; + +events { + worker_connections 1024; +} + +http { + include mime.types; + index index.html; + + default_type application/octet-stream; + log_format main '$remote_addr - $remote_user [$time_local] $status ' + '"$request" $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + access_log /var/nginx/logs/access.log main; + sendfile on; + tcp_nopush on; + + server { + listen 8080; + server_name localhost; + root /usr/share/nginx/html; + + location /static/ { + } + + location /api { + proxy_pass http://xud:8080/api; + } + + location ~ \.css { + add_header Content-Type text/css; + } + location ~ \.js { + add_header Content-Type application/x-javascript; + } + } +} \ No newline at end of file