Skip to content

Commit

Permalink
add webui container
Browse files Browse the repository at this point in the history
  • Loading branch information
reliveyy committed Jun 19, 2020
1 parent cf84aaa commit f2eb057
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 1 deletion.
7 changes: 7 additions & 0 deletions images/utils/launcher/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 28 additions & 1 deletion images/utils/launcher/config/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions images/utils/launcher/node/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions images/utils/launcher/node/webui.py
Original file line number Diff line number Diff line change
@@ -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"
14 changes: 14 additions & 0 deletions images/webui/latest/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
41 changes: 41 additions & 0 deletions images/webui/latest/nginx.conf
Original file line number Diff line number Diff line change
@@ -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;
}
}
}

0 comments on commit f2eb057

Please sign in to comment.