Skip to content

Commit d92358c

Browse files
committed
able to run ego inside docker!!
1 parent 035bde4 commit d92358c

File tree

18 files changed

+2218
-22
lines changed

18 files changed

+2218
-22
lines changed

tle_go/Dockerfile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,21 @@ ENV OE_SIMULATION=${OE_SIMULATION}
2323
ARG CAAS_PORT=50051
2424
ARG CC_PATH="/usr/local/bin"
2525

26-
COPY tle-bundle ${CC_PATH}/chaincode
26+
ENV CORE_CONFIG_PATH="/usr/local/bin/core.yaml"
27+
COPY core.yaml ${CORE_CONFIG_PATH}
28+
29+
ENV DEV_PATH="/usr/local/bin/sampleconfig"
30+
COPY sample-fabric-config ${DEV_PATH}
31+
32+
ENV BLOCK_PATH="/usr/local/bin/tmpBlocks/"
33+
COPY tmpBlocks ${BLOCK_PATH}
34+
35+
COPY tle-bundle ${CC_PATH}/tle
36+
COPY client ${CC_PATH}/client
2737

2838
WORKDIR ${CC_PATH}
2939
EXPOSE ${CAAS_PORT}
40+
EXPOSE 50051
3041

31-
CMD ["chaincode"]
42+
# CMD ["tle"]
43+
CMD ["sleep", "infinity"]

tle_go/client/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM golang:1.17-alpine
44
# Set the working directory inside the container
55
WORKDIR /app
66

7-
COPY ../ .
7+
COPY . .
88

99
# Set the entry point for the container
1010
CMD ["sleep", "infinity"]

tle_go/client/client

12 MB
Binary file not shown.

tle_go/client/client_linux

11.3 MB
Binary file not shown.

