diff --git a/app/data/compose/docker-compose-mobymask-app.yml b/app/data/compose/docker-compose-mobymask-app.yml index 6df4813..f2b30a4 100644 --- a/app/data/compose/docker-compose-mobymask-app.yml +++ b/app/data/compose/docker-compose-mobymask-app.yml @@ -13,6 +13,7 @@ services: 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/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 @@ -28,12 +29,47 @@ services: ports: - "0.0.0.0:3002:80" 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 timeout: 5s retries: 15 start_period: 10s - shm_size: '1GB' extra_hosts: - "host.docker.internal:host-gateway" diff --git a/app/data/container-build/cerc-mobymask-ui/Dockerfile b/app/data/container-build/cerc-mobymask-ui/Dockerfile index 3f04ec4..4ff202b 100644 --- a/app/data/container-build/cerc-mobymask-ui/Dockerfile +++ b/app/data/container-build/cerc-mobymask-ui/Dockerfile @@ -31,7 +31,7 @@ RUN \ # Install additional OS packages. 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 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) RUN yarn global add http-server -# Globally install the payload web app package -RUN yarn global add @cerc-io/mobymask-ui +# Globally install both versions of the payload web app package +# 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 80 diff --git a/app/data/container-build/cerc-mobymask-ui/start-serving-app.sh b/app/data/container-build/cerc-mobymask-ui/start-serving-app.sh index 4e0a976..0e11b44 100755 --- a/app/data/container-build/cerc-mobymask-ui/start-serving-app.sh +++ b/app/data/container-build/cerc-mobymask-ui/start-serving-app.sh @@ -4,6 +4,6 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then fi # 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 http-server -p 80 ${webapp_files_dir}