<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Neo Motsumi on Medium]]></title>
        <description><![CDATA[Stories by Neo Motsumi on Medium]]></description>
        <link>https://medium.com/@neo12motsumi?source=rss-dfd633805e22------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mGUWMQqRa6wn7x8QfXo8Eg.jpeg</url>
            <title>Stories by Neo Motsumi on Medium</title>
            <link>https://medium.com/@neo12motsumi?source=rss-dfd633805e22------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 16:53:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@neo12motsumi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Declarative Container Images: Full Visibility, Simplified, Security, Mult-Arch]]></title>
            <link>https://medium.com/@neo12motsumi/declarative-container-images-full-visibility-simplified-security-mult-arch-738a89d179f4?source=rss-dfd633805e22------2</link>
            <guid isPermaLink="false">https://medium.com/p/738a89d179f4</guid>
            <category><![CDATA[hyperledger-fabric]]></category>
            <category><![CDATA[chainguard]]></category>
            <category><![CDATA[apk-packages]]></category>
            <category><![CDATA[container-security]]></category>
            <category><![CDATA[containers]]></category>
            <dc:creator><![CDATA[Neo Motsumi]]></dc:creator>
            <pubDate>Thu, 12 Dec 2024 21:34:54 GMT</pubDate>
            <atom:updated>2024-12-13T08:07:05.785Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>The purpose of this article is to explore alternative methods to Dockerfiles and Buildpacks for building containers. These alternatives aim to simplify the process, reduce container image size, minimize the attack surface, and provide greater transparency into the container’s contents.</p><h3><strong>What exactly are we building?</strong></h3><blockquote>In this article, I will guide you through the process of creating minimal, declarative, and easily implementable container images. To illustrate this process, I’ve chosen to use Hyperledger Fabric images as a practical example. This approach demonstrates how to build small, secure, and reproducible multi-architecture container images.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYtbPhvViLwP04Y3iTnYPQ.png" /></figure><h3>Overview</h3><p>To keep this simple yet informative, we’ll use only one Hyperledger Fabric image to demonstrate our goal. Please note that this is not intended to replace official Hyperledger Fabric images but to encourage the building of more secure containers, especially for enterprise blockchain networks using the declarative approach.</p><h3>References</h3><p>The work on this project primarily leveraged <a href="https://www.chainguard.dev/">Chainguard</a> open-source tools. Here are the links to the resources that contributed to writing this article and building the project:</p><ul><li><strong>melange:</strong> <a href="https://github.com/chainguard-dev/melange">melange</a> is an <a href="https://wiki.alpinelinux.org/wiki/Package_management">apk</a> builder tool that uses declarative pipelines to create apk packages. It is part of the open-source tooling used for <a href="https://edu.chainguard.dev/open-source/wolfi">Wolfi</a>, which is the operating system used to power <a href="https://edu.chainguard.dev/chainguard/chainguard-images">Chainguard Images</a>.</li><li><strong>apko</strong>: <a href="http://github.com/chainguard-dev/apko">apko</a> is a command-line tool designed to create single-layer container images based on the <a href="https://wiki.alpinelinux.org/wiki/Package_management">apk</a> package format. It was so named as it uses the apk package format and is inspired by the <a href="https://github.com/google/ko">ko</a> build tool.</li></ul><h3>Our Approach</h3><p>The adoption of enterprise blockchain solutions, including Corda, Hyperledger Fabric, Besu, and many others, is growing daily. As these technologies emerge, it’s crucial to understand the components within the container images we provide to consumers.</p><p>A Software Bill of Materials (SBOM) and reproducible multi-architecture builds are essential for ensuring security and consistency in the delivered product.</p><h3>Enough Philosophy lets Dive Into it!!</h3><p>This demonstration is based on this <a href="https://github.com/Nimbostack/blockstax-containers">open-source project</a>. I hope it will one day inspire the initiative to declaratively build container images for other open-source enterprise blockchain projects.</p><p>First, we will create an APK package for our Hyperledger Fabric peer node using Melange. Melange allows us to create APK packages using declarative pipelines. For a detailed definition of a Melange manifest, <a href="https://github.com/Nimbostack/blockstax-containers/blob/main/hyperledger-fabric/peer/melange.yaml"><strong>please refer to this link</strong></a>.</p><p>First will create a <strong><em>melange.yaml</em></strong> file with the following content:</p><pre>package:<br>  name: hyperledger-fabric-peer<br>  version: 3.0.0<br>  epoch: 0<br>  description: A package for a Hyperledger Fabric Peer<br>  target-architecture: [x86_64, aarch64]<br>  copyright:<br>    - license: Apache-2.0<br><br>environment:<br>  environment:<br>    GOMODCACHE: &#39;/var/cache/melange&#39;<br>  contents:<br>    keyring:<br>      - https://packages.wolfi.dev/os/wolfi-signing.rsa.pub<br>    repositories:<br>      - https://packages.wolfi.dev/os<br>    packages:<br>      - wolfi-base<br>      - ca-certificates-bundle<br>      - go<br><br>vars:<br>  bindir: /build/bin/peer<br>  fabriccfg: /etc/hyperledger/fabric<br>  repourl: https://github.com/hyperledger/fabric<br><br>pipeline:<br>  - uses: git-checkout<br>    with:<br>      repository: ${{vars.repourl}}<br>      tag: v${{package.version}}<br><br>  - runs: |<br>      COMMIT_SHA=$(git rev-parse HEAD)<br>      echo &quot;$COMMIT_SHA&quot; &gt; ${{targets.destdir}}/commit_sha.txt<br><br>  - runs: |<br>      mkdir -p ${{targets.destdir}}${{vars.fabriccfg}}/msp \<br>               ${{targets.destdir}}${{vars.bindir}} \<br>               ${{targets.destdir}}/var/hyperledger/production \<br>               ${{targets.destdir}}/release/${{build.arch}}/builders/ccaas/bin/ \<br>               ${{targets.destdir}}/opt/hyperledger/ccaas_builder/bin \<br>               ${{targets.destdir}}/usr/local/bin<br><br>  - runs: |<br>      cd ccaas_builder<br>      go build -buildvcs=false \<br>        -o ${{targets.destdir}}/release/${{build.arch}}/builders/ccaas/bin/ ./cmd/release/<br><br>  - runs: |<br>      set -ex<br>      export GOBIN=${{targets.destdir}}${{vars.bindir}}<br>      CGO_CFLAGS=&quot; &quot; go install -tags &quot;&quot; -ldflags &quot;\<br>        -X github.com/hyperledger/fabric/common/metadata.Version=${{package.version}} \<br>        -X github.com/hyperledger/fabric/common/metadata.CommitSHA=$(cat ${{targets.destdir}}/commit_sha.txt) \<br>        -X github.com/hyperledger/fabric/common/metadata.BaseDockerLabel=org.hyperledger.fabric \<br>        -X github.com/hyperledger/fabric/common/metadata.DockerNamespace=hyperledger \<br>        -X github.com/hyperledger/fabric/common/metadata.BaseDockerNamespace=hyperledger&quot; \<br>        -buildvcs=false github.com/hyperledger/fabric/cmd/peer<br><br>  - runs: |<br>      cp -r sampleconfig/msp &quot;${{targets.destdir}}${{vars.fabriccfg}}/&quot;<br>      cp sampleconfig/core.yaml &quot;${{targets.destdir}}${{vars.fabriccfg}}/core.yaml&quot;<br>      cp -r ${{targets.destdir}}${{vars.bindir}}/peer ${{targets.destdir}}/usr/local/bin/<br>      cp -r ${{targets.destdir}}/release/${{build.arch}}/builders/ccaas/bin ${{targets.destdir}}/opt/hyperledger/ccaas_builder/<br><br>  - uses: strip</pre><p>The above manifest does the following:</p><ul><li>Creates a package named hyperledger-fabric-peer targeting the amd64 and aarch64 architectures (compatible with your Arm CPUs).</li><li>Declares an environment with all necessary dependencies and packages.</li><li>Checkout the Hyperledger Fabric GitHub repository, fetch the commit SHA corresponding to the specified release tag. Build the binary and copy required default configurations into the Hyperledger Fabric directories.</li></ul><p>Before we can build our package, we need to create a key-pair to sign our package by running this command:</p><pre>melange keygen</pre><p>After all of this has been defined and you have streamlined your pipelines, we need to build our APK package.</p><pre>melange build melange.yaml --signing-key signing-key.rsa</pre><p>Running the command above will create a packages directory containing APK packages compatible with amd64 and aarch64 architectures. The image below illustrates this process using <a href="https://github.com/hyperledger/fabric">Hyperledger Fabric GitHub</a> repository tag<strong> 2.5.0</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*aRBh2dk_o4JvTXC_mjVrcg.png" /></figure><h3>We are not done yet, What&#39;s Next!?</h3><p>Now that we have created our APK package, we can start building our container image using Apko.</p><p>Apko allows us to build OCI-compliant images while enabling us to import our APK packages.</p><p>We will now create an <strong><em>apko.yaml</em></strong> manifest, more examples on how to use apko can be found <a href="https://github.com/chainguard-dev/apko/tree/main/examples"><strong>here</strong></a>:</p><pre>contents:<br>  keyring:<br>    - https://packages.wolfi.dev/os/wolfi-signing.rsa.pub<br>    - ../../melange.rsa.pub<br>  repositories:<br>    - https://packages.wolfi.dev/os<br>    - &#39;@local packages&#39;<br>  packages:<br>    - wolfi-base<br>    - ca-certificates-bundle<br>    - hyperledger-fabric-peer@local<br><br>archs:<br>  - x86_64<br>  - aarch64<br><br>paths:<br>  - path: /etc/hyperledger<br>    type: directory<br>    permissions: 0755<br>    uid: 65532<br>  - path: /var/hyperledger<br>    type: directory<br>    permissions: 0755<br>    uid: 65532<br>  - path: /var/hyperledger/production<br>    type: directory<br>    permissions: 0755<br>    uid: 65532<br><br>accounts:<br>  groups:<br>    - groupname: hyperledger<br>      gid: 65532<br>  users:<br>    - username: hyperledger<br>      uid: 65532<br>  run-as: hyperledger<br><br>environment:<br>  FABRIC_CFG_PATH: /etc/hyperledger/fabric<br>  FABRIC_VER: 2.5.0<br>  PATH: /usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin:/opt/hyperledger/ccaas_builder/bin<br><br>annotations:<br>  org.opencontainers.image.authors: Nimbostack<br>  org.opencontainers.image.title: &quot;hyperledger-fabric-peer&quot;<br>  org.opencontainers.image.base.name: &quot;wolfi&quot;<br>  org.opencontainers.image.description: &quot;Hyperledger Fabric Peer application packaged by Nimbostack&quot;<br>  org.opencontainers.image.licenses: &quot;Apache-2.0&quot;<br>  org.opencontainers.image.vendor: &quot;Nimbostack&quot;<br>  org.opencontainers.image.version: &quot;2.5.0&quot;<br>  org.opencontainers.image.source: &quot;github.com/Nimbostack/blockstax-containers/tree/main/hyperledger-fabric/peer&quot;<br>  org.opencontainers.image.documentation: &quot;github.com/Nimbostack/blockstax-containers/tree/main/hyperledger-fabric/peer/README.md&quot;<br>  org.opencontainers.image.ref.name: hyperledger-fabric-peer<br>  org.hyperledger.fabric.version: &quot;2.5.0&quot;<br><br><br>entrypoint:<br>  command: peer node start</pre><p>Here is what we are doing on this manifest:</p><ul><li><strong>Importing Keys:</strong> Importing the Wolfi keys as part of our certificate bundle.</li><li><strong>Multi-Arch&#39;s:</strong> Specifying the same target architectures as we specified in our Melange pipeline.</li><li><strong>Adding Package Key:</strong> Adding the Melange package key generated earlier.</li><li><strong>Adding Repository:</strong> Adding a repository using our local path to import the built package.</li><li><strong>Installing Package:</strong> Instructing Apko to install the imported APK package as part of the image.</li><li><strong>Setting Permissions:</strong> Setting permissions for all Hyperledger Fabric directories and binding a user to run the container.</li><li><strong>Adding Annotations:</strong> Using annotations to provide metadata about the built image.</li><li><strong>Defining Entrypoint:</strong> Defining the entrypoint for our container image.</li></ul><p>Now that we’ve assembled all the components, the final step is to build and push our container image. A single command will publish two images, one for amd64 and one for aarch64 architectures.</p><p>Finally, we can publish:</p><pre>apko publish apko.yaml \<br>        --keyring-append ../../melange.rsa.pub --arch x86_64,aarch64 \<br>        --sbom=false \<br>        --repository-append packages docker.io/nimbostack/hyperledger-fabric-peer:2.5.0</pre><blockquote>Please note that I have set <strong>sbom=false</strong>, but if you would prefer to also publish your sbom you can easily just set it to true.</blockquote><p>The following <a href="https://hub.docker.com/r/nimbostack/hyperledger-fabric-peer/tags"><strong>Docker images</strong></a> were published as part of this demonstration, aiming to standardize declarative container images.</p><p>The screenshot below showcases the multiple architectures published for the 2.5.0 container image tag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nCcGmEP_9Q9M62JoEk9ERg.png" /></figure><h3>That’s It!!</h3><p>I hope this article has shed some light on how easy it is to use Apko and Melange to create declarative pipelines, while understanding exactly what goes into your container. I also encourage you to compare the image sizes of your traditionally built container images to those built using this approach. One more thing to note is that these builds are not as black-boxed as Buildpacks.</p><blockquote>More collaboration and suggestions are welcome on the GitHub repo. Hopefully, we can add more pipelines for other enterprise blockchain images.<br><a href="https://github.com/Nimbostack/blockstax-containers/tree/main">https://github.com/Nimbostack/blockstax-containers</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=738a89d179f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hyperledger Fabric PoC on Kubernetes (Tip of the Iceberg) — ThinkTank]]></title>
            <link>https://medium.com/@neo12motsumi/hyperledger-fabric-poc-on-kubernetes-tip-of-the-iceberg-thinktank-100d57df369?source=rss-dfd633805e22------2</link>
            <guid isPermaLink="false">https://medium.com/p/100d57df369</guid>
            <category><![CDATA[proof-of-concept]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[south-africa]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[hyperledger-fabric]]></category>
            <dc:creator><![CDATA[Neo Motsumi]]></dc:creator>
            <pubDate>Sun, 20 Sep 2020 21:51:35 GMT</pubDate>
            <atom:updated>2021-05-04T16:35:33.087Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>This article assumes you are already familiar with Kubernetes, AKS/EKS/GKE and basics of Hyperledger fabric.</blockquote><h3>Introduction:</h3><p>The purpose of writing this article is to outlay all the foreign concepts of building a read-to-go <a href="https://www.hyperledger.org/">Hyperledger</a> fabric PoC. Learning about a new technology or framework while being given a small time-frame to develop a proof-of-concept for the customer can be a headache, <strong>“trust me I know !!”</strong>; especially if its a paradigm shift from one technological concept to the other.</p><p><strong>NB: This article is solely based on the experience of Hyperlegder Fabric 1.4.</strong></p><h3><strong>So what are we building ?</strong></h3><blockquote>In this article I will be discussing how to build a Hyperledger fabric Network PoC on a Kubernetes Service; The idea is to share a conceptual <strong>(hence ThinkTank)</strong>, yet practical implementation of a fully fledged and operational network.</blockquote><h3><strong>Overview:</strong></h3><p>To keep this simple yet informative, two organisations will be used for the purpose of demonstrating a truly decentralised block-chain network. Please keep in mind that for educational purposes we will be using one Kubernetes cluster with separate namespaces.</p><p>The conceptual scenario will be one that focuses on two solicitors(law firms); the idea is to create an environment where all parties can share records through a distributed network, while providing security.</p><h3>Material</h3><p>To understand some of the basic concepts; I suggest you head over to Hyperledger fabric documentation, here are some links I found useful:</p><p><a href="https://hyperledger-fabric.readthedocs.io/en/release-1.4/blockchain.html"><strong>Brief Hyperledger Fabric Introduction</strong></a></p><p><a href="https://hyperledger-fabric.readthedocs.io/en/release-1.4/membership/membership.html"><strong>Hyperledger Fabric Membership Service Provider(MSP)</strong></a></p><p><a href="https://hyperledger-fabric.readthedocs.io/en/release-1.4/orderer/ordering_service.html"><strong>Hyperledger Fabric Ordering Service</strong></a></p><p><a href="https://hyperledger-fabric.readthedocs.io/en/release-1.4/orderer/ordering_service.html#ordering-service-implementations"><strong>Ordering Services </strong></a><strong>Consensus: </strong>For the purpose of this article we will be using Apache Kafka as our broker.</p><p><a href="https://hyperledger-fabric.readthedocs.io/en/release-1.4/peers/peers.html"><strong>Hyperledger Fabric Peer</strong></a></p><h3><strong>Overview</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LRW8ZYkqnzOs47Ud7ANDmg.png" /></figure><p>The <a href="https://www.hyperledger.org/">Hyperledger</a> fabric network will consist of the following, each of the resource groups will be separated through the use of Kubernetes namespaces:</p><ul><li>3 replicas of Apache Kafka Statefulsets</li><li>2 Ordering Services</li><li>Certificate Authority for managing all the the nodes Authentication and credential generation.</li><li>3 Peer Nodes Per Organisation(Each with its corresponding database)</li><li>A CouchDB wallet database, for storing organisation user wallet credentials.</li><li>Kubernetes Secrets, this will assist with saving all the generated crypto-materials.</li></ul><h3><strong>Useful Resources</strong></h3><p>Here is a list of the resources which might help with your cluster cluster setup:</p><p><a href="https://letsencrypt.org/"><strong>Let’s Encrypt</strong></a><strong> : </strong>A free, automated, and open certificate authority.</p><p><a href="https://hub.helm.sh/charts/jetstack/cert-manager"><strong>Cert Manger</strong></a><strong>: </strong>Kubernetes addon which automates the management and issuance of TLS certificates from Let’s Encrypt.</p><p><a href="https://docs.cert-manager.io/en/release-0.11/reference/clusterissuers.html"><strong>Cluster Issuer</strong></a><strong>: </strong>For demonstration purposes you may use either a production/staging issuer.</p><p><a href="https://hub.helm.sh/charts/stable/hlf-ord"><strong>Hyperledger Fabric Orderer (Chart version 1.2.6):</strong></a> The node type responsible for “consensus” for the <a href="https://www.hyperledger.org/">Hyperledger</a> Fabric permissioned blockchain framework.</p><p><a href="https://hub.helm.sh/charts/stable/hlf-ca"><strong>Hyperledger Fabric CA:</strong></a><strong> </strong>Certificate Authority node for the <a href="https://www.hyperledger.org/">Hyperledger</a> Fabric permissioned blockchain framework.</p><p><a href="https://hub.helm.sh/charts/stable/hlf-peer"><strong>Hyperledger Fabric Peer:</strong></a> The node type responsible for endorsing transactions and recording them on the Blockchain for the <a href="https://www.hyperledger.org/">Hyperledger</a> Fabric permissioned blockchain framework.</p><h3>Thought Process</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4FL84c7b9KdFO_RrTgUHuA.png" /></figure><p>Before you can start with the actual cluster deployments of network components, you first need to plan your consortium; To achieve this you need to make use of a configuration called configtx.yaml.</p><p>The configtx.yaml contains sections which cover the definition of organisation identities, Consortium Definitions(Channels and Initial Genesis Definition), Ordering Service endpoints (including the definition of the broker being used for consensus, in our instance this would be Kafka).</p><p>A sample definition of how the configtx.yaml looks:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3adb08cb72a088024554c76ed3334abb/href">https://medium.com/media/3adb08cb72a088024554c76ed3334abb/href</a></iframe><p>Make sure you note down your <a href="https://hyperledger-fabric.readthedocs.io/en/release-1.4/peers/peers.html">Peer</a> host &amp; <a href="https://hyperledger-fabric.readthedocs.io/en/release-1.4/orderer/ordering_service.html">Orderer</a> endpoints(the namespaces on the host address). Now that you have defined your Consortium and Organisation Identities; we can move on to creating the Kubernetes resources.</p><p>For the sake of keeping this article short and straight to the point, we will use the above mentioned helm charts to provision all the cluster resources.</p><blockquote>NB: This article does not cover the deep cluster specifications such as Storage, Network Policies and Any Service Orchestration Mechanisms including the definition of Load Balancers.</blockquote><h3><strong>Certificate Authority(CA)</strong></h3><p>As described on the Hyperledger fabric documentation, the Certificate Authority node enables for the registration of identities, the issuance of all the certificates which will be used by the organisation and ordering nodes administrators.</p><p><strong>What does this even mean ?</strong></p><blockquote>A straight-forward answer would be, the certificate authority controls <strong>Who can access the permissioned network/What kind of operations are they allowed to perform on the network(Are they organisation Administrators ? Can they add a new Organisation Peer ? Are they allowed to add more Ordering Nodes?)</strong></blockquote><p>Before creating an instance of a CA; a database is required to store all the identities (Available options are Postgres, MySQL, LDAP) But this article is focusing on Postgres.</p><p>A <a href="https://github.com/cetic/helm-postgresql">Postgres Helm Chart</a> which will help setup a StatefulSet with Replicas<strong>.</strong></p><p>Deploy the CA by running the below command:</p><pre>helm install stable/hlf-ca --name [ca-name]-f ./values.yaml</pre><p>* values.yaml being the file which contains chart parameters. Make sure make the relevant database endpoint changes; By making use of the External Database config.</p><pre>externalDatabase:</pre><pre>     type: postgres</pre><pre>     host: postgres</pre><pre>     username: fabric_ca</pre><pre>     password: fabric_ca</pre><pre>     database: fabric_ca</pre><pre>     port: 5432</pre><h3><strong>Now We Are Ready To Start Registering Those Identities</strong></h3><p>In order to create identities, I used the CA Pod Instance for both the enrolment process. To achieve this you can manually copy the pod or write a jsonpath query selector like below:</p><pre>CA_POD=$(kubectl get pods --namespace [ca-namespace] -l &quot;app=[app-label]&quot; -o jsonpath=&quot;{.items[0].metadata.name}&quot;)</pre><p>To create all the administrators for Orderers and Peers I used the fabric client, register command. To get more information with regards to registering users you can find it <a href="https://hyperledger-fabric-ca.readthedocs.io/en/release-1.4/users-guide.html">here</a>.</p><p>Please note I am invoking the command by remotely executing it on the CA POD.</p><pre>kubectl exec $CA_POD -- fabric-ca-client register --id.name [username] --id.secret  [Password]  --id.attrs &#39;admin=true:ecert&#39;</pre><p>After the registration you can now enrol the user and output their crypto-materials to a local folder(Note your output path, as you gonna need it when saving the secrets.)</p><pre>fabric-ca-client enroll -u [ca-endpoint-with-user-logins] ./[output-folder]</pre><p>Although the registration process is the same when creating orderer and peer credentials, the only difference is that you can specify the id type for the credential.</p><pre>--id.type orderer<br>OR<br>--id.type peer</pre><p>Now that you have registered and enrolled all the credentials, you can now start saving the crypto materials for later user, when provisioning the cluster components.</p><p>You can achieve this through the use of the kubectl command to create a secret, note the from-file attributes which allows you to create a secret from crypto materials.</p><pre>kubectl create secret generic [secret-name] --from-file=cert.pem=[path-to-cert-or-keystore]</pre><blockquote>Please note that secrets also need to be created for the genesis.block and the channel configuration.</blockquote><h3>Let’s start creating all those Deployments</h3><p>In order to install the <a href="https://hub.helm.sh/charts/stable/hlf-ord">Orderer Helm Chart</a> you are going to have to provide the following fields inside your values.yaml</p><blockquote>NB: Install your <a href="https://hyperledger-fabric.readthedocs.io/en/release-2.0/kafka.html?highlight=kafka)">Apache Kafka Stateful Set</a>.</blockquote><pre>secrets:</pre><pre> ord:</pre><pre>   cert: [orderer-1-certificate-secret]</pre><pre>   key:[orderer-1-key-secret]</pre><pre>   caCert: [orderer-ca-certificate-secret]</pre><pre>   genesis: [genesis-block-secret]</pre><pre>   adminCert: [orderer-admin-cert-secret]</pre><h3>Last but not least (Peer Nodes)</h3><p>Now that the crypto materials have been saved, consensus broker and ordering services have been created we can Install the peer nodes using the created secrets, orderer endpoints and the endpoints to their respective couch-db endpoints.</p><p>Below you can find the configuration for supplying the crypto materials, when installing the <a href="https://hub.helm.sh/charts/stable/hlf-peer">Peer Helm Chart</a>.</p><pre>secrets:</pre><pre>  peer:</pre><pre>   cert: [peer-1-cert-secret]</pre><pre>   key: [peer-1-key-secret]</pre><pre>   caCert: [ca-cert-secret]</pre><pre> channel: [channel-secret]</pre><pre> adminCert:  [orderer-admin-cert-secret]</pre><pre> adminKey: [orderer-admin-key-secret]</pre><h3><strong>That’s it!!</strong></h3><h4><strong>I really hope this article has shed some light around creating a working PoC on a Kubernetes environment. And Thank You for reading this article.</strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=100d57df369" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CouchDB + Logstash on Kubernetes/ Docker]]></title>
            <link>https://medium.com/@neo12motsumi/couchdb-logstash-on-kubernetes-docker-b8a8aa19eece?source=rss-dfd633805e22------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8a8aa19eece</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[logstash]]></category>
            <category><![CDATA[kuber]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <dc:creator><![CDATA[Neo Motsumi]]></dc:creator>
            <pubDate>Tue, 29 Oct 2019 17:16:03 GMT</pubDate>
            <atom:updated>2020-05-19T06:56:06.080Z</atom:updated>
            <content:encoded><![CDATA[<h3>CouchDB + Logstash on Kubernetes/Docker</h3><h3>Introduction:</h3><p>As both a frontend and backend developer I have realised that building dashboards for an application can be very challenging; especially the query segment of your application. Using different databases means you have write optimised queries for your search and also cater for issue like “nolock” in SQL, indexes in CouchDB …</p><h3>Scenario:</h3><p>At my current work; I had to write a POC using hyperledger fabric. Now this was very easy to setup initially on my local dev environment. I was using selector queries, which was working perfectly.</p><p><strong>Then it all started getting complicated!</strong></p><p>All the queries I wrote didn&#39;t work on my kubernetes environment; <strong>why is that, you may ask?</strong></p><ol><li>CouchDB strongly recommends that you create Indexes to optimise your queries.</li></ol><p><a href="https://docs.couchdb.org/en/2.3.1/api/database/find.html#db-index">https://docs.couchdb.org/en/2.3.1/api/database/find.html#db-index</a></p><p>2. Our JSON schema wasn’t very flat. This was a requirement from the office above.</p><p>3. Because the model isn’t flat I had to create multiple index to retrieve data in small chunks.</p><p>4. Hyperledger Fabric has a great emphasis on<em> “ creating off-chain database that replicates the data from your blockchain network”</em>.</p><p><a href="https://hyperledger-fabric.readthedocs.io/en/release-1.4/couchdb_as_state_database.html">https://hyperledger-fabric.readthedocs.io/en/release-1.4/couchdb_as_state_database.html</a></p><h3>Solution:</h3><figure><img alt="Couchdb Integration with elastic search" src="https://cdn-images-1.medium.com/max/1024/1*p0hhOHLAG1ij7FxXH-YDpw.jpeg" /></figure><h3>Tools:</h3><p><strong>Logstash</strong>: <a href="https://www.elastic.co/guide/en/logstash/current/introduction.html">An open source data collection engine.</a></p><p><strong>Elastic Search: </strong><a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.4/elasticsearch-intro.html">Distributed search analytics engine.</a></p><p><strong>Kibana Dashboard:</strong> Used this to visualise my index data logged; <a href="https://www.elastic.co/products/kibana">more info</a>.</p><p><strong>Couchdb_changes: </strong><a href="https://www.elastic.co/guide/en/logstash/current/plugins-inputs-couchdb_changes.html">logstash input plugin.</a></p><h4>Helm Charts</h4><p><strong>Elastic Search (7.4): </strong><a href="https://github.com/elastic/helm-charts/tree/master/elasticsearch">https://github.com/elastic/helm-charts/tree/master/elasticsearch</a></p><p><strong>Kibana (7.4):</strong> <a href="https://github.com/elastic/helm-charts/tree/master/kibana">https://github.com/elastic/helm-charts/tree/master/kibana</a></p><p><strong>Logstash (7.4): </strong><a href="https://github.com/helm/charts/tree/master/incubator">https://github.com/helm/charts/tree/master/incubator</a></p><h3>Implementation: The Good Stuff!!</h3><p>I have two CouchDB Pods for each peer node on the network.</p><p><strong>Setting up elastic search:</strong></p><ol><li><strong>Add the elastic search helm repository.</strong></li></ol><p>helm repo add elastic <a href="https://helm.elastic.co/">https://helm.elastic.co</a></p><p><strong>2. Install you elastic search on your cluster.</strong></p><p>helm install --name elasticsearch elastic/elasticsearch-f /path-to-elastic-search-values.yaml</p><p><a href="https://github.com/elastic/helm-charts/blob/master/elasticsearch/values.yaml">Elastic search default configuration you can use.</a></p><p><strong>Setting up Logstash to link CouchDB with your elastic search.</strong></p><p>Copy<a href="https://github.com/helm/charts/blob/master/stable/logstash/values.yaml"> Logstash default configuration.</a></p><p>On the inputs section of your config copy and paste this</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c3694f7e32d9ddc16796087733a7ca5f/href">https://medium.com/media/c3694f7e32d9ddc16796087733a7ca5f/href</a></iframe><p>Output</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc1ee454b7dd49619f6b78cede1f7282/href">https://medium.com/media/cc1ee454b7dd49619f6b78cede1f7282/href</a></iframe><p><strong>Last but not least(Kibana Dashboard):</strong></p><p>helm install — name kibana elastic/kibana -f ./path-to-your-kibana/kibana.yaml</p><p><a href="https://github.com/elastic/helm-charts/blob/master/kibana/values.yaml">Kibana default configuration.</a></p><p>You can find a curated list of all the all supported logstash input plugins <a href="https://www.elastic.co/guide/en/logstash/current/input-plugins.html">here</a>.</p><p><strong>What About Docker ?</strong></p><p>Create two files “logstash.conf” &amp; logstash.yaml</p><p><strong>logstash.conf</strong>: contains your input and output configs.</p><p><strong>logstash.yaml: </strong>Your logstash application startup config.</p><p>Create a Dockerfile:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a98d525b56d9c709ee2be0cda91b029/href">https://medium.com/media/0a98d525b56d9c709ee2be0cda91b029/href</a></iframe><p>docker build .</p><p><strong>That’s All ! Now you can query both your databases from elastic search.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8a8aa19eece" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>