diff --git a/etc/cactus/validator-registry-config.yaml b/etc/cactus/validator-registry-config.yaml index 9e586b7de6..b5c02e6bd3 100644 --- a/etc/cactus/validator-registry-config.yaml +++ b/etc/cactus/validator-registry-config.yaml @@ -1,5 +1,5 @@ ledgerPluginInfo: - - + - validatorID: 84jUisrs validatorType: socketio validatorURL: https://localhost:5050 @@ -7,32 +7,32 @@ ledgerPluginInfo: ledgerInfo: ledgerAbstract: Go-Ethereum Ledger apiInfo: - - + - apiType: getNumericBalance requestedData: - - + - dataName: referedAddress dataType: string - - + - apiType: transferNumericAsset requestedData: - - + - dataName: fromAddress dataType: string - - + - dataName: toAddress dataType: string - - + - dataName: amount dataType: number - - + - apiType: sendRawTransaction requestedData: - - + - dataName: serializedTx dataType: string - - + - validatorID: r9IS4dDf validatorType: socketio validatorURL: https://localhost:5040 @@ -40,26 +40,26 @@ ledgerPluginInfo: ledgerInfo: ledgerAbstract: Fabric Ledger apiInfo: - - + - apiType: changeCarOwner requestedData: - - + - dataName: carId dataType: string - - + - dataName: newOwner dataType: string - - + - apiType: sendSignedProposal requestedData: - - + - dataName: signedCommitProposal dataType: string - - + - dataName: commitReq dataType: string - - + - validatorID: sUr7d10R validatorType: socketio validatorURL: https://localhost:5140 @@ -68,16 +68,16 @@ ledgerPluginInfo: ledgerAbstract: Sawtooth Ledger apiInfo: [] - - + - validatorID: 3PfTJw8g validatorType: socketio - validatorURL: http://172.16.0.4:8000 + validatorURL: http://localhost:10080 validatorKeyPath: ./validatorKey/3PfTJw8g/3PfTJw8g.crt ledgerInfo: ledgerAbstract: "Indy Ledger" apiInfo: [] - - + - validatorID: vIdO32CB validatorType: openapi validatorURL: http://localhost:5053/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/ @@ -86,7 +86,7 @@ ledgerPluginInfo: ledgerAbstract: "Cactus Besu Ledger via http connection" apiInfo: [] - - + - validatorID: vIdO32CF validatorType: openapi validatorURL: http://localhost:5053/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/ @@ -95,7 +95,7 @@ ledgerPluginInfo: ledgerAbstract: "Cactus Fabric Ledger via http connection" apiInfo: [] - - + - validatorID: vIdO32CQ validatorType: openapi validatorURL: http://localhost:5053/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/ @@ -115,7 +115,7 @@ signTxInfo: fabric: mspID: Org1MSP peers: - - + - name: peer0.org1.example.com requests: grpc://localhost:7051 orderer: diff --git a/examples/register-indy-data/Dockerfile b/examples/register-indy-data/Dockerfile new file mode 100644 index 0000000000..af5828a251 --- /dev/null +++ b/examples/register-indy-data/Dockerfile @@ -0,0 +1,18 @@ +# Simple tool for setup and sending requests to discounted-cartrade sample app +# Run as part of docker-compose or remember to use host network + +FROM clientbase + +# Default IP for test indy pool on localhost +ENV TEST_POOL_IP 172.16.0.2 + +USER root +RUN mkdir -p "/etc/cactus/indy-validator/" && chown -R indy "/etc/cactus/" +VOLUME [ "/etc/cactus/" ] + +USER indy +WORKDIR /home/indy +COPY --chown=indy:indy './req_discounted_cartrade.py' './src/' +RUN cp 'from-indy-sdk/utils.py' './src/' + +ENTRYPOINT [ "python3", "-m", "src.req_discounted_cartrade" ] diff --git a/examples/register-indy-data/README.md b/examples/register-indy-data/README.md new file mode 100644 index 0000000000..b4e8cc8453 --- /dev/null +++ b/examples/register-indy-data/README.md @@ -0,0 +1,28 @@ +# req_discounted_cartrade + +Simple tool for setup and sending requests to discounted-cartrade sample app + +# How to use +- Setup discounted-cartrade first +- Build clientbase from `tools/docker/indy-testnet/clientbase` +- Build this container `docker build . -t req_discounted_cartrade` +- `mkdir -p /etc/cactus/indy-validator/` + +## Usage + +### Generate proof only +- Will replace existing proof file (like called with -f flag) + +``` +docker run --rm -ti -v/etc/cactus/:/etc/cactus/ --net="host" req_discounted_cartrade --proof_only +``` + +### Send discounted-cartrade request +``` +docker run --rm -ti -v/etc/cactus/:/etc/cactus/ --net="host" req_discounted_cartrade +``` + +### Recreate the proof and send discounted-cartrade request +``` +docker run --rm -ti -v/etc/cactus/:/etc/cactus/ --net="host" req_discounted_cartrade --force +``` \ No newline at end of file diff --git a/examples/register-indy-data/req_discounted_cartrade.py b/examples/register-indy-data/req_discounted_cartrade.py index c55a3dfe9a..f7ffc306e6 100644 --- a/examples/register-indy-data/req_discounted_cartrade.py +++ b/examples/register-indy-data/req_discounted_cartrade.py @@ -8,7 +8,7 @@ import argparse import sys from ctypes import * -from os.path import dirname +from os.path import dirname, isfile from indy.error import ErrorCode, IndyError @@ -39,7 +39,7 @@ "authParams": ["<>"] } -file_name = "myproof.json" +proof_file_path = "/etc/cactus/indy-validator/myproof.json" #parser = argparse.ArgumentParser(description='Run python getting-started scenario (Alice/Faber)') parser = argparse.ArgumentParser(description='Run python getting-started scenario (Alice/Acme/Thrift)') @@ -48,7 +48,8 @@ parser.add_argument('-e', '--entrypoint', help='entry point for dynamic library') parser.add_argument('-c', '--config', help='entry point for dynamic library') parser.add_argument('-s', '--creds', help='entry point for dynamic library') -parser.add_argument('-m', '--mode', help='mode of send http request') +parser.add_argument('-p', '--proof_only', help="create only the proof, don't start the cartrade", action='store_true') +parser.add_argument('-f', '--force', help="force recreate the proof (even if already exists)", action='store_true') args = parser.parse_args() @@ -82,7 +83,7 @@ async def run(): logger.info("Getting started -> started") - if not(args.mode == "http"): + if (not isfile(proof_file_path)) or args.force or args.proof_only: pool_ = { 'name': 'pool1' } @@ -426,14 +427,16 @@ async def apply_loan_basic(): ##request_json = { "proof_request": json.dumps(alice['apply_loan_proof_request']), "proof": json.dumps(alice['apply_loan_proof'])} request_json = { "proof_request": alice['apply_loan_proof_request'], "proof": alice['apply_loan_proof']} logger.info(json.dumps(request_json)) - - # create_user_proof_file(file_name, json.dumps(request_str)) - create_user_proof_file(file_name, json.dumps(request_json)) + + # create_user_proof_file(proof_file_path, json.dumps(request_str)) + create_user_proof_file(proof_file_path, json.dumps(request_json)) await apply_loan_basic() - request_discounted_cartrade(file_name) + if not args.proof_only: + request_discounted_cartrade(proof_file_path) + print("Done.") def wallet_config(operation, wallet_config_str): if not args.storage_type: @@ -616,6 +619,7 @@ def create_user_proof_file(json_file, user_proof): logger.info(f"called create_user_proof_file()") with open(json_file, 'w') as file: file.write(user_proof) + logger.info(f"Saved proof to {json_file}") def request_discounted_cartrade(json_file): # read json file @@ -626,7 +630,7 @@ def request_discounted_cartrade(json_file): # append data of json file to http req param http_req_params["tradeParams"].append(json_str) - + # logger.info(f"http_params: url: {http_req_params['url']}") # logger.info(f"http_params: businessLogicID: {http_req_params['businessLogicID']}") # logger.info(f"http_params: tradeParams: {http_req_params['tradeParams']}") @@ -641,7 +645,7 @@ def request_discounted_cartrade(json_file): 'authParams': http_req_params["authParams"]} logger.info(f"req_body: {req_body}") - + # response = requests.post( # http_req_params["url"], diff --git a/packages-python/cactus_validator_socketio/testcli/package.json b/packages-python/cactus_validator_socketio/testcli/package.json index ac01e019a1..d91e0bb5fc 100644 --- a/packages-python/cactus_validator_socketio/testcli/package.json +++ b/packages-python/cactus_validator_socketio/testcli/package.json @@ -3,6 +3,7 @@ "version": "0.0.0", "private": true, "dependencies": { + "jsonwebtoken": "^8.5.1", "socket.io-client": "4.1.3" } } diff --git a/packages-python/cactus_validator_socketio/testcli/testsock.js b/packages-python/cactus_validator_socketio/testcli/testsock.js index 6f7e04dcdd..b3f2d77ea9 100644 --- a/packages-python/cactus_validator_socketio/testcli/testsock.js +++ b/packages-python/cactus_validator_socketio/testcli/testsock.js @@ -1,37 +1,45 @@ const fs = require("fs"); const jwt = require("jsonwebtoken"); -const JSONbig = require('json-bigint'); +const { exit } = require("process"); +const io = require("socket.io-client"); -// NOTE: Run pip install socket.io-client. -const io = require('socket.io-client'); -const url = "http://172.16.0.4:8000"; -// const url = "http://localhost:8000"; +const url = "http://localhost:10080"; const socket = io(url, { - //transports: [ 'websocket', 'polling'] + //transports: [ 'websocket', 'polling'] }); +const proofFilePath = "/etc/cactus/indy-validator/myproof.json"; const crtPath = "3PfTJw8g.crt"; const paramAlgorithm = "ES256"; -socket.on('connect', () => { - console.log('connect'); - console.log(socket.id); - const transport = socket.io.engine.transport.name; - console.log(transport); - //socket.emit('mymessage', 'hoge'); +socket.on("connect", () => { + console.log("connect"); + console.log(socket.id); + const transport = socket.io.engine.transport.name; + console.log(transport); + //socket.emit('mymessage', 'hoge'); }); -socket.on('mymessage', () => { - console.log('received mymessage'); +socket.on("mymessage", () => { + console.log("received mymessage"); }); socket.on("response", (result) => { - console.log(`#[recv]response, res: ${result}`); - responseFlag = true; - decodeFunc(result.resObj.data); + console.log(`#[recv]response, res: ${result}`); + responseFlag = true; + decodeFunc(result.resObj.data) + .then(() => { + console.log("OK - Done."); + exit(0); + }) + .catch(() => { + console.log("Decode ERROR - Abort."); + exit(1); + }); }); -const verify = (signature) => new Promise(resolve => { +const verify = (signature) => + new Promise((resolve, reject) => { const publicKey = fs.readFileSync(crtPath); const option = { @@ -39,90 +47,76 @@ const verify = (signature) => new Promise(resolve => { }; jwt.verify(signature, publicKey, option, (err, decoded) => { - return new Promise((resolve, reject) => { - if (err) { - // Authentication NG - console.log(`Authentication NG : error = ${err}`); - reject(err); - } else { - // Authentication OK - console.log(`Authentication OK`); - - resolve(decoded); - } - }); + if (err) { + console.log(`Authentication NG : error = ${err}`); + reject(err); + } else { + console.log("Authentication OK"); + resolve(decoded); + } }); -}); + }); const decodeFunc = async (signsignature) => { - try { - console.log("call verify()"); - console.log(`##signsignature: ${signsignature}`); - const decoded = await verify(signsignature); - console.log(`##decoded: ${decoded}`); - - } catch (err) { - console.log(`err: ${err}`); - } + try { + console.log("call verify()"); + console.log(`##signsignature: ${signsignature}`); + const decoded = await verify(signsignature); + console.log("##decoded:", decoded); + } catch (err) { + console.log(`err: ${err}`); + } }; // socket.emit('nop'); -socket.emit('startMonitor'); +socket.emit("startMonitor"); -socket.emit('test-event'); +socket.emit("test-event"); setTimeout(() => { - console.log('call nop!'); - socket.emit('nop'); -}, 1000); - - - + console.log("call nop!"); + socket.emit("nop"); +}, 1000); setTimeout(() => { - console.log('call request2. get schema request.'); - - let proofRequestJson; - let proofJson; - try { - let input_obj = JSON.parse(fs.readFileSync('myproof.json')); - proofRequestJson = JSON.parse(input_obj['proof_request']); - proofJson = JSON.parse(input_obj['proof']); - } - catch (err) { - console.error('Error while reading proof and proof request. returning false.'); - return false; - } - - did = null; - - let count = 0; - - let identifiers = proofJson['identifiers'] - for(let referent of Object.keys(identifiers)) { - let item = identifiers[referent]; - let args_request_getSchema = {"did": did, "schemaId": item['schema_id']}; - - // Call Validator - const requestData = { - contract: {"channelName": "mychannel", "contractName": "indysomething"}, - method: {type: "evaluateTransaction", command: "get_schema"}, - args: {args: args_request_getSchema}, - reqID: "reqID_test" - }; - - socket.emit('request2', requestData); - } + console.log("call request2. get schema request."); + + let proofJson; + try { + let input_obj = JSON.parse(fs.readFileSync(proofFilePath)); + proofJson = JSON.parse(input_obj["proof"]); + } catch (err) { + console.error( + "Error while reading proof and proof request. returning false.", + ); + return false; + } + + did = null; + + let identifiers = proofJson["identifiers"]; + for (let referent of Object.keys(identifiers)) { + let item = identifiers[referent]; + let args_request_getSchema = { did: did, schemaId: item["schema_id"] }; -}, 2000); + // Call Validator + const requestData = { + contract: { channelName: "mychannel", contractName: "indysomething" }, + method: { type: "evaluateTransaction", command: "get_schema" }, + args: { args: args_request_getSchema }, + reqID: "reqID_test", + }; + socket.emit("request2", requestData); + } +}, 2000); /* setTimeout(() => { console.log('call request2. args_schema request.'); args_schema = "{\"reqId\":1625126127546406478,\"identifier\":\"FVb5jZqvKmr15RgWrNpvjb\",\"operation\":{\"type\":\"107\",\"dest\":\"LXipD5CTqVsZDwm5xieomb\",\"data\":{\"name\":\"Job-Certificate\",\"version\":\"0.2\"}},\"protocolVersion\":2}"; - + // Call Validator const requestData = { contract: {"channelName": "mychannel", "contractName": "indysomething"}, diff --git a/tools/docker/indy-testnet/clientbase/Dockerfile b/tools/docker/indy-testnet/clientbase/Dockerfile index b8a92ed2dd..5be9bbc9b6 100644 --- a/tools/docker/indy-testnet/clientbase/Dockerfile +++ b/tools/docker/indy-testnet/clientbase/Dockerfile @@ -1,36 +1,58 @@ -FROM ubuntu:bionic - -ENV DEBIAN_FRONTEND noninteractive - -RUN apt-get update && apt-get upgrade -y && apt-get install -y software-properties-common apt-transport-https supervisor - -# indy libraries and tool -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 -RUN add-apt-repository "deb https://repo.sovrin.org/sdk/deb bionic stable" -RUN apt-get update -RUN apt-get install -y libindy libnullpay libvcx indy-cli - -# Python 3.9 (indy-sdk requires 3.6 and later) -RUN add-apt-repository -y ppa:deadsnakes/ppa -RUN apt-get update && apt-get install -y python3.9 python3.9-dev python3.9-venv python3.9-distutils python3.9-venv python3-venv +# Indy-SDK CLI Image +# Contains node and python environments and indy SDK, can be used as base for indy development. -# Node.js v12 (Cactus requres v12) -RUN apt-get install -y nodejs npm curl -RUN npm install n -g -RUN n 12 -RUN apt purge -y nodejs npm -RUN npm install indy-sdk +FROM ubuntu:bionic -# user should run their scripts as indy (home: /home/indy) -RUN groupadd indy -RUN useradd -m indy -g indy +ENV DEBIAN_FRONTEND 'noninteractive' + +RUN apt-get update \ + && apt-get install -y \ + gnupg \ + software-properties-common \ + python3-apt \ + curl \ + dirmngr \ + apt-transport-https \ + lsb-release ca-certificates \ + gcc \ + g++ \ + make \ + && rm -rf /var/lib/apt/lists/* + +# NodeJS and indy-sdk +RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \ + && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 \ + && add-apt-repository "deb https://repo.sovrin.org/sdk/deb bionic stable" \ + && apt-get update && apt-get install -y \ + nodejs \ + libindy \ + libnullpay \ + libvcx \ + indy-cli \ + && npm install indy-sdk \ + && npm cache clean --force \ + && rm -rf /var/lib/apt/lists/* + +# Python 3.8 +# WARNING +# update-alternatives here is convinient, but can cause troubles with some missing os packages (like python3-apt) +# in case of any errors, remove it and use explicit python3.8 +RUN apt-get update \ + && apt-get install -y python3.8 \ + && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2 \ + && apt-get install -y python3-pip \ + && pip3 install --upgrade pip \ + && pip3 install \ + python3-indy \ + requests \ + && rm -rf /var/lib/apt/lists/* + +RUN groupadd indy && useradd -m indy -g indy COPY --chown=indy:indy from-indy-sdk /home/indy/from-indy-sdk -WORKDIR /home/indy +# User should run their scripts as indy USER indy -RUN python3.9 -m venv .venv -RUN . .venv/bin/activate && pip install python3-indy requests - +WORKDIR /home/indy -# immediately exits +CMD [ "/bin/bash" ] diff --git a/tools/docker/indy-testnet/docker-compose.yaml b/tools/docker/indy-testnet/docker-compose.yaml index 15d838219c..5e55ee91b0 100644 --- a/tools/docker/indy-testnet/docker-compose.yaml +++ b/tools/docker/indy-testnet/docker-compose.yaml @@ -27,7 +27,7 @@ services: # build: # context: ./nginx # dockerfile: custom-nginx.dockerfile - image: nginx:stable-alpine + image: nginx:1.20-alpine volumes: - type: bind source: "./nginx/nginx.conf" diff --git a/tools/docker/indy-testnet/indy_pool/indy-pool.dockerfile b/tools/docker/indy-testnet/indy_pool/indy-pool.dockerfile index e850e48410..fca263019a 100644 --- a/tools/docker/indy-testnet/indy_pool/indy-pool.dockerfile +++ b/tools/docker/indy-testnet/indy_pool/indy-pool.dockerfile @@ -1,3 +1,7 @@ +# Runs indy pool for testing purpose +# Original source - https://github.com/hyperledger/indy-sdk/blob/master/ci/indy-pool.dockerfile +# Changes marked with `EDIT` + FROM ubuntu:16.04 ARG uid=1000 @@ -34,7 +38,7 @@ ARG python3_orderedset_ver=2.0 ARG python3_psutil_ver=5.4.3 ARG python3_pympler_ver=0.5 -RUN apt-get update -y && apt-get install -y --allow-unauthenticated \ +RUN apt-get update -y && apt-get install -y \ python3-pyzmq=${python3_pyzmq_ver} \ indy-plenum=${indy_plenum_ver} \ indy-node=${indy_node_ver} \ @@ -92,26 +96,11 @@ USER indy RUN awk '{if (index($1, "NETWORK_NAME") != 0) {print("NETWORK_NAME = \"sandbox\"")} else print($0)}' /etc/indy/indy_config.py> /tmp/indy_config.py RUN mv /tmp/indy_config.py /etc/indy/indy_config.py +# EDIT - Use different default pool IP ARG pool_ip=172.16.0.2 - -# sudo to indy after initialization -USER root -RUN apt-get install -y sudo -RUN sudo usermod -aG sudo indy -RUN echo "#!/bin/bash\n\ -\n\ -sudo chown indy:indy /var/lib/indy/sandbox\n\ -\n\ -if [ ! -e '/var/lib/indy/sandbox/pool_transactions_genesis' ]; then\n\ - generate_indy_pool_transactions --nodes 4 --clients 5 --nodeNum 1 2 3 4 --ips="$pool_ip,$pool_ip,$pool_ip,$pool_ip" \n\ -fi\n\ -\n\ -/usr/bin/supervisord\n\ -" >> /usr/bin/pool_init_if_necessary - -RUN chmod +x /usr/bin/pool_init_if_necessary - +ENV POOL_IP=$pool_ip EXPOSE 9701 9702 9703 9704 9705 9706 9707 9708 -USER indy -CMD ["sudo", "-u", "indy", "-g", "indy", "/usr/bin/pool_init_if_necessary"] +# EDIT - Use different entry script- generate indy pool just once +COPY --chown=indy 'startup.sh' '/usr/bin/' +CMD [ "/usr/bin/startup.sh" ] diff --git a/tools/docker/indy-testnet/indy_pool/startup.sh b/tools/docker/indy-testnet/indy_pool/startup.sh new file mode 100755 index 0000000000..b3277c6f69 --- /dev/null +++ b/tools/docker/indy-testnet/indy_pool/startup.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +echo ${POOL_IP} + +if [ ! -e '/var/lib/indy/sandbox/pool_transactions_genesis' ]; then + generate_indy_pool_transactions --nodes 4 --clients 5 --nodeNum 1 2 3 4 --ips="${POOL_IP},${POOL_IP},${POOL_IP},${POOL_IP}" +fi + +/usr/bin/supervisord diff --git a/tools/docker/indy-testnet/nginx/nginx.conf b/tools/docker/indy-testnet/nginx/nginx.conf index 8ba39bbeb2..e6a9eb94c7 100644 --- a/tools/docker/indy-testnet/nginx/nginx.conf +++ b/tools/docker/indy-testnet/nginx/nginx.conf @@ -1,10 +1,12 @@ +# Based on default nginx:1.20-alpine config + user nginx; worker_processes auto; +#error_log /dev/stdout info; error_log /var/log/nginx/error.log notice; pid /var/run/nginx.pid; - events { worker_connections 1024; } @@ -17,34 +19,28 @@ http { '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; + #access_log /dev/stdout; access_log /var/log/nginx/access.log main; - sendfile on; - #tcp_nopush on; - keepalive_timeout 65; - #gzip on; + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } server { listen 80; charset utf-8; location / { - proxy_pass http://172.16.0.4:8000; - include uwsgi_params; - client_max_body_size 20M; - } - - location /socket.io/ { + proxy_pass http://validator:8000; + proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; + proxy_set_header Connection $connection_upgrade; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; - proxy_http_version 1.1; - proxy_pass http://172.16.0.4:8000; + proxy_read_timeout 120s; } } - - } diff --git a/tools/docker/indy-testnet/validator/Dockerfile b/tools/docker/indy-testnet/validator/Dockerfile index fdadba673d..7ccb9eae64 100644 --- a/tools/docker/indy-testnet/validator/Dockerfile +++ b/tools/docker/indy-testnet/validator/Dockerfile @@ -1,41 +1,20 @@ FROM clientbase -USER root - -RUN echo "[supervisord]\n\ -logfile = /tmp/supervisord.log\n\ -logfile_maxbytes = 50MB\n\ -logfile_backups=10\n\ -logLevel = error\n\ -pidfile = /tmp/supervisord.pid\n\ -nodaemon = true\n\ -minfds = 1024\n\ -minprocs = 200\n\ -umask = 022\n\ -user = indy\n\ -identifier = supervisor\n\ -directory = /tmp\n\ -nocleanup = true\n\ -childlogdir = /tmp\n\ -strip_ansi = false\n\ -\n\ -[program:validator]\n\ -command=/bin/bash -c '. .venv/bin/activate && echo start-server && TEST_POOL_IP=172.16.0.2 python3.9 main.py'\n\ -directory=/home/indy/cactus_validator_socketio/validator-python\n\ -">> /etc/supervisord.conf +WORKDIR /home/indy USER indy -WORKDIR /home/indy +COPY --chown=indy:indy './cactus_validator_socketio' 'cactus_validator_socketio' +RUN cp 'from-indy-sdk/utils.py' './cactus_validator_socketio/validator-python/validator_socketio_module/' -COPY --chown=indy:indy ./cactus_validator_socketio cactus_validator_socketio USER root -RUN cp -r ./cactus_validator_socketio/etc/cactus/ /etc +RUN apt-get update \ + && apt-get install -y supervisor \ + && rm -rf /var/lib/apt/lists/* +RUN cp -r './cactus_validator_socketio/etc/cactus/' '/etc' +COPY --chown=indy 'supervisord.conf' '/etc/' + USER indy -RUN cp from-indy-sdk/utils.py cactus_validator_socketio/validator-python/validator_socketio_module/ WORKDIR /home/indy/cactus_validator_socketio/validator-python/ -RUN python3.9 -m venv .venv -# -RUN . .venv/bin/activate && pip3.9 install -r requirements.txt +RUN pip3 install -r requirements.txt CMD [ "/usr/bin/supervisord" ] -#CMD [ "tail", "-f", "/dev/null" ] diff --git a/tools/docker/indy-testnet/validator/supervisord.conf b/tools/docker/indy-testnet/validator/supervisord.conf new file mode 100644 index 0000000000..ed76c5008d --- /dev/null +++ b/tools/docker/indy-testnet/validator/supervisord.conf @@ -0,0 +1,20 @@ +[supervisord] +logfile = /tmp/supervisord.log +logfile_maxbytes = 50MB +logfile_backups=10 +logLevel = debug +pidfile = /tmp/supervisord.pid +nodaemon = true +minfds = 1024 +minprocs = 200 +umask = 022 +user = indy +identifier = supervisor +directory = /tmp +nocleanup = true +childlogdir = /tmp +strip_ansi = false + +[program:validator] +command=/bin/bash -c 'echo start-server && TEST_POOL_IP=172.16.0.2 python3 main.py' +directory=/home/indy/cactus_validator_socketio/validator-python