Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions configFiles/chaincode_install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
claimName: shared-pvc
containers:
- name: chaincodeinstall1
image: hyperledger/fabric-tools:1.2.1
image: hyperledger/fabric-tools:1.4
imagePullPolicy: Always
command: ["sh", "-c", "echo $GOPATH; cp -r /shared/artifacts/chaincode $GOPATH/src/; ls $GOPATH/src; peer chaincode install -n ${CHAINCODE_NAME} -v ${CHAINCODE_VERSION} -p chaincode_example02/"]
env:
Expand All @@ -39,7 +39,7 @@ spec:
name: sharedvolume

- name: chaincodeinstall2
image: hyperledger/fabric-tools:1.2.1
image: hyperledger/fabric-tools:1.4
imagePullPolicy: Always
command: ["sh", "-c", "echo $GOPATH; cp -r /shared/artifacts/chaincode $GOPATH/src/; ls $GOPATH/src; peer chaincode install -n ${CHAINCODE_NAME} -v ${CHAINCODE_VERSION} -p chaincode_example02/"]
env:
Expand All @@ -62,7 +62,7 @@ spec:
name: sharedvolume

- name: chaincodeinstall3
image: hyperledger/fabric-tools:1.2.1
image: hyperledger/fabric-tools:1.4
imagePullPolicy: Always
command: ["sh", "-c", "echo $GOPATH; cp -r /shared/artifacts/chaincode $GOPATH/src/; ls $GOPATH/src; peer chaincode install -n ${CHAINCODE_NAME} -v ${CHAINCODE_VERSION} -p chaincode_example02/"]
env:
Expand All @@ -85,7 +85,7 @@ spec:
name: sharedvolume

- name: chaincodeinstall4
image: hyperledger/fabric-tools:1.2.1
image: hyperledger/fabric-tools:1.4
imagePullPolicy: Always
command: ["sh", "-c", "echo $GOPATH; cp -r /shared/artifacts/chaincode $GOPATH/src/; ls $GOPATH/src; peer chaincode install -n ${CHAINCODE_NAME} -v ${CHAINCODE_VERSION} -p chaincode_example02/"]
env:
Expand Down
2 changes: 1 addition & 1 deletion configFiles/chaincode_instantiate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:

containers:
- name: chaincodeinstantiate
image: hyperledger/fabric-tools:1.2.1
image: hyperledger/fabric-tools:1.4
imagePullPolicy: Always
command: ["sh", "-c", "peer chaincode instantiate -o blockchain-orderer:31010 -C ${CHANNEL_NAME} -n ${CHAINCODE_NAME} -v ${CHAINCODE_VERSION} -c '{\"Args\":[\"init\",\"a\",\"100\",\"b\",\"200\"]}'"]
env:
Expand Down
51 changes: 51 additions & 0 deletions configFiles/createVolume-azure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: system:azure-cloud-provider
rules:
- apiGroups: ['']
resources: ['secrets']
verbs: ['get','create']

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: system:azure-cloud-provider
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: system:azure-cloud-provider
subjects:
- kind: ServiceAccount
name: persistent-volume-binder
namespace: kube-system

---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: azurefile
provisioner: kubernetes.io/azure-file
mountOptions:
- dir_mode=0777
- file_mode=0777
- uid=1000
- gid=1000
parameters:
skuName: Standard_LRS
storageAccount: bcfabricstorage

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: shared-pvc
spec:
accessModes:
- ReadWriteMany
storageClassName: azurefile
resources:
requests:
storage: 5Gi
19 changes: 0 additions & 19 deletions configFiles/createVolume.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
---
kind: PersistentVolume
apiVersion: v1
metadata:
name: shared-pv
labels:
type: local
name: sharedvolume
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/tmp"

---
kind: PersistentVolumeClaim
apiVersion: v1
Expand All @@ -26,6 +10,3 @@ spec:
requests:
storage: 1Gi
storageClassName: ""
selector:
matchLabels:
name: sharedvolume
4 changes: 2 additions & 2 deletions configFiles/create_channel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
claimName: shared-pvc
containers:
- name: createchanneltx
image: hyperledger/fabric-tools:1.2.1
image: hyperledger/fabric-tools:1.4
imagePullPolicy: Always
command: ["sh", "-c", "cd /shared && pwd && ls && export FABRIC_CFG_PATH=$PWD && configtxgen -profile FourOrgsChannel -outputCreateChannelTx ${CHANNEL_NAME}.tx -channelID ${CHANNEL_NAME} && touch /shared/status_channeltx_complete "]
env:
Expand All @@ -29,7 +29,7 @@ spec:
name: sharedvolume

