diff --git a/images/utils/launcher/config/config.py b/images/utils/launcher/config/config.py index a35c9f353..c3da28262 100644 --- a/images/utils/launcher/config/config.py +++ b/images/utils/launcher/config/config.py @@ -387,6 +387,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 47efd6547..5919d0558 100644 --- a/images/utils/launcher/config/template.py +++ b/images/utils/launcher/config/template.py @@ -117,7 +117,15 @@ def __eq__(self, other): "container": "/mnt/hostfs", }, ], - "ports": [PortPublish("28885"), PortPublish("8080")], + "ports": [PortPublish("28885"), PortPublish("8081:8080")], + "mode": "native", + "preserve_config": False, + }, + "webui": { + "name": "webui", + "image": "exchangeunion/webui:latest", + "volumes": [], + "ports": [PortPublish("8080")], "mode": "native", "preserve_config": False, } @@ -243,6 +251,14 @@ def __eq__(self, other): "ports": [PortPublish("18885")], "mode": "native", "preserve_config": False, + }, + "webui": { + "name": "webui", + "image": "exchangeunion/webui:latest", + "volumes": [], + "ports": [PortPublish("8080")], + "mode": "native", + "preserve_config": False, } }, "mainnet": { @@ -365,6 +381,14 @@ def __eq__(self, other): "ports": [PortPublish("8885")], "mode": "native", "preserve_config": False, + }, + "webui": { + "name": "webui", + "image": "exchangeunion/webui:latest", + "volumes": [], + "ports": [PortPublish("8080")], + "mode": "native", + "preserve_config": False, } } } diff --git a/images/utils/launcher/node/__init__.py b/images/utils/launcher/node/__init__.py index 76ef71a1e..e8c997181 100644 --- a/images/utils/launcher/node/__init__.py +++ b/images/utils/launcher/node/__init__.py @@ -16,6 +16,7 @@ from .lnd import Lndbtc, Lndltc from .xud import Xud, XudApiError from .connext import Connext +from .webui import Webui from .image import Image, ImageManager from ..utils import parallel_execute, get_useful_error_message, get_hostfs_file, ArgumentParser 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 diff --git a/tools/core/image.py b/tools/core/image.py index df03f9a18..e373378d7 100644 --- a/tools/core/image.py +++ b/tools/core/image.py @@ -204,10 +204,10 @@ def _build_platform(self, platform: Platform, no_cache: bool = False) -> bool: if self._skip_build(platform, unmodified_history): self._logger.debug("%s Skip building", prefix) - if platform == self.context.current_platform and "TRAVIS_BRANCH" not in os.environ: - tag = self.get_build_tag(self.branch) - self.run_command(f"docker pull {tag}", "Failed to pull " + tag) - self.run_command(f"docker tag {tag} {build_tag}", "Failed to re-tag " + tag) + # if platform == self.context.current_platform and "TRAVIS_BRANCH" not in os.environ: + # tag = self.get_build_tag(self.branch) + # self.run_command(f"docker pull {tag}", "Failed to pull " + tag) + # self.run_command(f"docker tag {tag} {build_tag}", "Failed to re-tag " + tag) return False self.print_title("Building {}".format(self.name), "{} ({})".format(self.tag, platform.tag_suffix))