Fabric Docker Images

- Pull the fabric docker images locally
- Push these to the local registry
- Adjust yaml files to pull image from the local registry
- If the fabric version is amd64-latest pull from the Fabric dev repo

Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
This commit is contained in:
Matthew B White 2021-10-26 15:34:56 +01:00
parent 0ea5e7762b
commit 813dc31ae2
18 changed files with 50 additions and 31 deletions

View file

@ -20,7 +20,7 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-tools:{{FABRIC_VERSION}} image: localhost:5000/fabric-tools:kind
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
env: env:
- name: FABRIC_CFG_PATH - name: FABRIC_CFG_PATH

View file

@ -20,7 +20,7 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-ca:1.5.2 image: localhost:5000/fabric-ca:kind
env: env:
- name: FABRIC_CA_SERVER_CA_NAME - name: FABRIC_CA_SERVER_CA_NAME
value: "org0-ecert-ca" value: "org0-ecert-ca"

View file

@ -43,8 +43,8 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-orderer:{{FABRIC_VERSION}} image: localhost:5000/fabric-orderer:kind
imagePullPolicy: IfNotPresent imagePullPolicy: Always
envFrom: envFrom:
- configMapRef: - configMapRef:
name: org0-orderer1-env name: org0-orderer1-env

View file

@ -43,8 +43,8 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-orderer:{{FABRIC_VERSION}} image: localhost:5000/fabric-orderer:kind
imagePullPolicy: IfNotPresent imagePullPolicy: Always
envFrom: envFrom:
- configMapRef: - configMapRef:
name: org0-orderer2-env name: org0-orderer2-env

View file

@ -43,8 +43,8 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-orderer:{{FABRIC_VERSION}} image: localhost:5000/fabric-orderer:kind
imagePullPolicy: IfNotPresent imagePullPolicy: Always
envFrom: envFrom:
- configMapRef: - configMapRef:
name: org0-orderer3-env name: org0-orderer3-env

View file

@ -20,7 +20,7 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-ca:1.5.2 image: localhost:5000/fabric-ca:kind
env: env:
- name: FABRIC_CA_SERVER_CA_NAME - name: FABRIC_CA_SERVER_CA_NAME
value: "org0-tls-ca" value: "org0-tls-ca"

View file

@ -20,7 +20,7 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-tools:{{FABRIC_VERSION}} image: localhost:5000/fabric-tools:kind
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
env: env:
- name: FABRIC_CFG_PATH - name: FABRIC_CFG_PATH

View file

@ -20,7 +20,7 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-ca:1.5.2 image: localhost:5000/fabric-ca:kind
env: env:
- name: FABRIC_CA_SERVER_CA_NAME - name: FABRIC_CA_SERVER_CA_NAME
value: "org1-ecert-ca" value: "org1-ecert-ca"

View file

@ -46,7 +46,7 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-peer:{{FABRIC_VERSION}} image: localhost:5000/fabric-peer:kind
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
envFrom: envFrom:
- configMapRef: - configMapRef:

View file

@ -46,7 +46,7 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-peer:{{FABRIC_VERSION}} image: localhost:5000/fabric-peer:kind
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
envFrom: envFrom:
- configMapRef: - configMapRef:

View file

@ -20,7 +20,7 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-ca:1.5.2 image: localhost:5000/fabric-ca:kind
env: env:
- name: FABRIC_CA_SERVER_CA_NAME - name: FABRIC_CA_SERVER_CA_NAME
value: "org1-tls-ca" value: "org1-tls-ca"

View file

@ -20,7 +20,7 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-tools:{{FABRIC_VERSION}} image: localhost:5000/fabric-tools:kind
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
env: env:
- name: FABRIC_CFG_PATH - name: FABRIC_CFG_PATH

View file

@ -20,7 +20,7 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-ca:1.5.2 image: localhost:5000/fabric-ca:kind
env: env:
- name: FABRIC_CA_SERVER_CA_NAME - name: FABRIC_CA_SERVER_CA_NAME
value: "org2-ecert-ca" value: "org2-ecert-ca"

View file

@ -46,7 +46,7 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-peer:{{FABRIC_VERSION}} image: localhost:5000/fabric-peer:kind
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
envFrom: envFrom:
- configMapRef: - configMapRef:

View file

@ -46,7 +46,7 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-peer:{{FABRIC_VERSION}} image: localhost:5000/fabric-peer:kind
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
envFrom: envFrom:
- configMapRef: - configMapRef:

View file

@ -20,7 +20,7 @@ spec:
spec: spec:
containers: containers:
- name: main - name: main
image: hyperledger/fabric-ca:1.5.2 image: localhost:5000/fabric-ca:kind
env: env:
- name: FABRIC_CA_SERVER_CA_NAME - name: FABRIC_CA_SERVER_CA_NAME
value: "org2-tls-ca" value: "org2-tls-ca"

View file

@ -5,16 +5,6 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
function pull_docker_images() {
push_fn "Pulling docker images for Fabric ${FABRIC_VERSION}"
docker pull hyperledger/fabric-ca:$FABRIC_CA_VERSION
docker pull hyperledger/fabric-orderer:$FABRIC_VERSION
docker pull hyperledger/fabric-peer:$FABRIC_VERSION
docker pull hyperledger/fabric-tools:$FABRIC_VERSION
pop_fn
}
function apply_nginx_ingress() { function apply_nginx_ingress() {
push_fn "Launching Nginx ingress controller" push_fn "Launching Nginx ingress controller"
@ -80,7 +70,7 @@ function launch_docker_registry() {
running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)" running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)"
if [ "${running}" != 'true' ]; then if [ "${running}" != 'true' ]; then
docker run \ docker run \
-d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \ -d --restart=always --rm -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \
registry:2 registry:2
fi fi
@ -123,7 +113,6 @@ function kind_init() {
# todo: how to pass this through to push_fn ? # todo: how to pass this through to push_fn ?
set -o errexit set -o errexit
pull_docker_images
kind_create kind_create
apply_nginx_ingress apply_nginx_ingress
launch_docker_registry launch_docker_registry

View file

@ -7,6 +7,33 @@
# todo: oof this is rough. # todo: oof this is rough.
function pull_docker_images() {
local registry
push_fn "Pulling docker images for Fabric ${FABRIC_VERSION}"
if [ "${FABRIC_VERSION}" = "amd64-latest" ]; then
FABRIC_CA_VERSION=${FABRIC_VERSION}
registry=hyperledger-fabric.jfrog.io
else
registry=hyperledger
fi
for image in peer orderer tools; do
local fullname=$registry/fabric-${image}:$FABRIC_VERSION
docker pull ${fullname}
docker tag ${fullname} "localhost:5000/fabric-${image}:kind"
docker push "localhost:5000/fabric-${image}:kind"
done
local cafullname=$registry/fabric-ca:$FABRIC_CA_VERSION
docker pull ${cafullname}
docker tag ${cafullname} "localhost:5000/fabric-ca:kind"
docker push "localhost:5000/fabric-ca:kind"
pop_fn
}
function launch() { function launch() {
local yaml=$1 local yaml=$1
@ -205,6 +232,9 @@ function create_local_MSP() {
function network_up() { function network_up() {
# get the fabric docker images pushed to the local repository
pull_docker_images
# Kube config # Kube config
init_namespace init_namespace
init_storage_volumes init_storage_volumes