- name: createchannel
image: hyperledger/fabric-peer:1.2.1
image: hyperledger/fabric-peer:1.4
imagePullPolicy: Always
command: ["sh", "-c", "while [ ! -f /shared/status_channeltx_complete ]; do echo Waiting for channeltx; sleep 2; done; peer channel create -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f /shared/${CHANNEL_NAME}.tx && rm /shared/status_channeltx_complete && touch /shared/status_channelcreate_complete"]
env:
Expand Down
4 changes: 2 additions & 2 deletions configFiles/generateArtifactsJob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ spec:
path: /var/run/docker.sock
containers:
- name: cryptogen
image: hyperledger/fabric-tools:1.2.1
image: hyperledger/fabric-tools:1.4
imagePullPolicy: Always
command: ["sh", "-c", "echo 'Cryptogen Starts'; ls -l /shared/artifacts; while [ ! -d /shared/artifacts ]; do echo Waiting for configFiles; sleep 1; done; cryptogen generate --config /shared/artifacts/crypto-config.yaml && cp -r crypto-config /shared/ && for file in $(find /shared/ -iname *_sk); do echo $file; dir=$(dirname $file); echo ${dir}; mv ${dir}/*_sk ${dir}/key.pem; done && find /shared -type d | xargs chmod a+rx && find /shared -type f | xargs chmod a+r && touch /shared/status_cryptogen_complete;"]
volumeMounts:
- mountPath: /shared
name: sharedvolume
- name: configtxgen
image: hyperledger/fabric-tools:1.2.1
image: hyperledger/fabric-tools:1.4
imagePullPolicy: Always
command: ["sh", "-c", "echo 'Configtxgen Starts'; ls -l /shared; sleep 1 && while [ ! -f /shared/status_cryptogen_complete ]; do echo Waiting for cryptogen; sleep 1; done; cp /shared/artifacts/configtx.yaml /shared/; cd /shared/; export FABRIC_CFG_PATH=$PWD; configtxgen -profile FourOrgsOrdererGenesis -outputBlock genesis.block && find /shared -type d | xargs chmod a+rx && find /shared -type f | xargs chmod a+r && touch /shared/status_configtxgen_complete && rm /shared/status_cryptogen_complete;"]
volumeMounts:
Expand Down
8 changes: 4 additions & 4 deletions configFiles/join_channel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
claimName: shared-pvc
containers:
- name: joinchannel1
image: hyperledger/fabric-peer:1.2.1
image: hyperledger/fabric-peer:1.4
imagePullPolicy: Always
command: ["sh", "-c", "peer channel fetch newest -o ${ORDERER_URL} -c ${CHANNEL_NAME} && peer channel join -b ${CHANNEL_NAME}_newest.block "]
env:
Expand Down Expand Up @@ -45,7 +45,7 @@ spec:
name: sharedvolume

- name: joinchannel2
image: hyperledger/fabric-peer:1.2.1
image: hyperledger/fabric-peer:1.4
imagePullPolicy: Always
command: ["sh", "-c", "peer channel fetch newest -o ${ORDERER_URL} -c ${CHANNEL_NAME} && peer channel join -b ${CHANNEL_NAME}_newest.block "]
env:
Expand Down Expand Up @@ -74,7 +74,7 @@ spec:
name: sharedvolume

- name: joinchannel3
image: hyperledger/fabric-peer:1.2.1
image: hyperledger/fabric-peer:1.4
imagePullPolicy: Always
command: ["sh", "-c", "peer channel fetch newest -o ${ORDERER_URL} -c ${CHANNEL_NAME} && peer channel join -b ${CHANNEL_NAME}_newest.block "]
env:
Expand Down Expand Up @@ -103,7 +103,7 @@ spec:
name: sharedvolume

