You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
build: include cmd-socketio-server and socketio validators in the monorepo setup
Multiple changes in order to include cactus-cmd-socketio-server, and 3
connectors (fabric-socketio, go-ethereum-socketio and sawtooth-socketio)
in common monorepo setup. They'll all build as part of root setup build.
Also updated readme and done some other minor fixes related to this
issue.
Closes: #1647
Signed-off-by: Michal Bajer <[email protected]>
@@ -15,130 +15,123 @@ Cactus **car-trade** is a sample application where users can exchange car owners
15
15
## Prerequisites
16
16
17
17
- Available ports:
18
-
- `5034`: the port of `cactus-cmd-socker-server`
19
-
- `5040`: the port of `cactus-plugin-ledger-connector-fabric-socketio`
20
-
- `5050`: the port of `cactus-plugin-ledger-connector-go-ethereum-socketio`
21
-
- If it is already used, the following processes can be done by changing the port number setting
18
+
-`5034`: the port of `cactus-cmd-socketio-server`
19
+
-`5040`: the port of `cactus-plugin-ledger-connector-fabric-socketio`
20
+
-`5050`: the port of `cactus-plugin-ledger-connector-go-ethereum-socketio`
21
+
- If it is already used, the following processes can be done by changing the port number setting
22
22
- Available directory (This directory must be empty):
23
-
- `/etc/cactus`: the directory for storing the config files of `cactus-cmd-socket-server`
23
+
-`/etc/cactus`: the directory for storing the config files of `cactus-cmd-socket-server`
24
24
25
25
## Boot method
26
26
27
27
1. Before booting, please prepare the directory for storing config files on the directoty `/etc/cactus` on your server
28
-
```
29
-
sudo mkdir /etc/cactus
30
-
sudo chmod 777 /etc/cactus
31
-
```
28
+
```
29
+
sudo mkdir /etc/cactus
30
+
sudo chmod 777 /etc/cactus
31
+
```
32
32
33
33
1. Before booting, please modify `applicationHostInfo.hostName` and `applicationHostInfo.hostPort` on `cactus/etc/cactus/default.yaml` to adjust to your environment.
34
-
```
35
-
vi cactus/etc/cactus/default.yaml
34
+
```
35
+
vi cactus/etc/cactus/default.yaml
36
36
37
-
[cactus/etc/cactus/default.yaml]
38
-
applicationHostInfo:
39
-
hostName: http://aaa.bbb.ccc.ddd # please change hostName to your IP address
40
-
hostPort: 5034 # if you want to change the port number, please change hostPort to the port number which you want to use
41
-
```
37
+
[cactus/etc/cactus/default.yaml]
38
+
applicationHostInfo:
39
+
hostName: http://aaa.bbb.ccc.ddd # please change hostName to your IP address
40
+
hostPort: 5034 # if you want to change the port number, please change hostPort to the port number which you want to use
41
+
```
42
42
43
43
1. Start ledgers:
44
-
```
45
-
./script-start-ledgers.sh
46
-
```
47
-
- (NOTICE: Before executing the above, your account needs to be added to the docker group (`usermod -a -G docker YourAccount` from root user))
48
-
- If the following containers are started when displaying the container list with the docker ps command, it will be fine.
49
-
```
50
-
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
51
-
14b98ba40b66 dev-peer0.org1.example.com-fabcar-1.0-5c906e402ed29f20260ae42283216aa75549c571e2e380f3615826365d8269ba "chaincode -peer.add…" 42 seconds ago Up 40 seconds dev-peer0.org1.example.com-fabcar-1.0
52
-
d0efd7479bdd hyperledger/fabric-tools "/bin/bash" About a minute ago Up 56 seconds cli
53
-
c9bd7ddfde7e hyperledger/fabric-peer "peer node start" About a minute ago Up About a minute 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
54
-
d4f2b1a76626 hyperledger/fabric-couchdb "tini -- /docker-ent…" About a minute ago Up About a minute 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp couchdb
55
-
53a79780f564 hyperledger/fabric-ca "sh -c 'fabric-ca-se…" About a minute ago Up About a minute 0.0.0.0:7054->7054/tcp ca.example.com
56
-
aceb0e52e9c7 hyperledger/fabric-orderer "orderer" About a minute ago Up About a minute 0.0.0.0:7050->7050/tcp orderer.example.com
57
-
ec57c9f78d0d ethereum/client-go:v1.8.27 "geth --rpc --networ…" 2 minutes ago Up 2 minutes 8546/tcp, 0.0.0.0:8545->8545/tcp, 30303/tcp, 30303/udp geth1
58
-
```
44
+
```
45
+
./script-start-ledgers.sh
46
+
```
47
+
- (NOTICE: Before executing the above, your account needs to be added to the docker group (`usermod -a -G docker YourAccount` from root user))
48
+
- If the following containers are started when displaying the container list with the docker ps command, it will be fine.
49
+
```
50
+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
51
+
14b98ba40b66 dev-peer0.org1.example.com-fabcar-1.0-5c906e402ed29f20260ae42283216aa75549c571e2e380f3615826365d8269ba "chaincode -peer.add…" 42 seconds ago Up 40 seconds dev-peer0.org1.example.com-fabcar-1.0
52
+
d0efd7479bdd hyperledger/fabric-tools "/bin/bash" About a minute ago Up 56 seconds cli
53
+
c9bd7ddfde7e hyperledger/fabric-peer "peer node start" About a minute ago Up About a minute 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
54
+
d4f2b1a76626 hyperledger/fabric-couchdb "tini -- /docker-ent…" About a minute ago Up About a minute 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp couchdb
55
+
53a79780f564 hyperledger/fabric-ca "sh -c 'fabric-ca-se…" About a minute ago Up About a minute 0.0.0.0:7054->7054/tcp ca.example.com
56
+
aceb0e52e9c7 hyperledger/fabric-orderer "orderer" About a minute ago Up About a minute 0.0.0.0:7050->7050/tcp orderer.example.com
57
+
ec57c9f78d0d ethereum/client-go:v1.8.27 "geth --rpc --networ…" 2 minutes ago Up 2 minutes 8546/tcp, 0.0.0.0:8545->8545/tcp, 30303/tcp, 30303/udp geth1
58
+
```
59
59
60
60
1. Please prepare the three consoles on your machine as the following:
61
-
- **console 1**: console for launching `cactus-plugin-ledger-connector-go-ethereum-socketio`
62
-
- **console 2**: console for launching `cactus-plugin-ledger-connector-fabric-socketio`
63
-
- **console 3**: console for launching `cactus-cmd-socker-server` including `cartrade` business logic application.
61
+
- **console 1**: console for launching `cactus-plugin-ledger-connector-go-ethereum-socketio`
62
+
- **console 2**: console for launching `cactus-plugin-ledger-connector-fabric-socketio`
63
+
- **console 3**: console for launching `cactus-cmd-socketio-server` including `cartrade` business logic application.
64
64
65
65
1. Launch the validators:
66
-
- Please execute [the boot methods](../../packages/cactus-plugin-ledger-connector-go-ethereum-socketio/README.md#boot-methods) of `cactus-plugin-ledger-connector-go-ethereum-socketio` on the **console 1** using the port `5050`
67
-
- Please execute [the boot methods](../../packages/cactus-plugin-ledger-connector-fabric-socketio/README.md#boot-methods) of `cactus-plugin-ledger-connector-fabric-socketio` on the **console 2** using the port `5040`
68
-
69
-
2. Launch `cactus-cmd-socker-server` including `cartrade` business logic application
70
-
- Use the **console 3**
71
-
- Install and build npm packages on `cactus-cmd-socker-server`
72
-
```
73
-
cd cactus/packages/cactus-cmd-socker-server
74
-
npm install
75
-
npm run build
76
-
```
77
-
- Install and build npm packages on `cactus/examples/cartrade`
78
-
```
79
-
cd cactus/examples/cartrade
80
-
npm install
81
-
npm run build
82
-
```
83
-
- Create the symbolic link to node_modules. This script is enough to execute only once.
84
-
```
85
-
cd cactus/examples/cartrade
86
-
npm run init-cartrade
87
-
```
88
-
- Launch the `cactus-cmd-server-socket` `cactus-cmd-socker-server` including `cartrade` business logic application
89
-
```
90
-
cd cactus/examples/cartrade
91
-
npm run start
92
-
```
93
-
- After executing the above script, `cactus-cmd-socker-server` is launched on the port `5034`.
66
+
- Please execute [the boot methods](../../packages/cactus-plugin-ledger-connector-go-ethereum-socketio/README.md#boot-methods) of `cactus-plugin-ledger-connector-go-ethereum-socketio` on the **console 1** using the port `5050`
67
+
- Please execute [the boot methods](../../packages/cactus-plugin-ledger-connector-fabric-socketio/README.md#boot-methods) of `cactus-plugin-ledger-connector-fabric-socketio` on the **console 2** using the port `5040`
68
+
69
+
2. Launch `cactus-cmd-socketio-server` including `cartrade` business logic application
70
+
- Use the **console 3**
71
+
- Build base npm packages (including `cactus-cmd-socketio-server`) from cactus root directory
72
+
```
73
+
npm run configure
74
+
```
75
+
- Install and build npm packages on `examples/cartrade`
76
+
```
77
+
cd ./examples/cartrade
78
+
npm install
79
+
npm run build
80
+
```
81
+
- Launch the `cactus-cmd-socketio-server` including `cartrade` business logic application
82
+
```
83
+
cd ./examples/cartrade
84
+
npm run start
85
+
```
86
+
- After executing the above script, `cactus-cmd-socketio-server` is launched on the port `5034`.
94
87
95
88
## How to use this application
96
89
97
90
1. (Optional) Check the balance on Ethereum and the fabcar ownership on Fabric using the following script
98
-
- `./script-build-get-app.sh` (only the first time)
99
-
- `./script-get-app.sh`
100
-
- The result is as the following:
101
-
```
102
-
[process] Execute an app for getting Balance on Ethereum
103
-
The balance of fromAccount:
104
-
BigNumber { s: 1, e: 4, c: [ 100000 ] }
105
-
The balance of toAccount:
106
-
BigNumber { s: 1, e: 1, c: [ 0 ] }
107
-
[process] Execute an app for getting ownership on Fabcar
108
-
##queryCar Params: CAR1
109
-
Transaction has been evaluated, result is: {"colour":"red","make":"Ford","model":"Mustang","owner":"Brad"}
110
-
```
91
+
- `./script-build-get-app.sh` (only the first time)
92
+
- `./script-get-app.sh`
93
+
- The result is as the following:
94
+
```
95
+
[process] Execute an app for getting Balance on Ethereum
96
+
The balance of fromAccount:
97
+
BigNumber { s: 1, e: 4, c: [ 100000 ] }
98
+
The balance of toAccount:
99
+
BigNumber { s: 1, e: 1, c: [ 0 ] }
100
+
[process] Execute an app for getting ownership on Fabcar
101
+
##queryCar Params: CAR1
102
+
Transaction has been evaluated, result is: {"colour":"red","make":"Ford","model":"Mustang","owner":"Brad"}
103
+
```
111
104
1. Run the transaction execution using the following script
- After this, the transactions are executed by order. When the following log appears on the above third console (the console of `./script-start-cartrade.sh`), the transactions are completed.
- After this, the transactions are executed by order. When the following log appears on the above third console (the console of `./script-start-cartrade.sh`), the transactions are completed.
1. (Optional) Check the balance on Ethereum and the fabcar ownership on Fabric using the following script
121
-
- `./script-get-app.sh`
122
-
- The result is as the following. In the following case, 50 coins from fromAccount was transferred to toAccount, and the car ownership ("owner") was transferred.
123
-
```
124
-
[process] Execute an app for getting Balance on Ethereum
125
-
The balance of fromAccount:
126
-
BigNumber { s: 1, e: 4, c: [ 99950 ] }
127
-
The balance of toAccount:
128
-
BigNumber { s: 1, e: 1, c: [ 50 ] }
129
-
[process] Execute an app for getting ownership on Fabcar
130
-
##queryCar Params: CAR1
131
-
Transaction has been evaluated, result is: {"colour":"red","make":"Ford","model":"Mustang","owner":"Cathy"}
132
-
```
114
+
- `./script-get-app.sh`
115
+
- The result is as the following. In the following case, 50 coins from fromAccount was transferred to toAccount, and the car ownership ("owner") was transferred.
116
+
```
117
+
[process] Execute an app for getting Balance on Ethereum
118
+
The balance of fromAccount:
119
+
BigNumber { s: 1, e: 4, c: [ 99950 ] }
120
+
The balance of toAccount:
121
+
BigNumber { s: 1, e: 1, c: [ 50 ] }
122
+
[process] Execute an app for getting ownership on Fabcar
123
+
##queryCar Params: CAR1
124
+
Transaction has been evaluated, result is: {"colour":"red","make":"Ford","model":"Mustang","owner":"Cathy"}
125
+
```
133
126
134
127
## How to stop the application and Docker containers
135
128
136
-
1. Stop the validators and `cactus-cmd-server-socket`
137
-
- Press Ctrl+C on the above the **console 1, 2, and 3**.
129
+
1. Stop the validators and `cactus-cmd-socketio-server`
130
+
- Press Ctrl+C on the above the **console 1, 2, and 3**.
138
131
1. Remove the config files on your machine
139
-
```
140
-
sudo rm -r /etc/cactus/
141
-
```
132
+
```
133
+
sudo rm -r /etc/cactus/
134
+
```
142
135
1. Stop the docker containers of Ethereum and Fabric
143
-
- Press the command `docker stop <CONTAINER ID>` to stop the container corresponding to the above containers which were launched by `./script-start-ledgers.sh` on the boot method. If you want to destroy the docker containers, press the command `docker rm <CONTAINER ID>` after the above.
144
-
- If any other docker containers are not running on your machine, you can destroy the Docker containers only with `docker ps -aq | xargs docker stop` and `docker ps -aq | xargs docker rm`.
136
+
- Press the command `docker stop <CONTAINER ID>` to stop the container corresponding to the above containers which were launched by `./script-start-ledgers.sh` on the boot method. If you want to destroy the docker containers, press the command `docker rm <CONTAINER ID>` after the above.
137
+
- If any other docker containers are not running on your machine, you can destroy the Docker containers only with `docker ps -aq | xargs docker stop` and `docker ps -aq | xargs docker rm`.
0 commit comments