Add container to mobymask-v2 stack for LXDAO mobymask-app (#347)

* Add container to stack for lxdao mobymask-app

* Remove shm_size

* Use cerc-io scoped alias for lxdao app package

* Change alias to @cerc-io/mobymask-ui-lxdao
This commit is contained in:
Nabarun Gogoi 2023-04-20 10:49:19 +05:30 committed by GitHub
parent 727fa67d8e
commit 46b36c3cb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 6 deletions

View File

@ -13,6 +13,7 @@ services:
CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT} CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT}
CERC_APP_WATCHER_URL: ${CERC_APP_WATCHER_URL} CERC_APP_WATCHER_URL: ${CERC_APP_WATCHER_URL}
CERC_RELAY_NODES: ${CERC_RELAY_NODES} CERC_RELAY_NODES: ${CERC_RELAY_NODES}
CERC_BUILD_DIR: "@cerc-io/mobymask-ui/build"
working_dir: /scripts working_dir: /scripts
# Waits for watcher server to be up before app build # Waits for watcher server to be up before app build
# Required when running with watcher stack to get deployed contract address # Required when running with watcher stack to get deployed contract address
@ -28,12 +29,47 @@ services:
ports: ports:
- "0.0.0.0:3002:80" - "0.0.0.0:3002:80"
healthcheck: healthcheck:
test: ["CMD", "nc", "-v", "localhost", "80"] test: ["CMD", "nc", "-vz", "localhost", "80"]
interval: 20s
timeout: 5s
retries: 15
start_period: 10s
extra_hosts:
- "host.docker.internal:host-gateway"
# Builds and serves the LXDAO version of MobyMask react-app
lxdao-mobymask-app:
restart: unless-stopped
image: cerc/mobymask-ui:local
env_file:
- ../config/watcher-mobymask-v2/mobymask-params.env
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_CHAIN_ID: ${CERC_CHAIN_ID}
CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT}
CERC_APP_WATCHER_URL: ${CERC_APP_WATCHER_URL}
CERC_RELAY_NODES: ${CERC_RELAY_NODES}
CERC_BUILD_DIR: "@cerc-io/mobymask-ui-lxdao/build"
working_dir: /scripts
# Waits for watcher server to be up before app build
# Required when running with watcher stack to get deployed contract address
command:
- sh
- -c
- ./wait-for-it.sh -h ${CERC_WATCHER_HOST:-$${DEFAULT_CERC_WATCHER_HOST}} -p ${CERC_WATCHER_PORT:-$${DEFAULT_CERC_WATCHER_PORT}} -s -t 0 -- ./mobymask-app-start.sh
volumes:
- ../config/wait-for-it.sh:/scripts/wait-for-it.sh
- ../config/watcher-mobymask-v2/mobymask-app-start.sh:/scripts/mobymask-app-start.sh
- peers_ids:/peers
- mobymask_deployment:/server
ports:
- "0.0.0.0:3004:80"
healthcheck:
test: ["CMD", "nc", "-vz", "localhost", "80"]
interval: 20s interval: 20s
timeout: 5s timeout: 5s
retries: 15 retries: 15
start_period: 10s start_period: 10s
shm_size: '1GB'
extra_hosts: extra_hosts:
- "host.docker.internal:host-gateway" - "host.docker.internal:host-gateway"

View File

@ -31,7 +31,7 @@ RUN \
# Install additional OS packages. # Install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends jq bash && apt-get -y install --no-install-recommends jq bash netcat
# We do this to get a yq binary from the published container, for the correct architecture we're building here # We do this to get a yq binary from the published container, for the correct architecture we're building here
COPY --from=docker.io/mikefarah/yq:latest /usr/bin/yq /usr/local/bin/yq COPY --from=docker.io/mikefarah/yq:latest /usr/bin/yq /usr/local/bin/yq
@ -48,8 +48,11 @@ RUN mkdir -p /config
# Install simple web server for now (use nginx perhaps later) # Install simple web server for now (use nginx perhaps later)
RUN yarn global add http-server RUN yarn global add http-server
# Globally install the payload web app package # Globally install both versions of the payload web app package
RUN yarn global add @cerc-io/mobymask-ui # Install old version of MobyMask web app
RUN yarn global add @cerc-io/mobymask-ui@0.1.2
# Install the LXDAO version of MobyMask web app
RUN yarn global add @cerc-io/mobymask-ui-lxdao@npm:@cerc-io/mobymask-ui@0.1.2-lxdao-0.1.0
# Expose port for http # Expose port for http
EXPOSE 80 EXPOSE 80

View File

@ -4,6 +4,6 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
fi fi
# TODO: Don't hard wire this: # TODO: Don't hard wire this:
webapp_files_dir=/usr/local/share/.config/yarn/global/node_modules/@cerc-io/mobymask-ui/build webapp_files_dir="/usr/local/share/.config/yarn/global/node_modules/${CERC_BUILD_DIR}"
/scripts/apply-webapp-config.sh /config/config.yml ${webapp_files_dir} MOBYMASK_HOSTED_CONFIG /scripts/apply-webapp-config.sh /config/config.yml ${webapp_files_dir} MOBYMASK_HOSTED_CONFIG
http-server -p 80 ${webapp_files_dir} http-server -p 80 ${webapp_files_dir}