Package: nephos
NephosLibrary to deployHyperledger Fabricprojects toKubernetesSource resides athttps://github.com/hyperledger-labs/nephos, originally developed atAID:TechDocumentation resides athttps://nephos.readthedocs.ioPrerequisitesInstallationPipGit repositoryVirtual environmentRequirementsTestingUnit testsUsageExamplesDevelopmentQA and ProductionMinikubeFurther informationHelm chartsEducational materialContributing to NephosPrerequisitesThis library requires an existing Kubernetes cluster.For best results, use a real cluster (e.g. on a cloud like AWS, GCP, Azure, IBM Cloud, etc.). However, you may also useMinikube.Either way, you will need to have the following tools installed:python 3.7.0or abovekubectlhelmInstallationPipYou can install nephos fromPyPIby running:pip install nephosGit repositoryYou can also download the git repository with:git clone https://github.com/hyperledger-labs/nephos.gitAnd work locally by installing the following:Virtual environmentThis library currently only supports Python 3:python3 -m venv ./venv

source ./venv/bin/activateRequirementsAll python-related requirments are held in the requirements.txt filepip install -r requirements.txtYou will also need to install an initialisehelmfor Kubernetes, as describedhereFurthermore, you will need the Hyperledger Fabric utility binaries that can be installed with thisscripton Linux, or via Homebrew for theFabric toolsandCA toolson Mac OS X.TestingUnit testsOnce you have all requirments installed, all the unit tests should pass and provide full coverage:PYTHONPATH=. pytest --ignore=./integration --cov=. --cov-report xml:coverage.xml --cov-report term-missingThe integration tests should also pass:PYTHONPATH=. pytest -x -s ./integrationUsageTo usenephos, run thedeploy.pyexecutable CLI script.For instance, you can see available commands/options by running:PYTHONPATH=. ./nephos/deploy.py --helpTo install a full end-to-end fabric network, you can run:PYTHONPATH=. ./nephos/deploy.py -f ./PATH_TO_YOUR_SETTINGS/file.yaml fabricYou can also upgrade a network:PYTHONPATH=. ./nephos/deploy.py --upgrade -f ./PATH_TO_YOUR_SETTINGS/file.yaml fabricExamplesDevelopmentExample of development/QA/production(-ish) networks are provided in the examples folder.To run the dev example from the git repository, use this command:./nephos/deploy.py --verbose -f ./examples/dev/nephos_config.yaml fabricNote: Thenephos_config.yamlis by default set to point to theminikubecontext (even for theprodexample) to prevent accidental deployments to production clusters. If your K8S context name is different, please update this file.QA and ProductionFor the QA and production examples, you will need to replace the CA hostname to one pointing to your K8S cluster Ingress Controller  (e.g. NGINX or Traefik) IP address.In a real cluster, you will wish to install an ingress controller and a certificate manager. We include in the repository two example Cluster Issuers (you will need to modify the email field in them) for thecert-managerdeployment:helm install stable/nginx-ingress -n nginx-ingress --namespace ingress-controller

helm install stable/cert-manager -n cert-manager --namespace cert-manager

kubectl create -f ./examples/certManagerCI_staging.yaml

kubectl create -f ./examples/certManagerCI_production.yamlTo use the Composer examples, you will need a Cloud system capable of a "ReadWriteMany" policy (e.g. "azurefile" on Azure).MinikubeGiven that we may wish to test locally on Minikube, we will need to use a local ingress controller and ignore cert-manager in favour of self-cooked SSL certificates.In./exampleswe include theca-nephos-local.*self-signed certificates, created with OpenSSL as follows:openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -subj "/C=IE/ST=Dublin/L=Dublin/O=AID:Tech/CN=ca.nephos.local" -keyout ca-nephos-local.key -out ca-nephos-local.crt

openssl x509 -in ca-nephos-local.crt -out ca-nephos-local.pem -outform PEM

kubectl create ns cas

kubectl -n cas create secret tls ca--tls --cert=ca-nephos-local.crt --key=ca-nephos-local.keyWe can save them to thecasnamespace as followscd ./examples

kubectl create ns cas

kubectl -n cas create secret tls ca--tls --cert=ca-nephos-local.crt --key=ca-nephos-local.keyWe can then enable the ingress on minikube and update/etc/hostswith the IP ofminikube:minikube addons enable ingress

echo "$(minikube ip)  ca.nephos.local" | sudo tee -a /etc/hostsFurther informationFor more information on how to deploy Hyperledger Fabric to Kubernetes, please see the following resources:Helm chartsWe have released a set of Helm Charts, currently living in two locations:The official Helm ChartrepositoryandKubeApps.The AID:Tech Helm Chartrepository.Educational materialAworkshopon the Hyperledger Global Forum, featuringslidesand apart 1andpart 2videos.A(n older)webinaron deploying Hyperledger Fabric on Kubernetes.We have also contributed the Composer chapter on the EdX courseBlockchain for Business.And we have also released a course onPackt,UdemyandO’Reillycalled Hyperledger for Blockchain Applications.Contributing to NephosWe welcome all PRs, especially those addressing issues mentioned in the GitHub Project.To submit a PR, please make sure that:Fork the repository to your own GitHub account.All tests are passing, and there is 100% coverage on the unit tests.All new/changed functions should be correctly documented withdocstringsusing the Google format.Update the version number by editing the following files:setup.py(to updateVERSION) anddocs/conf.py(to update theversionandrelease)The documentation and pip package are auto-generated after approval and merging of the PR.