Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit db3fe87

Browse files
aldousalvarezoutSH
authored andcommitted
docs(examples/supply-chain): fix yarn --no-lockfile
Primary Changes --------------- 1. Removed examples/supply-chain-app/package.json and moved the other files to cactus-example-supply -chain-backend 2. Updated the docs to match the updated path of the supply-chain-app files to cactus-example-supply- chain-backend and the new steps on how run the latest supply chain app 3. Updated the code responses in connector-fabric from null to (0) based on the logs and responses while running the application. 4. Added a parse.int for shelfCount in bookshelf- converter because it requires a number but instead the value becomes a string before it is submitted. Fixes hyperledger-cacti#2721 Signed-off-by: aldousalvarez <aldousss.alvarez@gmail.com>
1 parent 73ff593 commit db3fe87

21 files changed

Lines changed: 91 additions & 141 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2187,7 +2187,7 @@ jobs:
21872187
steps:
21882188
- uses: actions/checkout@v3.5.2
21892189
- name: ghcr.io/hyperledger/cactus-example-supply-chain-app
2190-
run: DOCKER_BUILDKIT=1 docker build . -f ./examples/supply-chain-app/Dockerfile -t cactus-example-supply-chain-app
2190+
run: DOCKER_BUILDKIT=1 docker build . -f ./examples/cactus-example-supply-chain-backend/Dockerfile -t cactus-example-supply-chain-app
21912191
- name: Run Trivy vulnerability scan for cactus-example-supply-chain-app
21922192
uses: aquasecurity/trivy-action@0.11.2
21932193
with:

.github/workflows/example-supply-chain-app-publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
runs-on: ubuntu-20.04
2525
env:
2626
DOCKER_BUILDKIT: 1
27-
DOCKERFILE_PATH: ./examples/supply-chain-app/Dockerfile
27+
DOCKERFILE_PATH: ./examples/cactus-example-supply-chain-backend/Dockerfile
2828
DOCKER_BUILD_DIR: ./
2929
permissions:
3030
packages: write

