This repository was archived by the owner on Sep 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLabSetupScript
More file actions
executable file
·64 lines (48 loc) · 1.93 KB
/
LabSetupScript
File metadata and controls
executable file
·64 lines (48 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
echo "Installing Go Language"
sudo apt-get update
sudo apt-get install golang
sudo apt-get install libltdl-dev
WINUSER=$(powershell.exe -Command "get-childitem env:USERNAME " | grep USER | awk -e '{print $2}')
echo
echo "Adding GOPATH to your profile"
grep GOPATH $HOME/.profile || echo "export GOPATH=/mnt/c/Users/$WINUSER/Desktop" >> $HOME/.profile
echo
echo "Retrieving Hyperledger Code"
cd /mnt/c/Users/$WINUSER/Desktop
[ -d src/github.com/hyperledger ] || mkdir -p src/github.com/hyperledger
cd src/github.com/hyperledger
git clone https://github.com/hyperledger/fabric.git
cd fabric
git checkout tags/v1.0.3
echo
echo "Installing Hello smartcontract"
cd /mnt/c/Users/$WINUSER/Desktop/src/
[ -d hello ] || mkdir -p hello
cd hello
[ -f hello.go ] || wget http://raw.githubusercontent.com/jyg007/lab/master/hello.go
cd
echo
echo "Retrieving peer command"
PEER=$(kubectl get pods | grep org1peer1 | cut -f1 -d " ")
kubectl cp $PEER:/usr/local/bin/peer .
sudo mv peer /usr/local/bin
sudo chmod +x /usr/local/bin/peer
echo
echo "Retrieving Admin user certificates from Org1 peer1"
kubectl cp $PEER:/shared/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/ $HOME/msp
echo
echo "Setting up your blockchain environnement"
ORDERER=$(bx cs workers blockchain | awk '/kube/{ print $2}')
grep ORDERER $HOME/.profile || cat << EOF >> $HOME/.profile
export CORE_PEER_TLS_ENABLED=false
export ORDERER=$ORDERER:31010
export CORE_PEER_MSPCONFIGPATH=$HOME/msp/
export CORE_PEER_ADDRESS=$ORDERER:30110
export CORE_PEER_LOCALMSPID=Org1MSP
EOF
echo
echo "Creating invokator and monitoring"
kubectl get pods | grep -i invokator || kubectl create -f $HOME/lab/invokator.yaml
kubectl get services | grep -i invokator || kubectl create -f $HOME/lab/invokator-service.yaml
kubectl get pods | grep -i monitor || kubectl create -f $HOME/lab/monitor.yaml
kubectl get services | grep -i monitor || kubectl create -f $HOME/lab/monitoring-service.yaml