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:
containers:
- name: main
image: hyperledger/fabric-tools:{{FABRIC_VERSION}}
image: localhost:5000/fabric-tools:kind
imagePullPolicy: IfNotPresent
env:
- name: FABRIC_CFG_PATH

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,16 +5,6 @@
# 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() {
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)"
if [ "${running}" != 'true' ]; then
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
fi
@ -123,7 +113,6 @@ function kind_init() {
# todo: how to pass this through to push_fn ?
set -o errexit
pull_docker_images
kind_create
apply_nginx_ingress
launch_docker_registry

View file

@ -7,6 +7,33 @@
# 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() {
local yaml=$1
@ -205,6 +232,9 @@ function create_local_MSP() {
function network_up() {
# get the fabric docker images pushed to the local repository
pull_docker_images
# Kube config
init_namespace
init_storage_volumes