.vscode/template.launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
],
6161
"console": "integratedTerminal",
6262
"sourceMaps": true,
63-
"cwd": "${workspaceFolder}/examples/supply-chain-app/",
63+
"cwd": "${workspaceFolder}/examples/cactus-example-supply-chain-backend/",
6464
"outFiles": [
6565
"${workspaceFolder}/**/*.js",
6666
"!**/node_modules/**"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
```{include} ../../../examples/supply-chain-app/README.md
1+
```{include} ../../../examples/cactus-example-supply-chain-backend/README.md
22
:relative-images:
33
```

docs/docs/cactus/examples/supply-chain-app.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Usage
55
--------------------------------------------
66

77
1. Execute the following from:
8-
8+
99
docker run \\
1010
\--rm \\
1111
\--privileged \\
@@ -16,25 +16,25 @@ Usage
1616
\-p 4100:4100 \\
1717
\-p 4200:4200 \\
1818
ghcr.io/hyperledger/cactus-example-supply-chain-app:2022-04-05--feat-1579
19-
19+
2020
2. Observe the example application pulling up in the logs
21-
21+
2222
1. the test ledger containers,
23-
23+
2424
2. a test consortium with multiple members and their Cactus nodes
25-
25+
2626
3. Wait for the output to show the message `INFO (api-server): Cactus Cockpit reachable http://0.0.0.0:3200`
27-
27+
2828
4. Visit http://0.0.0.0:3200 in your web browser with Javascript enabled
29-
29+
3030

3131
Building and running the container locally
3232
----------------------------------------------------------------------------------------------------------------------
3333

3434
\# Change directories to the project root
3535

3636
\# Build the docker image and tag it as "scaeb" for supply chain app example backend
37-
DOCKER\_BUILDKIT\=1 docker build \-f ./examples/supply-chain-app/Dockerfile . \-t scaeb
37+
DOCKER\_BUILDKIT\=1 docker build \-f ./examples/cactus-example-supply-chain-backend/Dockerfile . \-t scaeb
3838

3939
\# Run the built image with ports mapped to the host machine as you see fit
4040
\# The --privileged flag is required because we use Docker-in-Docker for pulling
@@ -47,7 +47,7 @@ Building the image with a specific npm package version:
4747

4848
DOCKER\_BUILDKIT\=1 docker build \\
4949
\--build-arg NPM\_PKG\_VERSION\=jwt-supply-chain \\
50-
\--file ./examples/supply-chain-app/Dockerfile \\
50+
\--file ./examples/cactus-example-supply-chain-backend/Dockerfile \\
5151
\--tag scaeb \\
5252
./
5353

@@ -58,70 +58,70 @@ Running the Example Application Locally
5858
5959
On the terminal, issue the following commands:
6060

61-
1. `npm run install-yarn`
62-
63-
2. `yarn configure`
64-
61+
1. `npm run enable-corepack`
62+
63+
2. `yarn run configure`
64+
6565
3. `yarn start:example-supply-chain`
66-
66+
6767

6868
Debugging the Example Application Locally
6969
--------------------------------------------------------------------------------------------------------------------
7070

7171
On the terminal, issue the following commands (steps 1 to 6) and then perform the rest of the steps manually.
7272

73-
1. `npm run install-yarn`
74-
73+
1. `npm run enable-corepack`
74+
7575
2. `yarn configure`
76-
76+
7777
3. `yarn build:dev`
78-
79-
4. `cd ./examples/supply-chain-app/`
80-
81-
5. `yarn --no-lockfile`
82-
78+
79+
4. `cd ./examples/cactus-example-supply-chain-backend/`
80+
81+
5. `yarn install`
82+
8383
6. `cd ../../`
84-
84+
8585
7. Locate the `.vscode/template.launch.json` file
86-
86+
8787
8. Within that file locate the entry named `"Example: Supply Chain App"`
88-
88+
8989
9. Copy the VSCode debug definition object from 2) to your `.vscode/launch.json` file
90-
90+
9191
10. At this point the VSCode `Run and Debug` panel on the left should have an option also titled `"Example: Supply Chain App"` which starts the application
92-
92+
9393
11. When the application finishes loading, the JWT token generated is displayed on the terminal
94-
94+
9595
12. Visit http://localhost:3200 in a web browser with Javascript enabled and insert the token when prompted
96-
96+
9797

9898
Live Reloading the GUI Application
9999
------------------------------------------------------------------------------------------------------
100100

101-
1. `npm run install-yarn`
102-
101+
1. `npm run enable-corepack`
102+
103103
2. `yarn configure`
104-
104+
105105
3. `yarn build:dev`
106-
106+
107107
4. Locate the `.vscode/template.launch.json` file
108-
108+
109109
5. Within that file locate the entry named `"Example: Supply Chain App"`
110-
110+
111111
6. Copy the VSCode debug definition object from 2) to your `.vscode/launch.json` file
112-
112+
113113
7. At this point the VSCode `Run and Debug` panel on the left should have an option also titled `"Example: Supply Chain App"` which starts the application
114-
114+
115115
8. `cd ./examples/cactus-example-supply-chain-frontend/`
116-
116+
117117
9. `yarn serve:proxy`
118-
118+
119119
10. When the application finishes loading, the JWT token generated is displayed on the terminal
120-
120+
121121
11. Visit http://localhost:8000 in a web browser with Javascript enabled and insert the token when prompted
122-
122+
123123
12. At this point if you modify the source code of the GUI application under the `./examples/cactus-example-supply-chain-frontend/` path it will automatically reload the browser window (you will need to paste in the JWT again when this happens)
124-
124+
125125

126126
[Previous](../examples.md "Examples") [Next](../governance.md "Governance")
127127

examples/supply-chain-app/.dockerignore renamed to examples/cactus-example-supply-chain-backend/.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ coverage/
3939
# Introperability App specifics
4040
examples/simple-asset-transfer/fabric/**/hfc-key-store/
4141

42-
examples/supply-chain-app/Dockerfile
42+
examples/cactus-example-supply-chain-backend/Dockerfile
4343

