Skip to content

Commit

Permalink
feat(example): make cartrade support more environments
Browse files Browse the repository at this point in the history
Signed-off-by: Yasushi Takahashi <t-yasushi@fujitsu.com>

feat(example): make cartrade support more environments

Signed-off-by: Yasushi Takahashi <t-yasushi@fujitsu.com>
  • Loading branch information
t-yasushi authored and petermetz committed Dec 3, 2021
1 parent 45c4a69 commit e7e0402
Show file tree
Hide file tree
Showing 3 changed files with 733 additions and 0 deletions.
133 changes: 133 additions & 0 deletions tools/docker/fabric14-fabcar-testnet/fabric-samples_dockerize.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
diff -uprN fabric-samples/fabcar/javascript/invoke.js fabric-samples-new/fabcar/javascript/invoke.js
--- fabric-samples/fabcar/javascript/invoke.js 2021-11-20 01:57:56.330128169 +0900
+++ fabric-samples-new/fabcar/javascript/invoke.js 2021-11-20 02:02:43.528133958 +0900
@@ -27,7 +27,7 @@ async function main() {

// Create a new gateway for connecting to our peer node.
const gateway = new Gateway();
- await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } });
+ await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: false } });

// Get the network (channel) our contract is deployed to.
const network = await gateway.getNetwork('mychannel');
diff -uprN fabric-samples/fabcar/javascript/query.js fabric-samples-new/fabcar/javascript/query.js
--- fabric-samples/fabcar/javascript/query.js 2021-11-20 01:57:56.330128169 +0900
+++ fabric-samples-new/fabcar/javascript/query.js 2021-11-20 02:02:31.874133723 +0900
@@ -27,7 +27,7 @@ async function main() {

// Create a new gateway for connecting to our peer node.
const gateway = new Gateway();
- await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } });
+ await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: false } });

// Get the network (channel) our contract is deployed to.
const network = await gateway.getNetwork('mychannel');
diff -uprN fabric-samples/fabcar/javascript/registerUser.js fabric-samples-new/fabcar/javascript/registerUser.js
--- fabric-samples/fabcar/javascript/registerUser.js 2021-11-20 01:57:56.330128169 +0900
+++ fabric-samples-new/fabcar/javascript/registerUser.js 2021-11-20 02:02:23.468133554 +0900
@@ -34,7 +34,7 @@ async function main() {

// Create a new gateway for connecting to our peer node.
const gateway = new Gateway();
- await gateway.connect(ccpPath, { wallet, identity: 'admin', discovery: { enabled: true, asLocalhost: true } });
+ await gateway.connect(ccpPath, { wallet, identity: 'admin', discovery: { enabled: true, asLocalhost: false } });

// Get the CA client object from the gateway for interacting with the CA.
const ca = gateway.getClient().getCertificateAuthority();
diff -uprN fabric-samples/first-network/ccp-template.json fabric-samples-new/first-network/ccp-template.json
--- fabric-samples/first-network/ccp-template.json 2021-11-20 01:57:56.332128169 +0900
+++ fabric-samples-new/first-network/ccp-template.json 2021-11-20 02:04:35.739136220 +0900
@@ -25,7 +25,7 @@
},
"peers": {
"peer0.org${ORG}.example.com": {
- "url": "grpcs://localhost:${P0PORT}",
+ "url": "grpcs://xx.xx.xx.xx:${P0PORT}",
"tlsCACerts": {
"pem": "${PEERPEM}"
},
@@ -35,7 +35,7 @@
}
},
"peer1.org${ORG}.example.com": {
- "url": "grpcs://localhost:${P1PORT}",
+ "url": "grpcs://xx.xx.xx.xx:${P1PORT}",
"tlsCACerts": {
"pem": "${PEERPEM}"
},
@@ -47,7 +47,7 @@
},
"certificateAuthorities": {
"ca.org${ORG}.example.com": {
- "url": "https://localhost:${CAPORT}",
+ "url": "https://xx.xx.xx.xx:${CAPORT}",
"caName": "ca-org${ORG}",
"tlsCACerts": {
"pem": "${CAPEM}"
diff -uprN fabric-samples/first-network/ccp-template.yaml fabric-samples-new/first-network/ccp-template.yaml
--- fabric-samples/first-network/ccp-template.yaml 2021-11-20 01:57:56.332128169 +0900
+++ fabric-samples-new/first-network/ccp-template.yaml 2021-11-20 02:05:08.358136877 +0900
@@ -17,7 +17,7 @@ organizations:
- ca.org${ORG}.example.com
peers:
peer0.org${ORG}.example.com:
- url: grpcs://localhost:${P0PORT}
+ url: grpcs://xx.xx.xx.xx:${P0PORT}
tlsCACerts:
pem: |
${PEERPEM}
@@ -25,7 +25,7 @@ peers:
ssl-target-name-override: peer0.org${ORG}.example.com
hostnameOverride: peer0.org${ORG}.example.com
peer1.org${ORG}.example.com:
- url: grpcs://localhost:${P1PORT}
+ url: grpcs://xx.xx.xx.xx:${P1PORT}
tlsCACerts:
pem: |
${PEERPEM}
@@ -34,7 +34,7 @@ peers:
hostnameOverride: peer1.org${ORG}.example.com
certificateAuthorities:
ca.org${ORG}.example.com:
- url: https://localhost:${CAPORT}
+ url: https://xx.xx.xx.xx:${CAPORT}
caName: ca-org${ORG}
tlsCACerts:
pem: |
diff -uprN fabric-samples/first-network/docker-compose-cli.yaml fabric-samples-new/first-network/docker-compose-cli.yaml
--- fabric-samples/first-network/docker-compose-cli.yaml 2021-11-20 01:57:56.333128169 +0900
+++ fabric-samples-new/first-network/docker-compose-cli.yaml 2021-11-20 02:00:28.408131234 +0900
@@ -92,3 +92,32 @@ services:
- peer1.org2.example.com
networks:
- byfn
+
+ validator:
+ container_name: validator
+ image: node:14.18.1
+ tty: true
+ stdin_open: true
+ environment:
+ - http_proxy=$http_proxy
+ - https_proxy=$https_proxy
+ - HTTP_PROXY=$HTTP_PROXY
+ - HTTPS_PROXY=$HTTPS_PROXY
+ - ftp_proxy=$ftp_proxy
+ - FTP_PROXY=$FTP_PROXY
+ - no_proxy=$no_proxy
+ - NO_PROXY=$NO_PROXY
+ volumes:
+ - ./:/app/first-network
+ - ../fabcar:/app/fabcar
+ working_dir: /app
+ command: /bin/bash
+ depends_on:
+ - cli
+ - orderer.example.com
+ - peer0.org1.example.com
+ - peer1.org1.example.com
+ - peer0.org2.example.com
+ - peer1.org2.example.com
+ networks:
+ - byfn
+
Loading

0 comments on commit e7e0402

Please sign in to comment.