Add web app services to docker compose file

This commit is contained in:
nabarun 2023-03-21 14:28:41 +05:30
parent 7eb6fe6d99
commit a264ca7717
8 changed files with 82 additions and 3 deletions

View File

@ -37,11 +37,46 @@ services:
- "0.0.0.0:9001:9001"
- "0.0.0.0:9090:9090"
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "9090"]
test: ["CMD", "busybox", "nc", "localhost", "9090"]
interval: 20s
timeout: 5s
retries: 15
start_period: 5s
mobymask-app:
depends_on:
mobymask-watcher-server:
condition: service_healthy
image: cerc/mobymask-ui:local
command: ["sh", "-c", "npm run build && serve -s build"]
volumes:
- ../config/watcher-mobymask-v2/mobymask-app-config.json:/app/src/config.json
ports:
- "0.0.0.0:3002:3000"
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "3000"]
interval: 20s
timeout: 5s
retries: 15
start_period: 10s
peer-test-app:
depends_on:
mobymask-watcher-server:
condition: service_healthy
image: cerc/react-peer:local
working_dir: /app/packages/test-app
command: ["sh", "-c", "yarn build && serve -s build"]
volumes:
- ../config/watcher-mobymask-v2/test-app-config.json:/app/packages/test-app/src/config.json
ports:
- "0.0.0.0:3003:3000"
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "3000"]
interval: 20s
timeout: 5s
retries: 15
start_period: 10s
volumes:
mobymask_watcher_db_data:

View File

@ -0,0 +1,11 @@
{
"address": "0xF1Ec16Eedc547A60574EAD530AA120f1e108a9f4",
"name": "MobyMask",
"chainId": 9000,
"relayNodes": [
"/ip4/127.0.0.1/tcp/9090/http/p2p-webrtc-direct/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t"
],
"peer": {
"enableDebugInfo": true
}
}

View File

@ -6,6 +6,8 @@ WORKDIR /app
COPY . .
RUN npm install -g serve
RUN echo "Building mobymask-ui" && \
npm install

View File

@ -6,7 +6,9 @@ WORKDIR /app
COPY . .
RUN yarn global add serve
RUN echo "Building react-peer" && \
yarn && yarn workspace @cerc-io/react-peer build
yarn && yarn build --ignore @cerc-io/test-app
WORKDIR /app

View File

@ -4,7 +4,7 @@ RUN apt-get update \
&& apt-get install -y curl gnupg build-essential \
&& curl --silent --location https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get update \
&& apt-get install -y nodejs git \
&& apt-get install -y nodejs git busybox \
&& node -v
RUN corepack enable \

View File

@ -10,6 +10,14 @@ Clone required repositories:
laconic-so --stack mobymask-v2 setup-repositories
```
Checkout to the required branch in mobymask-ui
```bash
cd ~/cerc/mobymask-ui
git checkout laconic
```
Build the container images:
```bash
@ -52,6 +60,26 @@ Run the peer tests:
docker exec -w /app/packages/peer $CONTAINER_ID yarn test
```
## Web Apps
Check that the status for web-app containers are healthy by using `docker ps`
### mobymask-app
The mobymask-app should be running at http://localhost:3002
### peer-test-app
The peer-test-app should be running at http://localhost:3003
## Details
* The relay node for p2p network is running at http://localhost:9090
* The [peer package](https://github.com/cerc-io/watcher-ts/tree/main/packages/peer) (published in [gitea](https://git.vdb.to/cerc-io/-/packages/npm/@cerc-io%2Fpeer)) can be used in client code for connecting to the network
* The [react-peer package](https://github.com/cerc-io/react-peer/tree/main/packages/react-peer) (published in [gitea](https://git.vdb.to/cerc-io/-/packages/npm/@cerc-io%2Freact-peer)) which uses the peer package can be used in react app for connecting to the network
## Clean up
To stop all the services running in background run:

View File

@ -6,6 +6,7 @@ repos:
- cerc-io/mobymask-ui
containers:
- cerc/watcher-mobymask-v2
- cerc/react-peer
- cerc/mobymask-ui
pods:
- watcher-mobymask-v2