4444
bin/
4545
.tmp/

examples/supply-chain-app/Dockerfile renamed to examples/cactus-example-supply-chain-backend/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ RUN source ~/.bashrc && \
4343
SHELL ["/bin/bash", "--login", "-c"]
4444

4545

46-
COPY --chown=${APP_USER}:${APP_USER} ./examples/supply-chain-app/healthcheck.sh /
46+
COPY --chown=${APP_USER}:${APP_USER} ./examples/cactus-example-supply-chain-backend/healthcheck.sh /
4747

4848
ENV AUTHORIZATION_CONFIG_JSON="{}"
4949
ENV AUTHORIZATION_PROTOCOL=NONE
@@ -67,7 +67,7 @@ ENV API_PORT=4000
6767
ENV GRPC_TLS_ENABLED=false
6868
ENV LOG_LEVEL=TRACE
6969

70-
COPY examples/supply-chain-app/supervisord.conf /etc/supervisord.conf
70+
COPY examples/cactus-example-supply-chain-backend/supervisord.conf /etc/supervisord.conf
7171

7272
# supervisord web ui/dashboard
7373
EXPOSE 9001
@@ -91,4 +91,4 @@ USER root
9191
ENTRYPOINT ["/usr/bin/supervisord"]
9292
CMD ["--configuration", "/etc/supervisord.conf", "--nodaemon"]
9393
HEALTHCHECK --interval=1s --timeout=5s --start-period=20s --retries=250 \
94-
CMD /usr/src/app/examples/supply-chain-app/healthcheck.sh
94+
CMD /usr/src/app/examples/cactus-example-supply-chain-backend/healthcheck.sh

examples/supply-chain-app/README.md renamed to examples/cactus-example-supply-chain-backend/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# Change directories to the project root
2929
3030
# Build the docker image and tag it as "scaeb" for supply chain app example backend
31-
DOCKER_BUILDKIT=1 docker build -f ./examples/supply-chain-app/Dockerfile . -t scaeb
31+
DOCKER_BUILDKIT=1 docker build -f ./examples/cactus-example-supply-chain-backend/Dockerfile . -t scaeb
3232
3333
# Run the built image with ports mapped to the host machine as you see fit
3434
# The --privileged flag is required because we use Docker-in-Docker for pulling
@@ -43,7 +43,7 @@ Building the image with a specific npm package version:
4343
```sh
4444
DOCKER_BUILDKIT=1 docker build \
4545
--build-arg NPM_PKG_VERSION=jwt-supply-chain \
46-
--file ./examples/supply-chain-app/Dockerfile \
46+
--file ./examples/cactus-example-supply-chain-backend/Dockerfile \
4747
--tag scaeb \
4848
./
4949
```
@@ -63,10 +63,10 @@ On the terminal, issue the following commands:
6363
On the terminal, issue the following commands (steps 1 to 6) and then perform the rest of the steps manually.
6464

6565
1. `npm run enable-corepack`
66-
2. `npm run configure`
66+
2. `yarn run configure`
6767
3. `yarn build:dev`
68-
4. `cd ./examples/supply-chain-app/`
69-
5. `yarn --no-lockfile`
68+
4. `cd ./examples/cactus-example-supply-chain-backend/`
69+
5. `yarn install`
7070
6. `cd ../../`
7171
7. Locate the `.vscode/template.launch.json` file
7272
8. Within that file locate the entry named `"Example: Supply Chain App"`
File renamed without changes.

examples/cactus-example-supply-chain-backend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
"dist/*"
4444
],
4545
"scripts": {
46+
"start": "node -r dotenv/config dist/lib/main/typescript/supply-chain-app-cli.js dotenv_config_path=process.env",
47+
"start-direct": "node ./node_modules/@hyperledger/cactus-example-supply-chain-backend/dist/lib/main/typescript/supply-chain-app-cli.js",
4648
"watch": "npm-watch",
4749
"webpack": "npm-run-all webpack:dev",
4850
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",

0 commit comments

Comments
 (0)