From 6d2f91fb0f3dd796c2ea4ae9ea0eb0fe08543941 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Wed, 17 Sep 2025 13:43:47 +0200 Subject: [PATCH 1/7] feat-test-peer-dev-mode-with-tls Signed-off-by: Pereowei Daniel --- samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json | 4 ++-- src/validate/index.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json b/samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json index 2d6cc001..d27e2749 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json @@ -2,7 +2,7 @@ "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.12", - "tls": false, + "tls": true, "peerDevMode": true, "engine": "docker" }, @@ -16,7 +16,7 @@ "orderers": [ { "groupName": "group1", - "type": "solo", + "type": "raft", "instances": 1 } ] diff --git a/src/validate/index.ts b/src/validate/index.ts index ed6e25e6..6c33cc02 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -123,7 +123,7 @@ class ValidateGenerator extends Generator { this._validateChaincodes(capabilities, networkConfig.chaincodes); this._validateExplorer(networkConfig.global, networkConfig.orgs); this._validateExplorerWithFabricVersion(networkConfig.global, networkConfig.orgs); - this._validateDevMode(networkConfig.global); + // this._validateDevMode(networkConfig.global); this._verifyFabricVersion(networkConfig.global); } From ad448135a51e33e8c9967da38c4421d01471d500 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Wed, 17 Sep 2025 22:23:02 +0200 Subject: [PATCH 2/7] fix-trace failure point Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-07-v2-peer-dev-mode.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-network/docker/test-07-v2-peer-dev-mode.sh b/e2e-network/docker/test-07-v2-peer-dev-mode.sh index 6e9d6e98..ab1921fa 100755 --- a/e2e-network/docker/test-07-v2-peer-dev-mode.sh +++ b/e2e-network/docker/test-07-v2-peer-dev-mode.sh @@ -25,7 +25,7 @@ dumpLogs() { networkDown() { sleep 2 (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) + # (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) } waitForContainer() { From a3570378587cb70466179a9544ab0200ea21451d Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 19 Sep 2025 08:40:21 +0200 Subject: [PATCH 3/7] fix-start chaincode with mounted tls certs Signed-off-by: Pereowei Daniel --- .../docker/test-07-v2-peer-dev-mode.sh | 22 +- .../chaincode-kv-node/package-lock.json | 520 +++++++++++++++++- .../chaincodes/chaincode-kv-node/package.json | 3 +- .../commands-generated/chaincode-dev-v2.sh | 25 +- .../fabric-docker/docker-compose.yaml | 2 +- .../scripts/chaincode-functions-v2.sh | 74 +++ 6 files changed, 628 insertions(+), 18 deletions(-) diff --git a/e2e-network/docker/test-07-v2-peer-dev-mode.sh b/e2e-network/docker/test-07-v2-peer-dev-mode.sh index ab1921fa..eb170469 100755 --- a/e2e-network/docker/test-07-v2-peer-dev-mode.sh +++ b/e2e-network/docker/test-07-v2-peer-dev-mode.sh @@ -53,22 +53,22 @@ networkUp # check if all nodes are ready waitForContainer "orderer0.group1.orderer.example.com" "Beginning to serve requests" waitForContainer "db.ca.org1.example.com" "database system is ready to accept connections" -waitForContainer "ca.org1.example.com" "Listening on http://0.0.0.0:7054" +waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" waitForContainer "couchdb.peer0.org1.example.com" "Apache CouchDB has started. Time to relax." waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" echo "All nodes are ready" -echo "Starting chaincode in development mode..." -# make sure nodemon is installed and Install if not -if ! command -v nodemon &> /dev/null; then - echo "nodemon could not be found, installing..." - npm install -g nodemon -else - echo "nodemon is already installed" -fi -# start the chaincode in development mode -(cd "$NODECHAINCODE" && npm i && npm run start:watch) & +# echo "Starting chaincode in development mode..." +# # make sure nodemon is installed and Install if not +# if ! command -v nodemon &> /dev/null; then +# echo "nodemon could not be found, installing..." +# npm install -g nodemon +# else +# echo "nodemon is already installed" +# fi +# # start the chaincode in development mode +# (cd "$NODECHAINCODE" && npm i && npm run start:watch) & sleep 5 diff --git a/samples/chaincodes/chaincode-kv-node/package-lock.json b/samples/chaincodes/chaincode-kv-node/package-lock.json index 2663e33d..d7f7b948 100644 --- a/samples/chaincodes/chaincode-kv-node/package-lock.json +++ b/samples/chaincodes/chaincode-kv-node/package-lock.json @@ -9,7 +9,8 @@ "version": "0.2.0", "dependencies": { "fabric-contract-api": "2.4.2", - "fabric-shim": "2.4.2" + "fabric-shim": "2.4.2", + "nodemon": "^3.0.1" }, "engines": { "node": ">=8", @@ -295,11 +296,82 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/async": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/class-transformer": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.4.0.tgz", @@ -358,6 +430,27 @@ "text-hex": "1.0.x" } }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -449,6 +542,17 @@ "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz", "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==" }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/fn.name": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", @@ -467,6 +571,19 @@ "node": ">=12" } }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -480,11 +597,35 @@ "resolved": "https://registry.npmjs.org/get-params/-/get-params-0.1.2.tgz", "integrity": "sha512-41eOxtlGgHQRbFyA8KTH+w+32Em3cRdfBud7j67ulzmIfmaHX9doq47s0fa4P5o9H64BZX9nrYI6sJvk46Op+Q==" }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==" + }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -495,6 +636,25 @@ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -503,6 +663,25 @@ "node": ">=8" } }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -558,11 +737,57 @@ "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, + "node_modules/nodemon": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.10.tgz", + "integrity": "sha512-WDjw3pJ0/0jMFmyNDp3gvY2YizjLmmOUQo6DEBY+JgdvW/yQ9mEeSw6H5ythl5Ny2ytb7f9C2nIbjSxMNzbJXw==", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/one-time": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", @@ -571,6 +796,17 @@ "fn.name": "1.x.x" } }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/protobufjs": { "version": "6.11.4", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.4.tgz", @@ -596,6 +832,11 @@ "pbts": "bin/pbts" } }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==" + }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", @@ -617,6 +858,17 @@ "node": ">= 6" } }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/reflect-metadata": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", @@ -657,6 +909,17 @@ "node": ">=10" } }, + "node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", @@ -665,6 +928,17 @@ "is-arrayish": "^0.3.1" } }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/stack-trace": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", @@ -705,11 +979,41 @@ "node": ">=8" } }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/text-hex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==" }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, "node_modules/triple-beam": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", @@ -720,6 +1024,11 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==" + }, "node_modules/universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", @@ -1057,11 +1366,62 @@ } } }, + "anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, "async": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==" + }, + "brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "requires": { + "fill-range": "^7.1.1" + } + }, + "chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, "class-transformer": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.4.0.tgz", @@ -1117,6 +1477,19 @@ "text-hex": "1.0.x" } }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "requires": { + "ms": "^2.1.3" + } + }, "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -1189,6 +1562,14 @@ "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz", "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==" }, + "fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, "fn.name": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", @@ -1204,6 +1585,12 @@ "universalify": "^2.0.0" } }, + "fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "optional": true + }, "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -1214,11 +1601,29 @@ "resolved": "https://registry.npmjs.org/get-params/-/get-params-0.1.2.tgz", "integrity": "sha512-41eOxtlGgHQRbFyA8KTH+w+32Em3cRdfBud7j67ulzmIfmaHX9doq47s0fa4P5o9H64BZX9nrYI6sJvk46Op+Q==" }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "requires": { + "is-glob": "^4.0.1" + } + }, "graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" + }, + "ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==" + }, "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -1229,11 +1634,37 @@ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" + }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, "is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -1281,11 +1712,41 @@ "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, "ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, + "nodemon": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.10.tgz", + "integrity": "sha512-WDjw3pJ0/0jMFmyNDp3gvY2YizjLmmOUQo6DEBY+JgdvW/yQ9mEeSw6H5ythl5Ny2ytb7f9C2nIbjSxMNzbJXw==", + "requires": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + }, "one-time": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", @@ -1294,6 +1755,11 @@ "fn.name": "1.x.x" } }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, "protobufjs": { "version": "6.11.4", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.4.tgz", @@ -1314,6 +1780,11 @@ "long": "^4.0.0" } }, + "pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==" + }, "punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", @@ -1329,6 +1800,14 @@ "util-deprecate": "^1.0.1" } }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "requires": { + "picomatch": "^2.2.1" + } + }, "reflect-metadata": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", @@ -1349,6 +1828,11 @@ "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==" }, + "semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==" + }, "simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", @@ -1357,6 +1841,14 @@ "is-arrayish": "^0.3.1" } }, + "simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "requires": { + "semver": "^7.5.3" + } + }, "stack-trace": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", @@ -1388,11 +1880,32 @@ "ansi-regex": "^5.0.1" } }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, "text-hex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==" }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==" + }, "triple-beam": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", @@ -1403,6 +1916,11 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" }, + "undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==" + }, "universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", diff --git a/samples/chaincodes/chaincode-kv-node/package.json b/samples/chaincodes/chaincode-kv-node/package.json index f50ae9b0..e115c1e9 100644 --- a/samples/chaincodes/chaincode-kv-node/package.json +++ b/samples/chaincodes/chaincode-kv-node/package.json @@ -16,6 +16,7 @@ }, "dependencies": { "fabric-contract-api": "2.4.2", - "fabric-shim": "2.4.2" + "fabric-shim": "2.4.2", + "nodemon": "^3.0.1" } } diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh index 130691b2..76dbcb4a 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh @@ -15,11 +15,11 @@ "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> "<%- chaincode.endorsement || '' %>" <% -%> "false" <% -%> - "" <% -%> + "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> "<%= chaincode.privateDataConfigFile || '' %>" <% -%> "" <% -%> "" -<% }) -%> + printItalics "Committing chaincode '<%= chaincode.name %>' on channel '<%= chaincode.channel.name %>' as '<%= chaincode.instantiatingOrg.name %>' (dev mode)" "U1F618" chaincodeCommit <% -%> "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> @@ -30,7 +30,24 @@ chaincodeCommit <% -%> "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> "<%- chaincode.endorsement || '' %>" <% -%> "false" <% -%> - "" <% -%> + "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> "<%= chaincode.channel.orgs.map((o) => o.headPeer.fullAddress).join(',') %>" <% -%> - "" <% -%> + "<%= !global.tls ? '' : chaincode.channel.orgs.map(o => `crypto-peer/${o.headPeer.address}/tls/ca.crt`).join(',') %>" <% -%> "<%= chaincode.privateDataConfigFile || '' %>" + +<% if (global.tls) { -%> + printHeadline "Launching devmode chaincode runtime for '<%= chaincode.name %>'" "U1F680" + startDevModeChaincodeProcess <% -%> + "<%= chaincode.name %>" <% -%> + "<%= chaincode.version %>" <% -%> + "<%= chaincode.lang %>" <% -%> + "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>" <% -%> + "<%= chaincode.instantiatingOrg.mspName %>" <% -%> + "peerOrganizations/<%= org.domain %>/peers/<%= chaincode.instantiatingOrg.headPeer.address %>/tls/ca.crt" <% -%> + "peerOrganizations/<%= chaincode.channel.ordererHead.domain %>/tlsca/tlsca.<%= chaincode.channel.ordererHead.domain %>-cert.pem" <% -%> + "<%= global.tls %>" <% -%> + "<%= chaincode.instantiatingOrg.headPeer.address %>" <% -%> + "<%= org.domain %>" + +<% } -%> +<% }) -%> diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index a209bd53..a9f1b4d4 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -289,7 +289,7 @@ services: # ccaas builder configuration - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"<%= peer.name %><%= org.name %>"} working_dir: /etc/hyperledger/fabric/peer/ - command: peer node start <%= global.peerDevMode ? '--peer-chaincodedev=true' : '' %> + command: peer node start <%= global.peerDevMode && !global.tls ? '--peer-chaincodedev=true' : '' %> ports: - <%= peer.port + 1000 %>:9440 - <%= peer.port %>:<%= peer.port %> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 3ebb118b..ab2f4255 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -264,6 +264,80 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } +startDevModeChaincodeProcess() { + local CHAINCODE_NAME="$1" + local CHAINCODE_VERSION="$2" + local CHAINCODE_LANG="$3" + local CHAINCODE_DIR="$4" + local ORG_MSP="$5" + local PEER_TLS_CA_REL="$6" + local ORDERER_TLS_CA_REL="$7" + local TLS_ENABLED="$8" + local PEER_ADDRESS="$9" + local ORG_DOMAIN=${10} + + local CC_ID="${CHAINCODE_NAME}:${CHAINCODE_VERSION}" + local CONTAINER_NAME="devmode-${CHAINCODE_NAME}" + + local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") + local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + # Generate certs for dev mode container + echo "Generating certifcates for dev mode container" + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + echo "Launching devmode chaincode container $CONTAINER_NAME" + echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" + echo " MSP: $ORG_MSP" + echo " PEER_TLS_CA: $PEER_TLS_CA_REL" + echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" + + local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + # Pick base image depending on lang + local CC_IMAGE="" + case "$CHAINCODE_LANG" in + node) + CC_IMAGE="node:16" + START_CMD="cd /usr/src/app && npm install && npm run start:watch" + ;; + golang|go) + CC_IMAGE="golang:1.20" + START_CMD="cd /usr/src/app && go mod tidy && go run ." + ;; + java) + CC_IMAGE="openjdk:11" + START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" + ;; + *) + echo "Unsupported chaincode language: $CHAINCODE_LANG" + exit 1 + ;; + esac + + local DOCKER_NETWORK + DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') + + docker run -d \ + --name "$CONTAINER_NAME" \ + -e CORE_CHAINCODE_ID_NAME="$CC_ID" \ + -e CORE_PEER_LOCALMSPID="$ORG_MSP" \ + -e CORE_CHAINCODE_LOGGING_LEVEL=debug \ + -e CORE_PEER_TLS_ENABLED=true \ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \ + -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \ + -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \ + -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \ + -v "$CHAINCODE_DIR:/usr/src/app" \ + --network "$DOCKER_NETWORK" \ + "$CC_IMAGE" \ + bash -c "$START_CMD" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 From df27f7f6128ee48f41ab29d126939e7da871641f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 19 Sep 2025 08:44:24 +0200 Subject: [PATCH 4/7] fix-start chaincode with mounted tls certs Signed-off-by: Pereowei Daniel --- e2e/__snapshots__/extendConfig.test.ts.snap | 74 ++--- ...1chaincode-peer-dev-mode.json.test.ts.snap | 267 +++++++++++++++--- ...rg-1chaincode-raft-ccaas.json.test.ts.snap | 74 +++++ ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 76 +++++ ...2chaincodes-private-data.yaml.test.ts.snap | 86 ++++++ ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 110 +++++++- ...1chaincode-raft-explorer.json.test.ts.snap | 83 +++++- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 74 +++++ ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 74 +++++ .../scripts/chaincode-functions-v2.sh | 2 +- 10 files changed, 839 insertions(+), 81 deletions(-) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 0d58dc30..68775686 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -1729,10 +1729,10 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "", - "discoveryUrls": "grpc://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "http://ca.org1.example.com:7054", + "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { "error": "console", "info": "console", @@ -1746,7 +1746,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "name": "my-channel1", "ordererGroup": { "configtxOrdererDefaults": "Group1Defaults", - "consensus": "solo", + "consensus": "etcdraft", "genesisBlockName": "Group1Genesis.block", "hostingOrgs": [ "Orderer", @@ -1755,7 +1755,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "ordererHead": { "address": "orderer0.group1.orderer.example.com", "adminPort": 7053, - "consensus": "solo", + "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", "name": "orderer0.group1", @@ -1767,7 +1767,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j { "address": "orderer0.group1.orderer.example.com", "adminPort": 7053, - "consensus": "solo", + "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", "name": "orderer0.group1", @@ -1780,7 +1780,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j { "address": "orderer0.group1.orderer.example.com", "adminPort": 7053, - "consensus": "solo", + "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", "name": "orderer0.group1", @@ -1794,7 +1794,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "ordererHead": { "address": "orderer0.group1.orderer.example.com", "adminPort": 7053, - "consensus": "solo", + "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", "name": "orderer0.group1", @@ -1871,10 +1871,10 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "", - "discoveryUrls": "grpc://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "http://ca.org1.example.com:7054", + "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { "error": "console", "info": "console", @@ -1960,10 +1960,10 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "", - "discoveryUrls": "grpc://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "http://ca.org1.example.com:7054", + "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { "error": "console", "info": "console", @@ -2052,10 +2052,10 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "", - "discoveryUrls": "grpc://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "http://ca.org1.example.com:7054", + "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { "error": "console", "info": "console", @@ -2069,7 +2069,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "name": "my-channel1", "ordererGroup": { "configtxOrdererDefaults": "Group1Defaults", - "consensus": "solo", + "consensus": "etcdraft", "genesisBlockName": "Group1Genesis.block", "hostingOrgs": [ "Orderer", @@ -2078,7 +2078,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "ordererHead": { "address": "orderer0.group1.orderer.example.com", "adminPort": 7053, - "consensus": "solo", + "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", "name": "orderer0.group1", @@ -2090,7 +2090,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j { "address": "orderer0.group1.orderer.example.com", "adminPort": 7053, - "consensus": "solo", + "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", "name": "orderer0.group1", @@ -2103,7 +2103,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j { "address": "orderer0.group1.orderer.example.com", "adminPort": 7053, - "consensus": "solo", + "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", "name": "orderer0.group1", @@ -2117,7 +2117,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "ordererHead": { "address": "orderer0.group1.orderer.example.com", "adminPort": 7053, - "consensus": "solo", + "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", "name": "orderer0.group1", @@ -2194,10 +2194,10 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "", - "discoveryUrls": "grpc://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "http://ca.org1.example.com:7054", + "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { "error": "console", "info": "console", @@ -2237,7 +2237,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "fabloConfig": "", }, "peerDevMode": true, - "tls": false, + "tls": true, "tools": {}, }, "hooks": { @@ -2247,7 +2247,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j { "address": "orderer0.group1.orderer.example.com", "adminPort": 7053, - "consensus": "solo", + "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", "name": "orderer0.group1", @@ -2259,7 +2259,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "ordererGroups": [ { "configtxOrdererDefaults": "Group1Defaults", - "consensus": "solo", + "consensus": "etcdraft", "genesisBlockName": "Group1Genesis.block", "hostingOrgs": [ "Orderer", @@ -2268,7 +2268,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "ordererHead": { "address": "orderer0.group1.orderer.example.com", "adminPort": 7053, - "consensus": "solo", + "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", "name": "orderer0.group1", @@ -2280,7 +2280,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j { "address": "orderer0.group1.orderer.example.com", "adminPort": 7053, - "consensus": "solo", + "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", "name": "orderer0.group1", @@ -2293,7 +2293,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j { "address": "orderer0.group1.orderer.example.com", "adminPort": 7053, - "consensus": "solo", + "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", "name": "orderer0.group1", @@ -2330,7 +2330,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "ordererGroups": [ { "configtxOrdererDefaults": "Group1Defaults", - "consensus": "solo", + "consensus": "etcdraft", "genesisBlockName": "Group1Genesis.block", "hostingOrgs": [ "Orderer", @@ -2340,7 +2340,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j { "address": "orderer0.group1.orderer.example.com", "adminPort": 7053, - "consensus": "solo", + "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", "name": "orderer0.group1", @@ -2353,7 +2353,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j { "address": "orderer0.group1.orderer.example.com", "adminPort": 7053, - "consensus": "solo", + "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", "name": "orderer0.group1", @@ -2437,10 +2437,10 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "", - "discoveryUrls": "grpc://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "http://ca.org1.example.com:7054", + "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { "error": "console", "info": "console", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap index 7a68b96c..4ad59496 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap @@ -111,9 +111,15 @@ Application: &ApplicationDefaults # SECTION: Orderer ################################################################################ Orderer: &Group1Defaults - OrdererType: solo + OrdererType: etcdraft Addresses: - orderer0.group1.orderer.example.com:7030 + EtcdRaft: + Consenters: + - Host: orderer0.group1.orderer.example.com + Port: 7030 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt BatchTimeout: 2s BatchSize: @@ -205,21 +211,36 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json should cre }, "peers": { "peer0.org1.example.com": { - "url": "grpc://localhost:7041" + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } } }, "certificateAuthorities": { "ca.orderer.example.com": { - "url": "http://localhost:7020", + "url": "https://localhost:7020", "caName": "ca.orderer.example.com", "httpOptions": { "verify": false + }, + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" } } }, "orderers": { "orderer0.group1.orderer.example.com": { - "url": "grpc://localhost:7030" + "url": "grpcs://localhost:7030", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/ordererOrganizations/orderer.example.com/orderers/orderer0.group1.orderer.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "orderer0.group1.orderer.example.com" + } } } } @@ -241,16 +262,29 @@ organizations: - ca.orderer.example.com peers: peer0.org1.example.com: - url: grpc://localhost:7041 + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com certificateAuthorities: ca.orderer.example.com: - url: http://localhost:7020 + url: https://localhost:7020 caName: ca.orderer.example.com httpOptions: verify: false + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem orderers: orderer0.group1.orderer.example.com: - url: grpc://localhost:7030 + url: grpcs://localhost:7030 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/ordererOrganizations/orderer.example.com/orderers/orderer0.group1.orderer.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: orderer0.group1.orderer.example.com " `; @@ -275,21 +309,36 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json should cre }, "peers": { "peer0.org1.example.com": { - "url": "grpc://localhost:7041" + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } } }, "certificateAuthorities": { "ca.org1.example.com": { - "url": "http://localhost:7040", + "url": "https://localhost:7040", "caName": "ca.org1.example.com", "httpOptions": { "verify": false + }, + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" } } }, "orderers": { "orderer0.group1.orderer.example.com": { - "url": "grpc://localhost:7030" + "url": "grpcs://localhost:7030", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/ordererOrganizations/orderer.example.com/orderers/orderer0.group1.orderer.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "orderer0.group1.orderer.example.com" + } } }, "channels": { @@ -316,16 +365,29 @@ organizations: - ca.org1.example.com peers: peer0.org1.example.com: - url: grpc://localhost:7041 + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com certificateAuthorities: ca.org1.example.com: - url: http://localhost:7040 + url: https://localhost:7040 caName: ca.org1.example.com httpOptions: verify: false + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem orderers: orderer0.group1.orderer.example.com: - url: grpc://localhost:7030 + url: grpcs://localhost:7030 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/ordererOrganizations/orderer.example.com/orderers/orderer0.group1.orderer.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: orderer0.group1.orderer.example.com channels: my-channel1: peers: {} @@ -1490,7 +1552,7 @@ chaincodeList() { elif [ "$1" = "peer0.org1.example.com" ]; then - peerChaincodeList "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" # $2 is channel name + peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name else @@ -1521,7 +1583,13 @@ chaincodeInvoke() { peer_addresses="$1" peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" - peerChaincodeInvoke "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" + peer_certs="$1" + peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + + if [ "$2" = "my-channel1" ]; then + ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" + fi + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" } # Function to perform chaincode query for single peer @@ -1547,10 +1615,14 @@ chaincodeQuery() { cli="" peer_address="" + peer_cert="" + if [ "$peer_domain" = "peer0.org1.example.com" ]; then cli="cli.org1.example.com" peer_address="peer0.org1.example.com:7041" + peer_cert="crypto/peers/peer0.org1.example.com/tls/ca.crt" + fi if [ -z "$peer_address" ]; then @@ -1558,7 +1630,11 @@ chaincodeQuery() { exit 1 fi - peerChaincodeQuery "$cli" "$peer_address" "$channel_name" "$chaincode_name" "$command" "$transient" + if [ "$channel_name" = "my-channel1" ]; then + ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" + fi + + peerChaincodeQueryTls "$cli" "$peer_address" "$channel_name" "$chaincode_name" "$command" "$transient" "$peer_cert" "$ca_cert" } " @@ -1577,25 +1653,25 @@ channelQuery() { elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then - peerChannelList "cli.org1.example.com" "peer0.org1.example.com:7041" + peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" elif [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] then - peerChannelGetInfo "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then TARGET_FILE=\${6:-"$channel-config.json"} - peerChannelFetchConfig "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then BLOCK_NAME=$2 TARGET_FILE=\${6:-"$BLOCK_NAME.block"} - peerChannelFetchBlock "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "$TARGET_FILE" + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" else @@ -1661,16 +1737,21 @@ generateChannelsArtifacts() { installChannels() { printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" - docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoin 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" } installChaincodes() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + printHeadline "Launching devmode chaincode runtime for 'chaincode1'" "U1F680" + startDevModeChaincodeProcess "chaincode1" "0.0.1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "Org1MSP" "peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" "peerOrganizations/orderer.example.com/tlsca/tlsca.orderer.example.com-cert.pem" "true" "peer0.org1.example.com" "org1.example.com" + else echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" @@ -1696,10 +1777,10 @@ installChaincode() { printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." @@ -1718,11 +1799,16 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + printHeadline "Launching devmode chaincode runtime for 'chaincode1'" "U1F680" + startDevModeChaincodeProcess "chaincode1" "0.0.1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "Org1MSP" "peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" "peerOrganizations/orderer.example.com/tlsca/tlsca.orderer.example.com-cert.pem" "true" "peer0.org1.example.com" "org1.example.com" fi + } upgradeChaincode() { @@ -1743,10 +1829,10 @@ upgradeChaincode() { printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." @@ -1761,7 +1847,7 @@ notifyOrgsAboutChannels() { createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" printHeadline "Notyfing orgs about channels" "U1F4E2" - notifyOrgAboutNewChannel "my-channel1" "Org1MSP" "cli.org1.example.com" "peer0.org1.example.com" "orderer0.group1.orderer.example.com:7030" + notifyOrgAboutNewChannelTls "my-channel1" "Org1MSP" "cli.org1.example.com" "peer0.org1.example.com" "orderer0.group1.orderer.example.com:7030" "crypto-orderer/tlsca.orderer.example.com-cert.pem" printHeadline "Deleting new channel config blocks" "U1F52A" deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" @@ -1818,6 +1904,7 @@ services: - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true ports: - 7020:7054 working_dir: /etc/hyperledger/fabric-ca-server @@ -1841,6 +1928,12 @@ services: # - CORE_PEER_LOCALMSPID=OrdererMSP - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem working_dir: /var/hyperledger/cli/ command: /bin/bash volumes: @@ -1848,6 +1941,8 @@ services: - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" networks: @@ -1862,6 +1957,15 @@ services: - ORDERER_GENERAL_LISTENPORT=7030 - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] # Genesis file configuration (for solo and raft) - ORDERER_GENERAL_GENESISMETHOD=file - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block @@ -1889,6 +1993,7 @@ services: - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true - FABRIC_CA_SERVER_DB_TLS_ENABLED=false - FABRIC_CA_SERVER_DB_TYPE=postgres - FABRIC_CA_SERVER_DB_DATASOURCE=host=db.ca.org1.example.com port=5432 user=postgres password=caDbPass12345 dbname=fabriccaserver sslmode=disable @@ -1936,6 +2041,12 @@ services: - CORE_PEER_LOCALMSPID=Org1MSP - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem working_dir: /var/hyperledger/cli/ command: /bin/bash volumes: @@ -1943,6 +2054,8 @@ services: - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" networks: @@ -1954,11 +2067,16 @@ services: environment: - PORT=8000 - MSP_ID=Org1MSP - - FABRIC_CA_URL=http://ca.org1.example.com:7054 + - FABRIC_CA_URL=https://ca.org1.example.com:7054 - FABRIC_CA_NAME=ca.org1.example.com - AS_LOCALHOST=false - - DISCOVERY_URLS=grpc://peer0.org1.example.com:7041 + - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041 + - DISCOVERY_SSL_TARGET_NAME_OVERRIDES= + - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - HFC_LOGGING={"error":"console","warn":"console","info":"console"} + volumes: + # note: fablo needs access to all anchor peer certs + - ../fabric-config/crypto-config/peerOrganizations:/crypto:ro ports: - 8801:8000 networks: @@ -1993,6 +2111,11 @@ services: - CORE_VM_DOCKER_ATTACHSTDOUT=true - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # CouchDB - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org1.example.com:5984 @@ -2003,7 +2126,7 @@ services: # ccaas builder configuration - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ - command: peer node start --peer-chaincodedev=true + command: peer node start ports: - 8041:9440 - 7041:7041 @@ -2666,6 +2789,80 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } +startDevModeChaincodeProcess() { + local CHAINCODE_NAME="$1" + local CHAINCODE_VERSION="$2" + local CHAINCODE_LANG="$3" + local CHAINCODE_DIR="$4" + local ORG_MSP="$5" + local PEER_TLS_CA_REL="$6" + local ORDERER_TLS_CA_REL="$7" + local TLS_ENABLED="$8" + local PEER_ADDRESS="$9" + local ORG_DOMAIN=\${10} + + local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" + local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" + + local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") + local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + # Generate certs for dev mode container + echo "Generating certifcates for dev mode container" + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + echo "Launching devmode chaincode container $CONTAINER_NAME" + echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" + echo " MSP: $ORG_MSP" + echo " PEER_TLS_CA: $PEER_TLS_CA_REL" + echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" + + local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + # Pick base image depending on lang + local CC_IMAGE="" + case "$CHAINCODE_LANG" in + node) + CC_IMAGE="node:16" + START_CMD="cd /usr/src/app && npm install && npm run start:watch" + ;; + golang | go) + CC_IMAGE="golang:1.20" + START_CMD="cd /usr/src/app && go mod tidy && go run ." + ;; + java) + CC_IMAGE="openjdk:11" + START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" + ;; + *) + echo "Unsupported chaincode language: $CHAINCODE_LANG" + exit 1 + ;; + esac + + local DOCKER_NETWORK + DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ + -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$CHAINCODE_DIR:/usr/src/app" \\ + --network "$DOCKER_NETWORK" \\ + "$CC_IMAGE" \\ + bash -c "$START_CMD" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-ccaas.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-ccaas.json.test.ts.snap index 366454fb..c049eb2f 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-ccaas.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-ccaas.json.test.ts.snap @@ -2767,6 +2767,80 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } +startDevModeChaincodeProcess() { + local CHAINCODE_NAME="$1" + local CHAINCODE_VERSION="$2" + local CHAINCODE_LANG="$3" + local CHAINCODE_DIR="$4" + local ORG_MSP="$5" + local PEER_TLS_CA_REL="$6" + local ORDERER_TLS_CA_REL="$7" + local TLS_ENABLED="$8" + local PEER_ADDRESS="$9" + local ORG_DOMAIN=\${10} + + local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" + local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" + + local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") + local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + # Generate certs for dev mode container + echo "Generating certifcates for dev mode container" + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + echo "Launching devmode chaincode container $CONTAINER_NAME" + echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" + echo " MSP: $ORG_MSP" + echo " PEER_TLS_CA: $PEER_TLS_CA_REL" + echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" + + local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + # Pick base image depending on lang + local CC_IMAGE="" + case "$CHAINCODE_LANG" in + node) + CC_IMAGE="node:16" + START_CMD="cd /usr/src/app && npm install && npm run start:watch" + ;; + golang | go) + CC_IMAGE="golang:1.20" + START_CMD="cd /usr/src/app && go mod tidy && go run ." + ;; + java) + CC_IMAGE="openjdk:11" + START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" + ;; + *) + echo "Unsupported chaincode language: $CHAINCODE_LANG" + exit 1 + ;; + esac + + local DOCKER_NETWORK + DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ + -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$CHAINCODE_DIR:/usr/src/app" \\ + --network "$DOCKER_NETWORK" \\ + "$CC_IMAGE" \\ + bash -c "$START_CMD" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 030ffa0d..e3accd83 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1796,10 +1796,12 @@ runDevModeChaincode() { local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" fi + } upgradeChaincode() { @@ -2734,6 +2736,80 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } +startDevModeChaincodeProcess() { + local CHAINCODE_NAME="$1" + local CHAINCODE_VERSION="$2" + local CHAINCODE_LANG="$3" + local CHAINCODE_DIR="$4" + local ORG_MSP="$5" + local PEER_TLS_CA_REL="$6" + local ORDERER_TLS_CA_REL="$7" + local TLS_ENABLED="$8" + local PEER_ADDRESS="$9" + local ORG_DOMAIN=\${10} + + local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" + local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" + + local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") + local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + # Generate certs for dev mode container + echo "Generating certifcates for dev mode container" + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + echo "Launching devmode chaincode container $CONTAINER_NAME" + echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" + echo " MSP: $ORG_MSP" + echo " PEER_TLS_CA: $PEER_TLS_CA_REL" + echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" + + local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + # Pick base image depending on lang + local CC_IMAGE="" + case "$CHAINCODE_LANG" in + node) + CC_IMAGE="node:16" + START_CMD="cd /usr/src/app && npm install && npm run start:watch" + ;; + golang | go) + CC_IMAGE="golang:1.20" + START_CMD="cd /usr/src/app && go mod tidy && go run ." + ;; + java) + CC_IMAGE="openjdk:11" + START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" + ;; + *) + echo "Unsupported chaincode language: $CHAINCODE_LANG" + exit 1 + ;; + esac + + local DOCKER_NETWORK + DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ + -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$CHAINCODE_DIR:/usr/src/app" \\ + --network "$DOCKER_NETWORK" \\ + "$CC_IMAGE" \\ + bash -c "$START_CMD" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 6ebc307f..5c978957 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2575,22 +2575,34 @@ runDevModeChaincode() { local version="0.0.1" printHeadline "Approving 'or-policy-chaincode' for Org1 (dev mode)" "U1F60E" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "" "" + + printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" + printHeadline "Approving 'or-policy-chaincode' for Org2 (dev mode)" "U1F60E" chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "" "" + printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" fi + if [ "$chaincodeName" = "and-policy-chaincode" ]; then local version="0.0.1" printHeadline "Approving 'and-policy-chaincode' for Org1 (dev mode)" "U1F60E" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "" "" + + printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" + printHeadline "Approving 'and-policy-chaincode' for Org2 (dev mode)" "U1F60E" chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "" "" + printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" fi + } upgradeChaincode() { @@ -3683,6 +3695,80 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } +startDevModeChaincodeProcess() { + local CHAINCODE_NAME="$1" + local CHAINCODE_VERSION="$2" + local CHAINCODE_LANG="$3" + local CHAINCODE_DIR="$4" + local ORG_MSP="$5" + local PEER_TLS_CA_REL="$6" + local ORDERER_TLS_CA_REL="$7" + local TLS_ENABLED="$8" + local PEER_ADDRESS="$9" + local ORG_DOMAIN=\${10} + + local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" + local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" + + local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") + local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + # Generate certs for dev mode container + echo "Generating certifcates for dev mode container" + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + echo "Launching devmode chaincode container $CONTAINER_NAME" + echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" + echo " MSP: $ORG_MSP" + echo " PEER_TLS_CA: $PEER_TLS_CA_REL" + echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" + + local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + # Pick base image depending on lang + local CC_IMAGE="" + case "$CHAINCODE_LANG" in + node) + CC_IMAGE="node:16" + START_CMD="cd /usr/src/app && npm install && npm run start:watch" + ;; + golang | go) + CC_IMAGE="golang:1.20" + START_CMD="cd /usr/src/app && go mod tidy && go run ." + ;; + java) + CC_IMAGE="openjdk:11" + START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" + ;; + *) + echo "Unsupported chaincode language: $CHAINCODE_LANG" + exit 1 + ;; + esac + + local DOCKER_NETWORK + DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ + -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$CHAINCODE_DIR:/usr/src/app" \\ + --network "$DOCKER_NETWORK" \\ + "$CC_IMAGE" \\ + bash -c "$START_CMD" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index ede1dc7d..9e6737f6 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4137,23 +4137,47 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "" "" + + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" + + printHeadline "Launching devmode chaincode runtime for 'chaincode1'" "U1F680" + startDevModeChaincodeProcess "chaincode1" "0.0.1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "Org1MSP" "peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" "peerOrganizations/orderer1.com/tlsca/tlsca.orderer1.com-cert.pem" "true" "peer0.org1.example.com" "org1.example.com" + printHeadline "Approving 'chaincode1' for Org2 (dev mode)" "U1F60E" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" + + printHeadline "Launching devmode chaincode runtime for 'chaincode1'" "U1F680" + startDevModeChaincodeProcess "chaincode1" "0.0.1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "Org1MSP" "peerOrganizations/org2.example.com/peers/peer0.org1.example.com/tls/ca.crt" "peerOrganizations/orderer1.com/tlsca/tlsca.orderer1.com-cert.pem" "true" "peer0.org1.example.com" "org2.example.com" fi + if [ "$chaincodeName" = "chaincode2" ]; then local version="0.0.1" printHeadline "Approving 'chaincode2' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "" "" + + printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1' (dev mode)" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" + + printHeadline "Launching devmode chaincode runtime for 'chaincode2'" "U1F680" + startDevModeChaincodeProcess "chaincode2" "0.0.1" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "Org1MSP" "peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" "peerOrganizations/orderer1.com/tlsca/tlsca.orderer1.com-cert.pem" "true" "peer1.org1.example.com" "org1.example.com" + printHeadline "Approving 'chaincode2' for Org2 (dev mode)" "U1F60E" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "" "" + printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1' (dev mode)" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "" "" + chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" + + printHeadline "Launching devmode chaincode runtime for 'chaincode2'" "U1F680" + startDevModeChaincodeProcess "chaincode2" "0.0.1" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "Org1MSP" "peerOrganizations/org2.example.com/peers/peer1.org1.example.com/tls/ca.crt" "peerOrganizations/orderer1.com/tlsca/tlsca.orderer1.com-cert.pem" "true" "peer1.org1.example.com" "org2.example.com" fi + } upgradeChaincode() { @@ -5578,6 +5602,80 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } +startDevModeChaincodeProcess() { + local CHAINCODE_NAME="$1" + local CHAINCODE_VERSION="$2" + local CHAINCODE_LANG="$3" + local CHAINCODE_DIR="$4" + local ORG_MSP="$5" + local PEER_TLS_CA_REL="$6" + local ORDERER_TLS_CA_REL="$7" + local TLS_ENABLED="$8" + local PEER_ADDRESS="$9" + local ORG_DOMAIN=\${10} + + local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" + local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" + + local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") + local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + # Generate certs for dev mode container + echo "Generating certifcates for dev mode container" + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + echo "Launching devmode chaincode container $CONTAINER_NAME" + echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" + echo " MSP: $ORG_MSP" + echo " PEER_TLS_CA: $PEER_TLS_CA_REL" + echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" + + local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + # Pick base image depending on lang + local CC_IMAGE="" + case "$CHAINCODE_LANG" in + node) + CC_IMAGE="node:16" + START_CMD="cd /usr/src/app && npm install && npm run start:watch" + ;; + golang | go) + CC_IMAGE="golang:1.20" + START_CMD="cd /usr/src/app && go mod tidy && go run ." + ;; + java) + CC_IMAGE="openjdk:11" + START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" + ;; + *) + echo "Unsupported chaincode language: $CHAINCODE_LANG" + exit 1 + ;; + esac + + local DOCKER_NETWORK + DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ + -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$CHAINCODE_DIR:/usr/src/app" \\ + --network "$DOCKER_NETWORK" \\ + "$CC_IMAGE" \\ + bash -c "$START_CMD" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 98dc049f..280f1a31 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -4535,11 +4535,16 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + printHeadline "Launching devmode chaincode runtime for 'chaincode1'" "U1F680" + startDevModeChaincodeProcess "chaincode1" "0.0.1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "Org1MSP" "peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" "peerOrganizations/orderer.example.com/tlsca/tlsca.orderer.example.com-cert.pem" "true" "peer0.org1.example.com" "org1.example.com" fi + } upgradeChaincode() { @@ -6149,6 +6154,80 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } +startDevModeChaincodeProcess() { + local CHAINCODE_NAME="$1" + local CHAINCODE_VERSION="$2" + local CHAINCODE_LANG="$3" + local CHAINCODE_DIR="$4" + local ORG_MSP="$5" + local PEER_TLS_CA_REL="$6" + local ORDERER_TLS_CA_REL="$7" + local TLS_ENABLED="$8" + local PEER_ADDRESS="$9" + local ORG_DOMAIN=\${10} + + local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" + local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" + + local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") + local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + # Generate certs for dev mode container + echo "Generating certifcates for dev mode container" + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + echo "Launching devmode chaincode container $CONTAINER_NAME" + echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" + echo " MSP: $ORG_MSP" + echo " PEER_TLS_CA: $PEER_TLS_CA_REL" + echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" + + local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + # Pick base image depending on lang + local CC_IMAGE="" + case "$CHAINCODE_LANG" in + node) + CC_IMAGE="node:16" + START_CMD="cd /usr/src/app && npm install && npm run start:watch" + ;; + golang | go) + CC_IMAGE="golang:1.20" + START_CMD="cd /usr/src/app && go mod tidy && go run ." + ;; + java) + CC_IMAGE="openjdk:11" + START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" + ;; + *) + echo "Unsupported chaincode language: $CHAINCODE_LANG" + exit 1 + ;; + esac + + local DOCKER_NETWORK + DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ + -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$CHAINCODE_DIR:/usr/src/app" \\ + --network "$DOCKER_NETWORK" \\ + "$CC_IMAGE" \\ + bash -c "$START_CMD" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index a4c1005e..edb0ebbc 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -3109,6 +3109,80 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } +startDevModeChaincodeProcess() { + local CHAINCODE_NAME="$1" + local CHAINCODE_VERSION="$2" + local CHAINCODE_LANG="$3" + local CHAINCODE_DIR="$4" + local ORG_MSP="$5" + local PEER_TLS_CA_REL="$6" + local ORDERER_TLS_CA_REL="$7" + local TLS_ENABLED="$8" + local PEER_ADDRESS="$9" + local ORG_DOMAIN=\${10} + + local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" + local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" + + local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") + local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + # Generate certs for dev mode container + echo "Generating certifcates for dev mode container" + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + echo "Launching devmode chaincode container $CONTAINER_NAME" + echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" + echo " MSP: $ORG_MSP" + echo " PEER_TLS_CA: $PEER_TLS_CA_REL" + echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" + + local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + # Pick base image depending on lang + local CC_IMAGE="" + case "$CHAINCODE_LANG" in + node) + CC_IMAGE="node:16" + START_CMD="cd /usr/src/app && npm install && npm run start:watch" + ;; + golang | go) + CC_IMAGE="golang:1.20" + START_CMD="cd /usr/src/app && go mod tidy && go run ." + ;; + java) + CC_IMAGE="openjdk:11" + START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" + ;; + *) + echo "Unsupported chaincode language: $CHAINCODE_LANG" + exit 1 + ;; + esac + + local DOCKER_NETWORK + DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ + -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$CHAINCODE_DIR:/usr/src/app" \\ + --network "$DOCKER_NETWORK" \\ + "$CC_IMAGE" \\ + bash -c "$START_CMD" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index bc090f68..fcbf0567 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -3133,6 +3133,80 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } +startDevModeChaincodeProcess() { + local CHAINCODE_NAME="$1" + local CHAINCODE_VERSION="$2" + local CHAINCODE_LANG="$3" + local CHAINCODE_DIR="$4" + local ORG_MSP="$5" + local PEER_TLS_CA_REL="$6" + local ORDERER_TLS_CA_REL="$7" + local TLS_ENABLED="$8" + local PEER_ADDRESS="$9" + local ORG_DOMAIN=\${10} + + local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" + local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" + + local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") + local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + # Generate certs for dev mode container + echo "Generating certifcates for dev mode container" + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + echo "Launching devmode chaincode container $CONTAINER_NAME" + echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" + echo " MSP: $ORG_MSP" + echo " PEER_TLS_CA: $PEER_TLS_CA_REL" + echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" + + local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + # Pick base image depending on lang + local CC_IMAGE="" + case "$CHAINCODE_LANG" in + node) + CC_IMAGE="node:16" + START_CMD="cd /usr/src/app && npm install && npm run start:watch" + ;; + golang | go) + CC_IMAGE="golang:1.20" + START_CMD="cd /usr/src/app && go mod tidy && go run ." + ;; + java) + CC_IMAGE="openjdk:11" + START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" + ;; + *) + echo "Unsupported chaincode language: $CHAINCODE_LANG" + exit 1 + ;; + esac + + local DOCKER_NETWORK + DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ + -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$CHAINCODE_DIR:/usr/src/app" \\ + --network "$DOCKER_NETWORK" \\ + "$CC_IMAGE" \\ + bash -c "$START_CMD" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index ab2f4255..5d83de50 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -331,7 +331,7 @@ startDevModeChaincodeProcess() { -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \ -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \ -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \ - -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \ + -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \ -v "$CHAINCODE_DIR:/usr/src/app" \ --network "$DOCKER_NETWORK" \ "$CC_IMAGE" \ From 0306c03564fac85604f0589cea2de4068b7876af Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 19 Sep 2025 08:48:06 +0200 Subject: [PATCH 5/7] fix-start chaincode with mounted tls certs Signed-off-by: Pereowei Daniel --- ...fig-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap | 6 +++--- ...config-hlf2-1org-1chaincode-raft-ccaas.json.test.ts.snap | 6 +++--- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 6 +++--- ...ig-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 6 +++--- ...blo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 6 +++--- ...ig-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 6 +++--- .../fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap | 6 +++--- ...fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 6 +++--- .../fabric-docker/scripts/chaincode-functions-v2.sh | 4 ++-- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap index 4ad59496..e9458eed 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap @@ -2851,12 +2851,12 @@ startDevModeChaincodeProcess() { -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ -e CORE_PEER_TLS_ENABLED=true \\ -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ -v "$CHAINCODE_DIR:/usr/src/app" \\ --network "$DOCKER_NETWORK" \\ "$CC_IMAGE" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-ccaas.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-ccaas.json.test.ts.snap index c049eb2f..3dc9a914 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-ccaas.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-ccaas.json.test.ts.snap @@ -2829,12 +2829,12 @@ startDevModeChaincodeProcess() { -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ -e CORE_PEER_TLS_ENABLED=true \\ -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ -v "$CHAINCODE_DIR:/usr/src/app" \\ --network "$DOCKER_NETWORK" \\ "$CC_IMAGE" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index e3accd83..f1fa06a6 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2798,12 +2798,12 @@ startDevModeChaincodeProcess() { -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ -e CORE_PEER_TLS_ENABLED=true \\ -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ -v "$CHAINCODE_DIR:/usr/src/app" \\ --network "$DOCKER_NETWORK" \\ "$CC_IMAGE" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 5c978957..affe2c2b 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -3757,12 +3757,12 @@ startDevModeChaincodeProcess() { -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ -e CORE_PEER_TLS_ENABLED=true \\ -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ -v "$CHAINCODE_DIR:/usr/src/app" \\ --network "$DOCKER_NETWORK" \\ "$CC_IMAGE" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 9e6737f6..c1669f26 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -5664,12 +5664,12 @@ startDevModeChaincodeProcess() { -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ -e CORE_PEER_TLS_ENABLED=true \\ -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ -v "$CHAINCODE_DIR:/usr/src/app" \\ --network "$DOCKER_NETWORK" \\ "$CC_IMAGE" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 280f1a31..22890b10 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -6216,12 +6216,12 @@ startDevModeChaincodeProcess() { -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ -e CORE_PEER_TLS_ENABLED=true \\ -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ -v "$CHAINCODE_DIR:/usr/src/app" \\ --network "$DOCKER_NETWORK" \\ "$CC_IMAGE" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index edb0ebbc..f28be2ae 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -3171,12 +3171,12 @@ startDevModeChaincodeProcess() { -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ -e CORE_PEER_TLS_ENABLED=true \\ -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ -v "$CHAINCODE_DIR:/usr/src/app" \\ --network "$DOCKER_NETWORK" \\ "$CC_IMAGE" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index fcbf0567..c7e93400 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -3195,12 +3195,12 @@ startDevModeChaincodeProcess() { -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ -e CORE_PEER_TLS_ENABLED=true \\ -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v $ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt \\ + -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ -v "$CHAINCODE_DIR:/usr/src/app" \\ --network "$DOCKER_NETWORK" \\ "$CC_IMAGE" \\ diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 5d83de50..0844f058 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -326,8 +326,8 @@ startDevModeChaincodeProcess() { -e CORE_CHAINCODE_LOGGING_LEVEL=debug \ -e CORE_PEER_TLS_ENABLED=true \ -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \ - -e CORE_PEER_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \ - -e CORE_PEER_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \ + -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \ + -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \ -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \ -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \ -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \ From 88231a3b3f0f3c508a3585a49f0d9ce93aae7c7a Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Sat, 20 Sep 2025 15:50:56 +0200 Subject: [PATCH 6/7] fix-package cc before invoke Signed-off-by: Pereowei Daniel --- .gitignore | 2 +- .../docker/test-07-v2-peer-dev-mode.sh | 42 ++++--- ...1chaincode-peer-dev-mode.json.test.ts.snap | 93 ++------------- ...rg-1chaincode-raft-ccaas.json.test.ts.snap | 74 ------------ ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 80 +------------ ...2chaincodes-private-data.yaml.test.ts.snap | 94 ++------------- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 110 +++--------------- ...1chaincode-raft-explorer.json.test.ts.snap | 85 +------------- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 74 ------------ ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 74 ------------ .../chaincodes/chaincode-kv-node/package.json | 2 + .../fabric-docker/commands-generated.sh | 1 + .../commands-generated/chaincode-dev-v2.sh | 65 ++++++----- .../scripts/chaincode-functions-v2.sh | 74 ------------ 14 files changed, 117 insertions(+), 753 deletions(-) diff --git a/.gitignore b/.gitignore index b4c27d5d..de87b68f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ e2e/__tmp__ e2e-network/docker/*.logs e2e-network/docker/*.tmpdir fablo-target -generators +generators* node_modules .idea .vscode diff --git a/e2e-network/docker/test-07-v2-peer-dev-mode.sh b/e2e-network/docker/test-07-v2-peer-dev-mode.sh index eb170469..d5ef6d3b 100755 --- a/e2e-network/docker/test-07-v2-peer-dev-mode.sh +++ b/e2e-network/docker/test-07-v2-peer-dev-mode.sh @@ -25,7 +25,9 @@ dumpLogs() { networkDown() { sleep 2 (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) - # (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) + # remove .env + rm "$NODECHAINCODE/.env" + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) } waitForContainer() { @@ -59,20 +61,34 @@ waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my- waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" echo "All nodes are ready" -# echo "Starting chaincode in development mode..." -# # make sure nodemon is installed and Install if not -# if ! command -v nodemon &> /dev/null; then -# echo "nodemon could not be found, installing..." -# npm install -g nodemon -# else -# echo "nodemon is already installed" -# fi -# # start the chaincode in development mode -# (cd "$NODECHAINCODE" && npm i && npm run start:watch) & +# create .env in chaincode directory +cat >"$NODECHAINCODE/.env" < /dev/null; then + echo "nodemon could not be found, installing..." + npm install -g nodemon +else + echo "nodemon is already installed" +fi +# start the chaincode in development mode +(cd "$NODECHAINCODE" && npm i && npm run start:dev:tls) & +CHAINCODE_PID=$! sleep 5 - # Test simple chaincode expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ - '{\"success\":\"OK\"}' \ No newline at end of file + '{\"success\":\"OK\"}' + +# kill background chaincode process +kill $CHAINCODE_PID \ No newline at end of file diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap index 0a5939b1..87e498b3 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap @@ -1743,15 +1743,15 @@ installChannels() { installChaincodes() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + local version="0.0.1" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - - printHeadline "Launching devmode chaincode runtime for 'chaincode1'" "U1F680" - startDevModeChaincodeProcess "chaincode1" "0.0.1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "Org1MSP" "peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" "peerOrganizations/orderer.example.com/tlsca/tlsca.orderer.example.com-cert.pem" "true" "peer0.org1.example.com" "org1.example.com" - + printHeadline "Generating TLS certs to be used by 'chaincode1'" "U1F680" + certsGenerateCCaaS "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" "devmode-chaincode1" "org1.example.com" "chaincode1" "peer0.org1.example.com" else echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" @@ -1798,17 +1798,16 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - - printHeadline "Launching devmode chaincode runtime for 'chaincode1'" "U1F680" - startDevModeChaincodeProcess "chaincode1" "0.0.1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "Org1MSP" "peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" "peerOrganizations/orderer.example.com/tlsca/tlsca.orderer.example.com-cert.pem" "true" "peer0.org1.example.com" "org1.example.com" + printHeadline "Generating TLS certs to be used by 'chaincode1'" "U1F680" + certsGenerateCCaaS "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" "devmode-chaincode1" "org1.example.com" "chaincode1" "peer0.org1.example.com" fi - } upgradeChaincode() { @@ -2789,80 +2788,6 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } -startDevModeChaincodeProcess() { - local CHAINCODE_NAME="$1" - local CHAINCODE_VERSION="$2" - local CHAINCODE_LANG="$3" - local CHAINCODE_DIR="$4" - local ORG_MSP="$5" - local PEER_TLS_CA_REL="$6" - local ORDERER_TLS_CA_REL="$7" - local TLS_ENABLED="$8" - local PEER_ADDRESS="$9" - local ORG_DOMAIN=\${10} - - local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" - local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" - - local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" - local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") - local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # Generate certs for dev mode container - echo "Generating certifcates for dev mode container" - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - echo "Launching devmode chaincode container $CONTAINER_NAME" - echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" - echo " MSP: $ORG_MSP" - echo " PEER_TLS_CA: $PEER_TLS_CA_REL" - echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" - - local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - # Pick base image depending on lang - local CC_IMAGE="" - case "$CHAINCODE_LANG" in - node) - CC_IMAGE="node:16" - START_CMD="cd /usr/src/app && npm install && npm run start:watch" - ;; - golang | go) - CC_IMAGE="golang:1.20" - START_CMD="cd /usr/src/app && go mod tidy && go run ." - ;; - java) - CC_IMAGE="openjdk:11" - START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" - ;; - *) - echo "Unsupported chaincode language: $CHAINCODE_LANG" - exit 1 - ;; - esac - - local DOCKER_NETWORK - DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ - -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ - -v "$CHAINCODE_DIR:/usr/src/app" \\ - --network "$DOCKER_NETWORK" \\ - "$CC_IMAGE" \\ - bash -c "$START_CMD" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-ccaas.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-ccaas.json.test.ts.snap index 04a66d4b..71f8f527 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-ccaas.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-ccaas.json.test.ts.snap @@ -2767,80 +2767,6 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } -startDevModeChaincodeProcess() { - local CHAINCODE_NAME="$1" - local CHAINCODE_VERSION="$2" - local CHAINCODE_LANG="$3" - local CHAINCODE_DIR="$4" - local ORG_MSP="$5" - local PEER_TLS_CA_REL="$6" - local ORDERER_TLS_CA_REL="$7" - local TLS_ENABLED="$8" - local PEER_ADDRESS="$9" - local ORG_DOMAIN=\${10} - - local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" - local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" - - local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" - local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") - local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # Generate certs for dev mode container - echo "Generating certifcates for dev mode container" - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - echo "Launching devmode chaincode container $CONTAINER_NAME" - echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" - echo " MSP: $ORG_MSP" - echo " PEER_TLS_CA: $PEER_TLS_CA_REL" - echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" - - local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - # Pick base image depending on lang - local CC_IMAGE="" - case "$CHAINCODE_LANG" in - node) - CC_IMAGE="node:16" - START_CMD="cd /usr/src/app && npm install && npm run start:watch" - ;; - golang | go) - CC_IMAGE="golang:1.20" - START_CMD="cd /usr/src/app && go mod tidy && go run ." - ;; - java) - CC_IMAGE="openjdk:11" - START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" - ;; - *) - echo "Unsupported chaincode language: $CHAINCODE_LANG" - exit 1 - ;; - esac - - local DOCKER_NETWORK - DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ - -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ - -v "$CHAINCODE_DIR:/usr/src/app" \\ - --network "$DOCKER_NETWORK" \\ - "$CC_IMAGE" \\ - bash -c "$START_CMD" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index b9634b53..b94ad685 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1794,14 +1794,16 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" fi - } upgradeChaincode() { @@ -2736,80 +2738,6 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } -startDevModeChaincodeProcess() { - local CHAINCODE_NAME="$1" - local CHAINCODE_VERSION="$2" - local CHAINCODE_LANG="$3" - local CHAINCODE_DIR="$4" - local ORG_MSP="$5" - local PEER_TLS_CA_REL="$6" - local ORDERER_TLS_CA_REL="$7" - local TLS_ENABLED="$8" - local PEER_ADDRESS="$9" - local ORG_DOMAIN=\${10} - - local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" - local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" - - local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" - local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") - local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # Generate certs for dev mode container - echo "Generating certifcates for dev mode container" - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - echo "Launching devmode chaincode container $CONTAINER_NAME" - echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" - echo " MSP: $ORG_MSP" - echo " PEER_TLS_CA: $PEER_TLS_CA_REL" - echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" - - local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - # Pick base image depending on lang - local CC_IMAGE="" - case "$CHAINCODE_LANG" in - node) - CC_IMAGE="node:16" - START_CMD="cd /usr/src/app && npm install && npm run start:watch" - ;; - golang | go) - CC_IMAGE="golang:1.20" - START_CMD="cd /usr/src/app && go mod tidy && go run ." - ;; - java) - CC_IMAGE="openjdk:11" - START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" - ;; - *) - echo "Unsupported chaincode language: $CHAINCODE_LANG" - exit 1 - ;; - esac - - local DOCKER_NETWORK - DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ - -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ - -v "$CHAINCODE_DIR:/usr/src/app" \\ - --network "$DOCKER_NETWORK" \\ - "$CC_IMAGE" \\ - bash -c "$START_CMD" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 8544a7e1..4f57094f 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2573,36 +2573,40 @@ runDevModeChaincode() { if [ "$chaincodeName" = "or-policy-chaincode" ]; then local version="0.0.1" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" + printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" printHeadline "Approving 'or-policy-chaincode' for Org1 (dev mode)" "U1F60E" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "" "" - printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" - + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" + chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" printHeadline "Approving 'or-policy-chaincode' for Org2 (dev mode)" "U1F60E" chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "" "" - printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" fi - if [ "$chaincodeName" = "and-policy-chaincode" ]; then local version="0.0.1" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "golang" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" + printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" printHeadline "Approving 'and-policy-chaincode' for Org1 (dev mode)" "U1F60E" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "" "" - printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" - + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "golang" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" + chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" printHeadline "Approving 'and-policy-chaincode' for Org2 (dev mode)" "U1F60E" chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "" "" - printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" fi - } upgradeChaincode() { @@ -3695,80 +3699,6 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } -startDevModeChaincodeProcess() { - local CHAINCODE_NAME="$1" - local CHAINCODE_VERSION="$2" - local CHAINCODE_LANG="$3" - local CHAINCODE_DIR="$4" - local ORG_MSP="$5" - local PEER_TLS_CA_REL="$6" - local ORDERER_TLS_CA_REL="$7" - local TLS_ENABLED="$8" - local PEER_ADDRESS="$9" - local ORG_DOMAIN=\${10} - - local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" - local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" - - local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" - local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") - local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # Generate certs for dev mode container - echo "Generating certifcates for dev mode container" - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - echo "Launching devmode chaincode container $CONTAINER_NAME" - echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" - echo " MSP: $ORG_MSP" - echo " PEER_TLS_CA: $PEER_TLS_CA_REL" - echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" - - local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - # Pick base image depending on lang - local CC_IMAGE="" - case "$CHAINCODE_LANG" in - node) - CC_IMAGE="node:16" - START_CMD="cd /usr/src/app && npm install && npm run start:watch" - ;; - golang | go) - CC_IMAGE="golang:1.20" - START_CMD="cd /usr/src/app && go mod tidy && go run ." - ;; - java) - CC_IMAGE="openjdk:11" - START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" - ;; - *) - echo "Unsupported chaincode language: $CHAINCODE_LANG" - exit 1 - ;; - esac - - local DOCKER_NETWORK - DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ - -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ - -v "$CHAINCODE_DIR:/usr/src/app" \\ - --network "$DOCKER_NETWORK" \\ - "$CC_IMAGE" \\ - bash -c "$START_CMD" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 952a3e37..c74b5f71 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4136,48 +4136,44 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" - - printHeadline "Launching devmode chaincode runtime for 'chaincode1'" "U1F680" - startDevModeChaincodeProcess "chaincode1" "0.0.1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "Org1MSP" "peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" "peerOrganizations/orderer1.com/tlsca/tlsca.orderer1.com-cert.pem" "true" "peer0.org1.example.com" "org1.example.com" - + printHeadline "Generating TLS certs to be used by 'chaincode1'" "U1F680" + certsGenerateCCaaS "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" "devmode-chaincode1" "org1.example.com" "chaincode1" "peer0.org1.example.com" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" + chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" printHeadline "Approving 'chaincode1' for Org2 (dev mode)" "U1F60E" chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" - - printHeadline "Launching devmode chaincode runtime for 'chaincode1'" "U1F680" - startDevModeChaincodeProcess "chaincode1" "0.0.1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "Org1MSP" "peerOrganizations/org2.example.com/peers/peer0.org1.example.com/tls/ca.crt" "peerOrganizations/orderer1.com/tlsca/tlsca.orderer1.com-cert.pem" "true" "peer0.org1.example.com" "org2.example.com" + printHeadline "Generating TLS certs to be used by 'chaincode1'" "U1F680" + certsGenerateCCaaS "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" "devmode-chaincode1" "org2.example.com" "chaincode1" "peer0.org1.example.com" fi - if [ "$chaincodeName" = "chaincode2" ]; then local version="0.0.1" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" printHeadline "Approving 'chaincode2' for Org1 (dev mode)" "U1F60E" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "" "" - printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" - - printHeadline "Launching devmode chaincode runtime for 'chaincode2'" "U1F680" - startDevModeChaincodeProcess "chaincode2" "0.0.1" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "Org1MSP" "peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" "peerOrganizations/orderer1.com/tlsca/tlsca.orderer1.com-cert.pem" "true" "peer1.org1.example.com" "org1.example.com" - + printHeadline "Generating TLS certs to be used by 'chaincode2'" "U1F680" + certsGenerateCCaaS "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" "devmode-chaincode2" "org1.example.com" "chaincode2" "peer1.org1.example.com" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" + chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" printHeadline "Approving 'chaincode2' for Org2 (dev mode)" "U1F60E" chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "" "" - printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" - - printHeadline "Launching devmode chaincode runtime for 'chaincode2'" "U1F680" - startDevModeChaincodeProcess "chaincode2" "0.0.1" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "Org1MSP" "peerOrganizations/org2.example.com/peers/peer1.org1.example.com/tls/ca.crt" "peerOrganizations/orderer1.com/tlsca/tlsca.orderer1.com-cert.pem" "true" "peer1.org1.example.com" "org2.example.com" + printHeadline "Generating TLS certs to be used by 'chaincode2'" "U1F680" + certsGenerateCCaaS "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" "devmode-chaincode2" "org2.example.com" "chaincode2" "peer1.org1.example.com" fi - } upgradeChaincode() { @@ -5602,80 +5598,6 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } -startDevModeChaincodeProcess() { - local CHAINCODE_NAME="$1" - local CHAINCODE_VERSION="$2" - local CHAINCODE_LANG="$3" - local CHAINCODE_DIR="$4" - local ORG_MSP="$5" - local PEER_TLS_CA_REL="$6" - local ORDERER_TLS_CA_REL="$7" - local TLS_ENABLED="$8" - local PEER_ADDRESS="$9" - local ORG_DOMAIN=\${10} - - local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" - local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" - - local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" - local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") - local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # Generate certs for dev mode container - echo "Generating certifcates for dev mode container" - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - echo "Launching devmode chaincode container $CONTAINER_NAME" - echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" - echo " MSP: $ORG_MSP" - echo " PEER_TLS_CA: $PEER_TLS_CA_REL" - echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" - - local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - # Pick base image depending on lang - local CC_IMAGE="" - case "$CHAINCODE_LANG" in - node) - CC_IMAGE="node:16" - START_CMD="cd /usr/src/app && npm install && npm run start:watch" - ;; - golang | go) - CC_IMAGE="golang:1.20" - START_CMD="cd /usr/src/app && go mod tidy && go run ." - ;; - java) - CC_IMAGE="openjdk:11" - START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" - ;; - *) - echo "Unsupported chaincode language: $CHAINCODE_LANG" - exit 1 - ;; - esac - - local DOCKER_NETWORK - DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ - -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ - -v "$CHAINCODE_DIR:/usr/src/app" \\ - --network "$DOCKER_NETWORK" \\ - "$CC_IMAGE" \\ - bash -c "$START_CMD" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 2486dbdf..fdb4d398 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -4534,17 +4534,18 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - - printHeadline "Launching devmode chaincode runtime for 'chaincode1'" "U1F680" - startDevModeChaincodeProcess "chaincode1" "0.0.1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "Org1MSP" "peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" "peerOrganizations/orderer.example.com/tlsca/tlsca.orderer.example.com-cert.pem" "true" "peer0.org1.example.com" "org1.example.com" + printHeadline "Generating TLS certs to be used by 'chaincode1'" "U1F680" + certsGenerateCCaaS "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" "devmode-chaincode1" "org1.example.com" "chaincode1" "peer0.org1.example.com" fi - } upgradeChaincode() { @@ -6154,80 +6155,6 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } -startDevModeChaincodeProcess() { - local CHAINCODE_NAME="$1" - local CHAINCODE_VERSION="$2" - local CHAINCODE_LANG="$3" - local CHAINCODE_DIR="$4" - local ORG_MSP="$5" - local PEER_TLS_CA_REL="$6" - local ORDERER_TLS_CA_REL="$7" - local TLS_ENABLED="$8" - local PEER_ADDRESS="$9" - local ORG_DOMAIN=\${10} - - local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" - local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" - - local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" - local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") - local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # Generate certs for dev mode container - echo "Generating certifcates for dev mode container" - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - echo "Launching devmode chaincode container $CONTAINER_NAME" - echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" - echo " MSP: $ORG_MSP" - echo " PEER_TLS_CA: $PEER_TLS_CA_REL" - echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" - - local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - # Pick base image depending on lang - local CC_IMAGE="" - case "$CHAINCODE_LANG" in - node) - CC_IMAGE="node:16" - START_CMD="cd /usr/src/app && npm install && npm run start:watch" - ;; - golang | go) - CC_IMAGE="golang:1.20" - START_CMD="cd /usr/src/app && go mod tidy && go run ." - ;; - java) - CC_IMAGE="openjdk:11" - START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" - ;; - *) - echo "Unsupported chaincode language: $CHAINCODE_LANG" - exit 1 - ;; - esac - - local DOCKER_NETWORK - DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ - -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ - -v "$CHAINCODE_DIR:/usr/src/app" \\ - --network "$DOCKER_NETWORK" \\ - "$CC_IMAGE" \\ - bash -c "$START_CMD" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 6107a553..986af32b 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -3109,80 +3109,6 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } -startDevModeChaincodeProcess() { - local CHAINCODE_NAME="$1" - local CHAINCODE_VERSION="$2" - local CHAINCODE_LANG="$3" - local CHAINCODE_DIR="$4" - local ORG_MSP="$5" - local PEER_TLS_CA_REL="$6" - local ORDERER_TLS_CA_REL="$7" - local TLS_ENABLED="$8" - local PEER_ADDRESS="$9" - local ORG_DOMAIN=\${10} - - local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" - local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" - - local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" - local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") - local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # Generate certs for dev mode container - echo "Generating certifcates for dev mode container" - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - echo "Launching devmode chaincode container $CONTAINER_NAME" - echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" - echo " MSP: $ORG_MSP" - echo " PEER_TLS_CA: $PEER_TLS_CA_REL" - echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" - - local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - # Pick base image depending on lang - local CC_IMAGE="" - case "$CHAINCODE_LANG" in - node) - CC_IMAGE="node:16" - START_CMD="cd /usr/src/app && npm install && npm run start:watch" - ;; - golang | go) - CC_IMAGE="golang:1.20" - START_CMD="cd /usr/src/app && go mod tidy && go run ." - ;; - java) - CC_IMAGE="openjdk:11" - START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" - ;; - *) - echo "Unsupported chaincode language: $CHAINCODE_LANG" - exit 1 - ;; - esac - - local DOCKER_NETWORK - DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ - -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ - -v "$CHAINCODE_DIR:/usr/src/app" \\ - --network "$DOCKER_NETWORK" \\ - "$CC_IMAGE" \\ - bash -c "$START_CMD" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 72527e65..71f71af8 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -3133,80 +3133,6 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } -startDevModeChaincodeProcess() { - local CHAINCODE_NAME="$1" - local CHAINCODE_VERSION="$2" - local CHAINCODE_LANG="$3" - local CHAINCODE_DIR="$4" - local ORG_MSP="$5" - local PEER_TLS_CA_REL="$6" - local ORDERER_TLS_CA_REL="$7" - local TLS_ENABLED="$8" - local PEER_ADDRESS="$9" - local ORG_DOMAIN=\${10} - - local CC_ID="\${CHAINCODE_NAME}:\${CHAINCODE_VERSION}" - local CONTAINER_NAME="devmode-\${CHAINCODE_NAME}" - - local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" - local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") - local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # Generate certs for dev mode container - echo "Generating certifcates for dev mode container" - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - echo "Launching devmode chaincode container $CONTAINER_NAME" - echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" - echo " MSP: $ORG_MSP" - echo " PEER_TLS_CA: $PEER_TLS_CA_REL" - echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" - - local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - # Pick base image depending on lang - local CC_IMAGE="" - case "$CHAINCODE_LANG" in - node) - CC_IMAGE="node:16" - START_CMD="cd /usr/src/app && npm install && npm run start:watch" - ;; - golang | go) - CC_IMAGE="golang:1.20" - START_CMD="cd /usr/src/app && go mod tidy && go run ." - ;; - java) - CC_IMAGE="openjdk:11" - START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" - ;; - *) - echo "Unsupported chaincode language: $CHAINCODE_LANG" - exit 1 - ;; - esac - - local DOCKER_NETWORK - DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ID_NAME="$CC_ID" \\ - -e CORE_PEER_LOCALMSPID="$ORG_MSP" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=debug \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \\ - -v "$CHAINCODE_DIR:/usr/src/app" \\ - --network "$DOCKER_NETWORK" \\ - "$CC_IMAGE" \\ - bash -c "$START_CMD" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 diff --git a/samples/chaincodes/chaincode-kv-node/package.json b/samples/chaincodes/chaincode-kv-node/package.json index e115c1e9..009b5260 100644 --- a/samples/chaincodes/chaincode-kv-node/package.json +++ b/samples/chaincodes/chaincode-kv-node/package.json @@ -10,6 +10,8 @@ "start": "fabric-chaincode-node start", "start:ccaas": "fabric-chaincode-node server --chaincode-address 0.0.0.0:7052 --chaincode-id \"$CHAINCODE_ID\"", "start:dev": "fabric-chaincode-node start --peer.address \"127.0.0.1:8541\" --chaincode-id-name \"chaincode1:0.0.1\" --tls.enabled false", + "start:tls": "fabric-chaincode-node start --peer.address \"127.0.0.1:8541\" --chaincode-id-name \"chaincode1:0.0.1\" --tls.enabled true", + "start:dev:tls": "nodemon --exec \"npm run start:tls\"", "start:watch": "nodemon --exec \"npm run start:dev\"", "build": "echo \"No need to build the chaincode\"", "lint": "eslint . --fix --ext .js" diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 71ac171e..84ed9d65 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -115,6 +115,7 @@ installChaincodes() { <% chaincodes.forEach((chaincode) => { -%> if [ -n "$(ls "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>")" ]; then <% if (global.peerDevMode) { -%> + local version="<%= chaincode.version %>" <%- include('commands-generated/chaincode-dev-v2.sh', { chaincode }); -%> <% } else { -%> local version="<%= chaincode.version %>" diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh index 76dbcb4a..8e48387f 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh @@ -1,10 +1,27 @@ <%/* Run chaincode in dev mode for V2 capabilities. + Required bash variables: + - version Required template parameters: - chaincode */-%> <% chaincode.channel.orgs.forEach((org) => { -%> + chaincodePackage <% -%> + "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> + "<%= chaincode.instantiatingOrg.headPeer.fullAddress %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= chaincode.lang %>" <% -%> + <% org.peers.forEach((peer, i) => { -%> + printHeadline "Installing '<%= chaincode.name %>' for <%= org.name %>" "U1F60E" + chaincodeInstall <% -%> + "<%= org.cli.address %>" <% -%> + "<%= peer.fullAddress %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" + <% }) -%> printHeadline "Approving '<%= chaincode.name %>' for <%= org.name %> (dev mode)" "U1F60E" chaincodeApprove <% -%> "<%= org.cli.address %>" <% -%> @@ -19,35 +36,27 @@ "<%= chaincode.privateDataConfigFile || '' %>" <% -%> "" <% -%> "" - -printItalics "Committing chaincode '<%= chaincode.name %>' on channel '<%= chaincode.channel.name %>' as '<%= chaincode.instantiatingOrg.name %>' (dev mode)" "U1F618" -chaincodeCommit <% -%> - "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> - "<%= chaincode.instantiatingOrg.headPeer.fullAddress %>" <% -%> - "<%= chaincode.channel.name %>" <% -%> - "<%= chaincode.name %>" <% -%> - "<%= chaincode.version %>" <% -%> - "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> - "<%- chaincode.endorsement || '' %>" <% -%> - "false" <% -%> - "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> - "<%= chaincode.channel.orgs.map((o) => o.headPeer.fullAddress).join(',') %>" <% -%> - "<%= !global.tls ? '' : chaincode.channel.orgs.map(o => `crypto-peer/${o.headPeer.address}/tls/ca.crt`).join(',') %>" <% -%> - "<%= chaincode.privateDataConfigFile || '' %>" - -<% if (global.tls) { -%> - printHeadline "Launching devmode chaincode runtime for '<%= chaincode.name %>'" "U1F680" - startDevModeChaincodeProcess <% -%> + printItalics "Committing chaincode '<%= chaincode.name %>' on channel '<%= chaincode.channel.name %>' as '<%= chaincode.instantiatingOrg.name %>' (dev mode)" "U1F618" + chaincodeCommit <% -%> + "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> + "<%= chaincode.instantiatingOrg.headPeer.fullAddress %>" <% -%> + "<%= chaincode.channel.name %>" <% -%> "<%= chaincode.name %>" <% -%> "<%= chaincode.version %>" <% -%> - "<%= chaincode.lang %>" <% -%> - "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>" <% -%> - "<%= chaincode.instantiatingOrg.mspName %>" <% -%> - "peerOrganizations/<%= org.domain %>/peers/<%= chaincode.instantiatingOrg.headPeer.address %>/tls/ca.crt" <% -%> - "peerOrganizations/<%= chaincode.channel.ordererHead.domain %>/tlsca/tlsca.<%= chaincode.channel.ordererHead.domain %>-cert.pem" <% -%> - "<%= global.tls %>" <% -%> - "<%= chaincode.instantiatingOrg.headPeer.address %>" <% -%> - "<%= org.domain %>" - + "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> + "<%- chaincode.endorsement || '' %>" <% -%> + "false" <% -%> + "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> + "<%= chaincode.channel.orgs.map((o) => o.headPeer.fullAddress).join(',') %>" <% -%> + "<%= !global.tls ? '' : chaincode.channel.orgs.map(o => `crypto-peer/${o.headPeer.address}/tls/ca.crt`).join(',') %>" <% -%> + "<%= chaincode.privateDataConfigFile || '' %>" +<% if (global.tls) { -%> + printHeadline "Generating TLS certs to be used by '<%= chaincode.name %>'" "U1F680" + certsGenerateCCaaS <% -%> + "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" <% -%> + "devmode-<%= chaincode.name %>" <% -%> + "<%= org.domain %>" <% -%> + "<%= chaincode.name %>" <% -%> + "<%= chaincode.instantiatingOrg.headPeer.address %>" <% } -%> <% }) -%> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 0844f058..3ebb118b 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -264,80 +264,6 @@ startCCaaSContainer() { "$CHAINCODE_IMAGE" } -startDevModeChaincodeProcess() { - local CHAINCODE_NAME="$1" - local CHAINCODE_VERSION="$2" - local CHAINCODE_LANG="$3" - local CHAINCODE_DIR="$4" - local ORG_MSP="$5" - local PEER_TLS_CA_REL="$6" - local ORDERER_TLS_CA_REL="$7" - local TLS_ENABLED="$8" - local PEER_ADDRESS="$9" - local ORG_DOMAIN=${10} - - local CC_ID="${CHAINCODE_NAME}:${CHAINCODE_VERSION}" - local CONTAINER_NAME="devmode-${CHAINCODE_NAME}" - - local BASE_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config" - local PEER_TLS_CA=$(realpath "$BASE_PATH/$PEER_TLS_CA_REL") - local ORDERER_TLS_CA=$(realpath "$BASE_PATH/$ORDERER_TLS_CA_REL") - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # Generate certs for dev mode container - echo "Generating certifcates for dev mode container" - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - echo "Launching devmode chaincode container $CONTAINER_NAME" - echo " CHAINCODE: $CHAINCODE_NAME v$CHAINCODE_VERSION ($CHAINCODE_LANG)" - echo " MSP: $ORG_MSP" - echo " PEER_TLS_CA: $PEER_TLS_CA_REL" - echo " ORDERER_TLS_CA: $ORDERER_TLS_CA_REL" - - local TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - # Pick base image depending on lang - local CC_IMAGE="" - case "$CHAINCODE_LANG" in - node) - CC_IMAGE="node:16" - START_CMD="cd /usr/src/app && npm install && npm run start:watch" - ;; - golang|go) - CC_IMAGE="golang:1.20" - START_CMD="cd /usr/src/app && go mod tidy && go run ." - ;; - java) - CC_IMAGE="openjdk:11" - START_CMD="cd /usr/src/app && ./gradlew installDist && ./build/install/chaincode/bin/chaincode" - ;; - *) - echo "Unsupported chaincode language: $CHAINCODE_LANG" - exit 1 - ;; - esac - - local DOCKER_NETWORK - DOCKER_NETWORK=$(docker inspect peer0.org1.example.com | jq -r '.[0].NetworkSettings.Networks | keys[0]') - - docker run -d \ - --name "$CONTAINER_NAME" \ - -e CORE_CHAINCODE_ID_NAME="$CC_ID" \ - -e CORE_PEER_LOCALMSPID="$ORG_MSP" \ - -e CORE_CHAINCODE_LOGGING_LEVEL=debug \ - -e CORE_PEER_TLS_ENABLED=true \ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \ - -e CORE_CHAINCODE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client.crt \ - -e CORE_CHAINCODE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client.key \ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \ - -v "$ORDERER_TLS_CA:/etc/hyperledger/fabric/orderer.crt" \ - -v "$CHAINCODE_DIR:/usr/src/app" \ - --network "$DOCKER_NETWORK" \ - "$CC_IMAGE" \ - bash -c "$START_CMD" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 From a2cec36f8b07b75f0705cc338df2ebf69ed3eaec Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 26 Sep 2025 15:50:21 +0200 Subject: [PATCH 7/7] temp-handover for support Signed-off-by: Pereowei Daniel --- .../docker/test-07-v2-peer-dev-mode.sh | 7 ++-- e2e/__snapshots__/extendConfig.test.ts.snap | 36 +++++++++---------- ...1chaincode-peer-dev-mode.json.test.ts.snap | 26 ++++++-------- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 10 +++--- ...2chaincodes-private-data.yaml.test.ts.snap | 32 ++++++++--------- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 32 ++++++++--------- ...1chaincode-raft-explorer.json.test.ts.snap | 12 +++---- samples/chaincodes/.gitignore | 1 + .../chaincodes/chaincode-kv-node/package.json | 2 +- ...ig-hlf2-1org-1chaincode-peer-dev-mode.json | 2 +- .../commands-generated/chaincode-dev-v2.sh | 32 ++++++++--------- .../fabric-docker/docker-compose.yaml | 2 +- 12 files changed, 95 insertions(+), 99 deletions(-) diff --git a/e2e-network/docker/test-07-v2-peer-dev-mode.sh b/e2e-network/docker/test-07-v2-peer-dev-mode.sh index d5ef6d3b..b493b690 100755 --- a/e2e-network/docker/test-07-v2-peer-dev-mode.sh +++ b/e2e-network/docker/test-07-v2-peer-dev-mode.sh @@ -66,10 +66,11 @@ echo "All nodes are ready" cat >"$NODECHAINCODE/.env" < <% chaincode.channel.orgs.forEach((org) => { -%> - chaincodePackage <% -%> - "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> - "<%= chaincode.instantiatingOrg.headPeer.fullAddress %>" <% -%> - "<%= chaincode.name %>" <% -%> - "$version" <% -%> - "<%= chaincode.lang %>" <% -%> - <% org.peers.forEach((peer, i) => { -%> - printHeadline "Installing '<%= chaincode.name %>' for <%= org.name %>" "U1F60E" - chaincodeInstall <% -%> - "<%= org.cli.address %>" <% -%> - "<%= peer.fullAddress %>" <% -%> - "<%= chaincode.name %>" <% -%> - "$version" <% -%> - "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" - <% }) -%> + # chaincodePackage <% -%> + # "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> + # "<%= chaincode.instantiatingOrg.headPeer.fullAddress %>" <% -%> + # "<%= chaincode.name %>" <% -%> + # "$version" <% -%> + # "<%= chaincode.lang %>" <% -%> + # <% org.peers.forEach((peer, i) => { -%> + # printHeadline "Installing '<%= chaincode.name %>' for <%= org.name %>" "U1F60E" + # chaincodeInstall <% -%> + # "<%= org.cli.address %>" <% -%> + # "<%= peer.fullAddress %>" <% -%> + # "<%= chaincode.name %>" <% -%> + # "$version" <% -%> + # "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" + # <% }) -%> printHeadline "Approving '<%= chaincode.name %>' for <%= org.name %> (dev mode)" "U1F60E" chaincodeApprove <% -%> "<%= org.cli.address %>" <% -%> @@ -54,7 +54,7 @@ printHeadline "Generating TLS certs to be used by '<%= chaincode.name %>'" "U1F680" certsGenerateCCaaS <% -%> "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" <% -%> - "devmode-<%= chaincode.name %>" <% -%> + "devmode-<%= chaincode.instantiatingOrg.headPeer.address %>-<%= chaincode.name %>" <% -%> "<%= org.domain %>" <% -%> "<%= chaincode.name %>" <% -%> "<%= chaincode.instantiatingOrg.headPeer.address %>" diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index a9f1b4d4..a209bd53 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -289,7 +289,7 @@ services: # ccaas builder configuration - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"<%= peer.name %><%= org.name %>"} working_dir: /etc/hyperledger/fabric/peer/ - command: peer node start <%= global.peerDevMode && !global.tls ? '--peer-chaincodedev=true' : '' %> + command: peer node start <%= global.peerDevMode ? '--peer-chaincodedev=true' : '' %> ports: - <%= peer.port + 1000 %>:9440 - <%= peer.port %>:<%= peer.port %>