Skip to content

Commit

Permalink
feat(user1user2 apps): wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaitanyaKonda authored and Westlad committed Dec 14, 2021
1 parent e008276 commit 3548503
Show file tree
Hide file tree
Showing 21 changed files with 8,084 additions and 24 deletions.
20 changes: 9 additions & 11 deletions test/ping-pong/docker-compose.host.docker.internal.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
version: '3.5'
# Use this script for running up nightfall_3 with a blockchain on localhost 8546
services:
version: '3.5'
# Use this script for running up nightfall_3 with our geth node on ropsten
services:

client:
extra_hosts:
- "host.docker.internal:host-gateway"
- 'host.docker.internal:host-gateway'
environment:
BLOCKCHAIN_WS_HOST: host.docker.internal
BLOCKCHAIN_PORT: 8546
AUTOSTART_RETRIES: 10000

deployer:
extra_hosts:
- "host.docker.internal:host-gateway"
- 'host.docker.internal:host-gateway'
environment:
LOG_LEVEL: debug
# ETH_NETWORK sets the network selected by Truffle from truffle-config.js
Expand All @@ -33,23 +29,25 @@ services:

optimist:
extra_hosts:
- "host.docker.internal:host-gateway"
- 'host.docker.internal:host-gateway'
environment:
BLOCKCHAIN_WS_HOST: host.docker.internal
BLOCKCHAIN_PORT: 8546
AUTOSTART_RETRIES: 10000

proposer:
extra_hosts:
- "host.docker.internal:host-gateway"
- 'host.docker.internal:host-gateway'
environment:
BLOCKCHAIN_WS_HOST: host.docker.internal
BLOCKCHAIN_PORT: 8546
PROPOSER_ETHEREUM_SIGNING_KEY: 645ac79fa9fd87dd1cf30bdca51d326bd501cd328d6dbc9f5f517c7da0dafa6f

user-local:
extra_hosts:
- "host.docker.internal:host-gateway"
# user-local:
# environment:
# BLOCKCHAIN_WS_HOST: host.docker.internal

user-local1:
environment:
BLOCKCHAIN_WS_HOST: host.docker.internal
BLOCKCHAIN_PORT: 8546
Expand Down
43 changes: 33 additions & 10 deletions test/ping-pong/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,42 @@ services:
BLOCKCHAIN_WS_HOST: blockchain1
BLOCKCHAIN_PORT: 8546

user-local:
image: ghcr.io/eyblockchain/nightfall3-user-local:latest
# user-local:
# image: ghcr.io/eyblockchain/nightfall3-user-local:latest
# build:
# dockerfile: user-local.Dockerfile
# context: ../../
# networks:
# - pong_network
# # volumes:
# # - type: bind
# # source: ../../common-files
# # target: /app/common-files
# # - type: bind
# # source: ./user-local/src
# # target: /app/test/ping-pong/user-local/src
# environment:
# OPTIMIST_HOST: optimist
# OPTIMIST_WS_PORT: 8080
# OPTIMIST_HTTP_PORT: 80
# CLIENT_HOST: client
# CLIENT_PORT: 80
# BLOCKCHAIN_WS_HOST: blockchain1
# BLOCKCHAIN_PORT: 8546

user-local1:
build:
dockerfile: user-local.Dockerfile
dockerfile: user-local1.Dockerfile
context: ../../
networks:
- pong_network
# volumes:
# - type: bind
# source: ../../common-files
# target: /app/common-files
# - type: bind
# source: ./user-local/src
# target: /app/test/ping-pong/user-local/src
volumes:
- type: bind
source: ../../common-files
target: /app/common-files
- type: bind
source: ./user-local1/src
target: /app/test/ping-pong/user-local1/src
environment:
OPTIMIST_HOST: optimist
OPTIMIST_WS_PORT: 8080
Expand All @@ -148,6 +170,7 @@ services:
CLIENT_PORT: 80
BLOCKCHAIN_WS_HOST: blockchain1
BLOCKCHAIN_PORT: 8546
command: ['npm', 'run', 'dev']

volumes:
mongodb:
Expand Down
4 changes: 2 additions & 2 deletions test/ping-pong/pong-apps
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ done
# shut down cleanly in the event of a cntl-c etc. We don't want to leave containers running
trap "exit 1" SIGHUP SIGINT SIGTERM

docker-compose -f docker-compose.yml $FILE up -d --remove-orphans proposer user-local
docker-compose logs -f proposer user-local
docker-compose -f docker-compose.yml $FILE up -d --remove-orphans proposer user-local1
docker-compose logs -f proposer user-local1
2 changes: 1 addition & 1 deletion test/ping-pong/user-local/src/index.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Module that runs up as a proposer
Module that runs up as a user
*/
import logger from 'common-files/utils/logger.mjs';
import config from 'config';
Expand Down
22 changes: 22 additions & 0 deletions test/ping-pong/user-local1/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# doc
README.md

#docker
docker-compose.yml
Dockerfile

# git
.git
.gitattributes
.gitignore
.github

# Node
node_modules/

#dev
.prettierignore
.prettierrc.js
.releaserc.json
.eslintrc
.eslintignore
104 changes: 104 additions & 0 deletions test/ping-pong/user-local1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
21 changes: 21 additions & 0 deletions test/ping-pong/user-local1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:14.17

WORKDIR /app
RUN apt-get update -y
RUN apt-get install -y netcat-openbsd

WORKDIR /common-files
RUN echo "{\"name\": \"common-files\"}" > package.json

WORKDIR /test/ping-pong/user-local1

COPY src src
COPY docker-entrypoint.sh pre-start-script.sh package.json package-lock.json ./

RUN npm ci

EXPOSE 80

ENTRYPOINT ["/test/ping-pong/user-local1/docker-entrypoint.sh"]

CMD ["npm", "start"]
6 changes: 6 additions & 0 deletions test/ping-pong/user-local1/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /bin/bash
set -o errexit
set -o pipefail
# wait until there's a optimist instance up
while ! nc -z ${CLIENT_HOST:-client} ${CLIENT_PORT:-80}; do sleep 3; done
exec "$@"
Loading

0 comments on commit 3548503

Please sign in to comment.