Skip to content

Commit aedd566

Browse files
[ gh-30 ] token sample .
Signed-off-by: ZHANG, HENGMING <22887031+ghpZ54K8ZRwU62zGVSePPs97yAv9swuAY0mVDR4@users.noreply.github.com>
1 parent 9cc5eaf commit aedd566

File tree

8 files changed

+27
-20
lines changed

8 files changed

+27
-20
lines changed

samples/tokens/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ help:
5454
help_msg = ""; \
5555
} \
5656
} \
57-
' $(MAKEFILE_LIST)
57+
' $(MAKEFILE_LIST)

samples/tokens/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ To run on Fabric v3, we use Fabric samples test network (`$(FABRIC_SAMPLES)/test
104104
Ensure Fabric binaries are in your `PATH` and Docker images are available. If not, install them as follows.
105105
106106
```shell
107-
curl -sSLO https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh && chmod +x install-fabric.sh
108107
./install-fabric.sh --fabric-version 3.1.1
109108
export PATH=$(pwd)/fabric-samples/bin:$PATH
110109
```

samples/tokens/app.mk

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export PLATFORM
88
ifneq ($(PLATFORM),fabricx)
99
COMPOSE_ARGS := -f compose.yml -f compose-endorser2.yml
1010
endif
11+
CONTAINER_CLI ?= docker
1112

1213
# Setup application
1314
.PHONY: setup-app
@@ -17,28 +18,28 @@ setup-app: build-app
1718
# Setup application
1819
.PHONY: build-app
1920
build-app:
20-
docker-compose $(COMPOSE_ARGS) build
21+
$(CONTAINER_CLI)-compose $(COMPOSE_ARGS) build
2122

2223
# Start application
2324
.PHONY: start-app
2425
start-app:
25-
docker-compose $(COMPOSE_ARGS) up -d
26+
$(CONTAINER_CLI)-compose $(COMPOSE_ARGS) up -d
2627

2728
# Restart application
2829
.PHONY: restart-app
2930
restart-app:
30-
docker-compose $(COMPOSE_ARGS) down
31-
docker-compose $(COMPOSE_ARGS) up -d
31+
$(CONTAINER_CLI)-compose $(COMPOSE_ARGS) down
32+
$(CONTAINER_CLI)-compose $(COMPOSE_ARGS) up -d
3233

3334
# Stop application
3435
.PHONY: stop-app
3536
stop-app:
36-
PLATFORM=$(PLATFORM) docker-compose $(COMPOSE_ARGS) stop
37+
PLATFORM=$(PLATFORM) $(CONTAINER_CLI)-compose $(COMPOSE_ARGS) stop
3738

3839
# Teardown application
3940
.PHONY: teardown-app
4041
teardown-app:
41-
docker-compose $(COMPOSE_ARGS) down
42+
$(CONTAINER_CLI)-compose $(COMPOSE_ARGS) down
4243
rm -rf "$(CONF_ROOT)"/*/data
4344

4445
# Clean just the databases.

samples/tokens/compose-endorser2.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ services:
2222
volumes:
2323
- ./${CONF_ROOT:-conf}/endorser2:/conf
2424
expose:
25-
- 9401:9001
25+
- 9401
26+
- 9001
2627
ports:
2728
- 9400:9000/tcp
2829

samples/tokens/compose.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ services:
2424
volumes:
2525
- ./${CONF_ROOT:-conf}/issuer:/conf
2626
expose:
27-
- 9101:9001
27+
- 9001
28+
- 9101
2829
ports:
2930
- 9100:9000/tcp
3031

@@ -41,7 +42,8 @@ services:
4142
- ./${CONF_ROOT:-conf}/endorser1:/conf
4243
- ./${CONF_ROOT:-conf}/namespace/zkatdlognoghv1_pp.json:/namespace/zkatdlognoghv1_pp.json
4344
expose:
44-
- 9301:9001
45+
- 9001
46+
- 9301
4547
ports:
4648
- 9300:9000/tcp
4749

@@ -57,7 +59,8 @@ services:
5759
volumes:
5860
- ./${CONF_ROOT:-conf}/owner1:/conf
5961
expose:
60-
- 9501:9001
62+
- 9001
63+
- 9501
6164
ports:
6265
- 9500:9000/tcp
6366

@@ -73,7 +76,8 @@ services:
7376
volumes:
7477
- ./${CONF_ROOT:-conf}/owner2:/conf
7578
expose:
76-
- 9601:9001
79+
- 9001
80+
- 9601
7781
ports:
7882
- 9600:9000/tcp
7983

samples/tokens/fabric3.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export CONF_ROOT
1414
# Makefile vars
1515
PLAYBOOK_PATH := $(CURDIR)/ansible/playbooks
1616
TARGET_HOSTS ?= all
17+
CONTAINER_CLI ?= docker
1718

1819
# Install the utilities needed to run the components on the targeted remote hosts (e.g. make install-prerequisites).
1920
.PHONY: install-prerequisites-fabric
@@ -55,11 +56,11 @@ stop-fabric:
5556
.PHONY: teardown-fabric
5657
teardown-fabric:
5758
@"$(FABRIC_SAMPLES)/test-network/network.sh" down
58-
@docker rm -f peer0org1_token_namespace_ccaas peer0org2_token_namespace_ccaas
59+
@$(CONTAINER_CLI) rm -f peer0org1_token_namespace_ccaas peer0org2_token_namespace_ccaas
5960
@for d in "$(CONF_ROOT)"/*/ ; do \
6061
rm -rf "$$d/keys/fabric" "$$d/data"; \
6162
done
62-
@docker network inspect fabric_test >/dev/null 2>&1 && docker network rm fabric_test || true
63+
@$(CONTAINER_CLI) network inspect fabric_test >/dev/null 2>&1 && $(CONTAINER_CLI) network rm fabric_test || true
6364

6465
# Restart the targeted hosts (e.g. make fabric-x restart).
6566
.PHONY: restart-fabric

samples/tokens/fabricx.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export CONF_ROOT
1616
# Makefile vars
1717
PLAYBOOK_PATH := $(CURDIR)/ansible/playbooks
1818
TARGET_HOSTS ?= all
19+
CONTAINER_CLI ?= docker
1920

2021
# Install the utilities needed to run the components on the targeted remote hosts (e.g. make install-prerequisites).
2122
.PHONY: install-prerequisites-fabric
@@ -39,7 +40,7 @@ clean-fabric:
3940
# Start fabric-x on the targeted hosts.
4041
.PHONY: start-fabric
4142
start-fabric:
42-
@docker network inspect fabric_test >/dev/null 2>&1 || docker network create fabric_test
43+
@$(CONTAINER_CLI) network inspect fabric_test >/dev/null 2>&1 || $(CONTAINER_CLI) network create fabric_test
4344
ansible-playbook "$(PLAYBOOK_PATH)/60-start.yaml"
4445

4546
# Create a namespace in fabric-x for the tokens.
@@ -62,7 +63,7 @@ stop-fabric:
6263
.PHONY: teardown-fabric
6364
teardown-fabric:
6465
ansible-playbook "$(PLAYBOOK_PATH)/80-teardown.yaml"
65-
@docker network inspect fabric_test >/dev/null 2>&1 && docker network rm fabric_test || true
66+
@$(CONTAINER_CLI) network inspect fabric_test >/dev/null 2>&1 && $(CONTAINER_CLI) network rm fabric_test || true
6667

6768
# Restart the targeted hosts (e.g. make fabric-x restart).
6869
.PHONY: restart-fabric

samples/tokens/install-fabric.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ _arg_comp=('' )
2121

2222
# if version not passed in, default to latest released version
2323
# if ca version not passed in, default to latest released version
24-
_arg_fabric_version="2.5.12"
24+
_arg_fabric_version="2.5.14"
2525
_arg_ca_version="1.5.15"
2626

2727
OS=$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')
@@ -56,7 +56,7 @@ print_help()
5656
{
5757
printf 'Usage: %s [-f|--fabric-version <arg>] [-c|--ca-version <arg>] <comp-1> [<comp-2>] ... [<comp-n>] ...\n' "$0"
5858
printf '\t%s\n' "<comp> Component to install, one or more of docker | binary | samples | podman First letter of component also accepted; If none specified docker | binary | samples is assumed"
59-
printf '\t%s\n' "-f, --fabric-version: FabricVersion (default: '2.5.12')"
59+
printf '\t%s\n' "-f, --fabric-version: FabricVersion (default: '2.5.14')"
6060
printf '\t%s\n' "-c, --ca-version: Fabric CA Version (default: '1.5.15')"
6161
}
6262

@@ -252,7 +252,7 @@ download() {
252252
DEST_DIR="fabric-samples"
253253
fi
254254
echo "===> Will unpack to: ${DEST_DIR}"
255-
curl -L --retry 5 --retry-delay 3 "${URL}" | tar xz -C ${DEST_DIR}|| rc=$?
255+
curl -L --retry 5 --retry-delay 3 "${URL}" | tar xz -C "${DEST_DIR}"|| rc=$?
256256
if [ -n "$rc" ]; then
257257
echo "==> There was an error downloading the binary file."
258258
return 22

0 commit comments

Comments
 (0)