- name: joinchannel4
image: hyperledger/fabric-peer:1.2.1
image: hyperledger/fabric-peer:1.4
imagePullPolicy: Always
command: ["sh", "-c", "peer channel fetch newest -o ${ORDERER_URL} -c ${CHANNEL_NAME} && peer channel join -b ${CHANNEL_NAME}_newest.block "]
env:
Expand Down
12 changes: 6 additions & 6 deletions configFiles/peersDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:

containers:
- name: orderer
image: hyperledger/fabric-orderer:1.2.1
image: hyperledger/fabric-orderer:1.4
command: ["sh", "-c", "sleep 5 && while [ ! -f /shared/status_configtxgen_complete ]; do echo Waiting for configtxgen; sleep 1; done; orderer"]
env:
- name: ORDERER_CFG_PATH
Expand Down Expand Up @@ -77,7 +77,7 @@ spec:

containers:
- name: ca
image: hyperledger/fabric-ca:1.2.1
image: hyperledger/fabric-ca:1.4
command: ["sh", "-c", "sleep 1 && while [ ! -f /shared/status_configtxgen_complete ]; do echo Waiting for configtxgen; sleep 1; done; fabric-ca-server start -b admin:adminpw -d"]
env:
- name: FABRIC_CA_SERVER_CA_NAME
Expand Down Expand Up @@ -122,7 +122,7 @@ spec:

containers:
- name: org1peer1
image: hyperledger/fabric-peer:1.2.1
image: hyperledger/fabric-peer:1.4
command: ["sh", "-c", "sleep 1 && while [ ! -f /shared/status_configtxgen_complete ]; do echo Waiting for configtxgen; sleep 1; done; peer node start"]
env:
- name: CORE_PEER_ADDRESSAUTODETECT
Expand Down Expand Up @@ -208,7 +208,7 @@ spec:

containers:
- name: org2peer1
image: hyperledger/fabric-peer:1.2.1
image: hyperledger/fabric-peer:1.4
command: ["sh", "-c", "sleep 1 && while [ ! -f /shared/status_configtxgen_complete ]; do echo Waiting for configtxgen; sleep 1; done; peer node start"]
env:
- name: CORE_PEER_ADDRESSAUTODETECT
Expand Down Expand Up @@ -295,7 +295,7 @@ spec:

containers:
- name: org3peer1
image: hyperledger/fabric-peer:1.2.1
image: hyperledger/fabric-peer:1.4
command: ["sh", "-c", "sleep 1 && while [ ! -f /shared/status_configtxgen_complete ]; do echo Waiting for configtxgen; sleep 1; done; peer node start"]
env:
- name: CORE_PEER_ADDRESSAUTODETECT
Expand Down Expand Up @@ -382,7 +382,7 @@ spec:

containers:
- name: org4peer1
image: hyperledger/fabric-peer:1.2.1
image: hyperledger/fabric-peer:1.4
command: ["sh", "-c", "sleep 1 && while [ ! -f /shared/status_configtxgen_complete ]; do echo Waiting for configtxgen; sleep 1; done; peer node start"]
env:
- name: CORE_PEER_ADDRESSAUTODETECT
Expand Down
13 changes: 10 additions & 3 deletions setup_blockchainNetwork.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@ if [ "$(kubectl get pvc | grep shared-pvc | awk '{print $2}')" != "Bound" ]; the
kubectl create -f ${KUBECONFIG_FOLDER}/createVolume-paid.yaml
sleep 5
else
echo "Running: kubectl create -f ${KUBECONFIG_FOLDER}/createVolume.yaml"
kubectl create -f ${KUBECONFIG_FOLDER}/createVolume.yaml
sleep 5
if [ "$1" == "--azure" ]; then
echo "You passed argument --azure. Make sure you have an Azure Kubernetes Cluster. Else, remove --azure option"
echo "Running: kubectl create -f ${KUBECONFIG_FOLDER}/createVolume-azure.yaml"
kubectl create -f ${KUBECONFIG_FOLDER}/createVolume-azure.yaml
sleep 5
else
echo "Running: kubectl create -f ${KUBECONFIG_FOLDER}/createVolume.yaml"
kubectl create -f ${KUBECONFIG_FOLDER}/createVolume.yaml
sleep 5
fi
fi

if [ "kubectl get pvc | grep shared-pvc | awk '{print $3}'" != "shared-pv" ]; then
Expand Down