tle_go/core.yaml

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
---
2+
logging:
3+
spec: fpc=debug:endorser,grpc,comm.grpc,gossip=error:info
4+
format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'
5+
6+
peer:
7+
id: Org1.Org1_peer_0
8+
networkId: qfgthbp5evhunfg4kvekloal4u
9+
address: 127.0.0.1:20004
10+
addressAutoDetect: true
11+
listenAddress: 0.0.0.0:20004
12+
chaincodeListenAddress: 0.0.0.0:20005
13+
keepalive:
14+
minInterval: 60s
15+
interval: 300s
16+
timeout: 600s
17+
client:
18+
interval: 60s
19+
timeout: 600s
20+
deliveryClient:
21+
interval: 60s
22+
timeout: 20s
23+
gossip:
24+
bootstrap: 127.0.0.1:20004
25+
endpoint: 127.0.0.1:20004
26+
externalEndpoint: 127.0.0.1:20004
27+
useLeaderElection: true
28+
orgLeader: false
29+
membershipTrackerInterval: 5s
30+
maxBlockCountToStore: 100
31+
maxPropagationBurstLatency: 10ms
32+
maxPropagationBurstSize: 10
33+
propagateIterations: 1
34+
propagatePeerNum: 3
35+
pullInterval: 4s
36+
pullPeerNum: 3
37+
requestStateInfoInterval: 4s
38+
publishStateInfoInterval: 4s
39+
stateInfoRetentionInterval:
40+
publishCertPeriod: 10s
41+
dialTimeout: 3s
42+
connTimeout: 2s
43+
recvBuffSize: 20
44+
sendBuffSize: 200
45+
digestWaitTime: 1s
46+
requestWaitTime: 1500ms
47+
responseWaitTime: 2s
48+
aliveTimeInterval: 5s
49+
aliveExpirationTimeout: 25s
50+
reconnectInterval: 25s
51+
election:
52+
startupGracePeriod: 15s
53+
membershipSampleInterval: 1s
54+
leaderAliveThreshold: 10s
55+
leaderElectionDuration: 5s
56+
pvtData:
57+
pullRetryThreshold: 7s
58+
transientstoreMaxBlockRetention: 1000
59+
pushAckTimeout: 3s
60+
btlPullMargin: 10
61+
reconcileBatchSize: 10
62+
reconcileSleepInterval: 10s
63+
reconciliationEnabled: true
64+
skipPullingInvalidTransactionsDuringCommit: false
65+
state:
66+
enabled: true
67+
checkInterval: 10s
68+
responseTimeout: 3s
69+
batchSize: 10
70+
blockBufferSize: 100
71+
maxRetries: 3
72+
events:
73+
address: 127.0.0.1:20006
74+
buffersize: 100
75+
timeout: 10ms
76+
timewindow: 15m
77+
keepalive:
78+
minInterval: 60s
79+
tls:
80+
enabled: true
81+
clientAuthRequired: false
82+
cert:
83+
file: /Users/lew/go/src/github.com/hyperledger/fabric-private-chaincode/samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/crypto/peerOrganizations/org1.example.com/peers/Org1_peer_0.org1.example.com/tls/server.crt
84+
key:
85+
file: /Users/lew/go/src/github.com/hyperledger/fabric-private-chaincode/samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/crypto/peerOrganizations/org1.example.com/peers/Org1_peer_0.org1.example.com/tls/server.key
86+
clientCert:
87+
file: /Users/lew/go/src/github.com/hyperledger/fabric-private-chaincode/samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/crypto/peerOrganizations/org1.example.com/peers/Org1_peer_0.org1.example.com/tls/server.crt
88+
clientKey:
89+
file: /Users/lew/go/src/github.com/hyperledger/fabric-private-chaincode/samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/crypto/peerOrganizations/org1.example.com/peers/Org1_peer_0.org1.example.com/tls/server.key
90+
rootcert:
91+
file: /Users/lew/go/src/github.com/hyperledger/fabric-private-chaincode/samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/crypto/peerOrganizations/org1.example.com/peers/Org1_peer_0.org1.example.com/tls/ca.crt
92+
clientRootCAs:
93+
files:
94+
- /Users/lew/go/src/github.com/hyperledger/fabric-private-chaincode/samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/crypto/peerOrganizations/org1.example.com/peers/Org1_peer_0.org1.example.com/tls/ca.crt
95+
authentication:
96+
timewindow: 15m
97+
fileSystemPath: filesystem
98+
BCCSP:
99+
Default: SW
100+
SW:
101+
Hash: SHA2
102+
Security: 256
103+
FileKeyStore:
104+
KeyStore:
105+
mspConfigPath: /Users/lew/go/src/github.com/hyperledger/fabric-private-chaincode/samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/crypto/peerOrganizations/org1.example.com/peers/Org1_peer_0.org1.example.com/msp
106+
localMspId: Org1MSP
107+
deliveryclient:
108+
reconnectTotalTimeThreshold: 3600s
109+
localMspType: bccsp
110+
profile:
111+
enabled: false
112+
listenAddress: 127.0.0.1:0
113+
handlers:
114+
authFilters:
115+
- name: DefaultAuth
116+
- name: ExpirationCheck
117+
decorators:
118+
- name: DefaultDecorator
119+
endorsers:
120+
escc:
121+
name: DefaultEndorsement
122+
validators:
123+
vscc:
124+
name: DefaultValidation
125+
126+
127+
128+
validatorPoolSize:
129+
discovery:
130+
enabled: true
131+
authCacheEnabled: true
132+
authCacheMaxSize: 1000
133+
authCachePurgeRetentionRatio: 0.75
134+
orgMembersAllowedAccess: false
135+
limits:
136+
concurrency:
137+
qscc: 500
138+
139+
vm:
140+
endpoint: unix:///var/run/docker.sock
141+
docker:
142+
tls:
143+
enabled: false
144+
ca:
145+
file: docker/ca.crt
146+
cert:
147+
file: docker/tls.crt
148+
key:
149+
file: docker/tls.key
150+
attachStdout: true
151+
hostConfig:
152+
NetworkMode: host
153+
LogConfig:
154+
Type: json-file
155+
Config:
156+
max-size: "50m"
157+
max-file: "5"
158+
Memory: 2147483648
159+
160+
chaincode:
161+
builder: $(DOCKER_NS)/fabric-ccenv:$(PROJECT_VERSION)
162+
pull: false
163+
golang:
164+
runtime: $(DOCKER_NS)/fabric-baseos:$(PROJECT_VERSION)
165+
dynamicLink: false
166+
car:
167+
runtime: $(DOCKER_NS)/fabric-baseos:$(PROJECT_VERSION)
168+
java:
169+
runtime: $(DOCKER_NS)/fabric-javaenv:latest
170+
node:
171+
runtime: $(DOCKER_NS)/fabric-nodeenv:latest
172+
installTimeout: 1200s
173+
startuptimeout: 1200s
174+
executetimeout: 1200s
175+
mode: net
176+
keepalive: 0
177+
system:
178+
_lifecycle: enable
179+
cscc: enable
180+
lscc: enable
181+
qscc: enable
182+
logging:
183+
level: debug
184+
shim: debug
185+
format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'
186+
externalBuilders:
187+
- path: /Users/lew/go/src/github.com/hyperledger/fabric-private-chaincode/samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/fpc/externalbuilders/chaincode_server
188+
name: fpc-external-launcher
189+
propagateEnvironment:
190+
- CORE_PEER_ID
191+
- FABRIC_LOGGING_SPEC
192+
193+
ledger:
194+
blockchain:
195+
state:
196+
stateDatabase: goleveldb
197+
couchDBConfig:
198+
couchDBAddress: 127.0.0.1:5984
199+
username:
200+
password:
201+
maxRetries: 3
202+
maxRetriesOnStartup: 10
203+
requestTimeout: 35s
204+
queryLimit: 10000
205+
maxBatchUpdateSize: 1000
206+
warmIndexesAfterNBlocks: 1
207+
history:
208+
enableHistoryDatabase: true
209+
210+
operations:
211+
listenAddress: 0.0.0.0:20008
212+
tls:
213+
enabled: false
214+
cert:
215+
file: /Users/lew/go/src/github.com/hyperledger/fabric-private-chaincode/samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/crypto/peerOrganizations/org1.example.com/peers/Org1_peer_0.org1.example.com/tls/server.crt
216+
key:
217+
file: /Users/lew/go/src/github.com/hyperledger/fabric-private-chaincode/samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/crypto/peerOrganizations/org1.example.com/peers/Org1_peer_0.org1.example.com/tls/server.key
218+
clientAuthRequired: false
219+
clientRootCAs:
220+
files:
221+
- /Users/lew/go/src/github.com/hyperledger/fabric-private-chaincode/samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/crypto/peerOrganizations/org1.example.com/peers/Org1_peer_0.org1.example.com/tls/ca.crt
222+
metrics:
223+
provider: prometheus
224+
statsd:
225+
network: udp
226+
address: 127.0.0.1:8125
227+
writeInterval: 5s
228+
prefix: org1_org1_peer_0

tle_go/enclave.json

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@
66
"productID": 1,
77
"securityVersion": 1,
88
"mounts": [
9-
{
10-
"source": "/project/src/github.com/hyperledger/fabric/sampleconfig/",
11-
"target": "/project/src/github.com/hyperledger/fabric/sampleconfig/",
12-
"type": "hostfs"
13-
},
149
{
1510
"source": "/project/",
1611
"target": "/project/",
1712
"type": "hostfs"
1813
},
1914
{
20-
"source": "/project/src/github.com/hyperledger/fabric-private-chaincode/tle_go/tmpBlocks",
21-
"target": "tmpBlocks",
15+
"source": "/usr/local/bin",
16+
"target": "/usr/local/bin",
2217
"type": "hostfs"
2318
},
2419
{
@@ -46,15 +41,15 @@
4641
"fromHost": true
4742
},
4843
{
49-
"name": "GO_ENV_GOPATH",
44+
"name": "CORE_CONFIG_PATH",
5045
"fromHost": true
5146
},
5247
{
53-
"name": "GO_ENV_GOMOD",
48+
"name": "DEV_PATH",
5449
"fromHost": true
5550
},
5651
{
57-
"name": "FPC_PATH",
52+
"name": "BLOCK_PATH",
5853
"fromHost": true
5954
}
6055
]

tle_go/main.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,28 @@ import (
88
"github.com/hyperledger/fabric-private-chaincode/tle_go/tlecore"
99
)
1010

11-
func main() {
12-
fmt.Println("--- in TLE_go main.go start to create grpc server.---")
13-
tlestate := &tlecore.Tlestate{}
11+
func readConfig() {
1412
// read config
13+
var configPath string
1514
fpcPath := os.Getenv("FPC_PATH")
16-
configPath := filepath.Join(fpcPath, "samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/peers/Org1.Org1_peer_0/core.yaml")
17-
// configPath := "/Users/lew/go/src/github.com/hyperledger/fabric-private-chaincode/samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/peers/Org1.Org1_peer_0/core.yaml"
15+
// if fpc_path exist, which mean it is running in local machine, else it is running in docker.
16+
if fpcPath != "" {
17+
configPath = filepath.Join(fpcPath, "samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/peers/Org1.Org1_peer_0/core.yaml")
18+
} else {
19+
configPath = os.Getenv("CORE_CONFIG_PATH")
20+
}
1821
tlecore.SetupConfig(configPath)
22+
}
23+
24+
func main() {
25+
fmt.Println("--- in TLE_go main.go start to create grpc server.---")
26+
readConfig()
27+
28+
tlestate := &tlecore.Tlestate{}
1929

2030
// serve block listener.
2131
go tlecore.ServePeer(tlestate)
2232

2333
// serve metadata service.
24-
tlecore.ServeMeta("127.0.0.1:50051", tlestate)
34+
tlecore.ServeMeta("0.0.0.0:50051", tlestate)
2535
}

0 commit comments

Comments
 (0)