Hyperledger Fabric on Raspberry pi 3 - raspberry-pi

I'm trying to deploy hyperledger fabric on a raspberry pi, but it doesn't work. I'm searching for some tutorial but i didn't found it, there are someone that just did it?

Last time I've tried to run Hyperledger Fabric on RPi I've prepared following instructions:
Install latest RASPBIAN on SD card, you can download image from:
https://www.raspberrypi.org/downloads/raspbian/
Update and upgrade latest by running:
sudo apt-get update && sudo apt-get upgrade -y
Install required dependencies:
sudo apt-get install git curl gcc libc6-dev libltdl3-dev python-setuptools -y
Upgrade python pip installer:
sudo -H pip install pip --upgrade
Install docker and docker compose:
curl -sSL get.docker.com | shsudo usermod -aG docker pisudo pip install docker-compose
Logout/Login terminal session, so changes will take effect.
Install golang, by following instructions from: https://golang.org/doc/install
Create golang directory:
mkdir -p /home/pi/golang && mkdir -p /home/pi/golang/src/github/hyperledger/
Define environment variable
export GOPATH=/home/pi/golang
Make sure go binaries are in the path, e.g.:
export PATH=/usr/local/go/bin:$PATH
Clone fabric-baseimage repository into /home/pi/golang/src/github/hyperledger/
git clone https://github.com/hyperledger/fabric-baseimage.git
Clone client fabric repository into /home/pi/golang/src/github/hyperledger/
git clone https://github.com/hyperledger/fabric.git
Build based docker images
cd ~/golang/src/github/hyperledger/fabric-baseimage && make docker-local
Apply following patch to fabric code base:
--- a/peer/core.yaml
+++ b/peer/core.yaml
## -68,7 +68,6 ## peer:
# Gossip related configuration
gossip:
- bootstrap: 127.0.0.1:7051
# Use automatically chosen peer (high avalibility) to distribute blocks in channel or static one
# Setting this true and orgLeader true cause panic exit
useLeaderElection: false
## -280,7 +279,7 ## vm:
Config:
max-size: "50m"
max-file: "5"
- Memory: 2147483648
+ Memory: 16777216
AND
--- a/core/container/util/dockerutil.go
+++ b/core/container/util/dockerutil.go
## -45,6 +45,7 ## func NewDockerClient() (client *docker.Client, err error) {
// and GOARCH here.
var archRemap = map[string]string{
"amd64": "x86_64",
+ "arm": "armv7l",
}
func getArch() string {
Build Hyperledger peer and
cd ~/golang/src/github/hyperledger/fabric && make clean peer peer-docker
Peer executable binary will appear in:
~/golang/src/github/hyperledger/fabric/build/bin/

Related

Cloud Code for VisualStudio Code Errors on Cloud Code: Deploy

I've been trying to setup Cloud Code with VSCode and I've been running in to problems when starting the deploy process with Cloud Code: Deploy.
I've tried deploying the samples, python-hello-world-1 as well as the go-hello-world-1, to my kubernetes cluster on GKE but always end up getting errors when the deploy process starts package downloading:
Go Output
Running: skaffold run --enable-rpc -v info --rpc-http-port 49869 --filename skaffold.yaml --default-repo gcr.io/abx-lernende
starting gRPC server on port 50051
starting gRPC HTTP server on port 49869
Using kubectl context: gke_abx-lernende_europe-west4-a_joshu-test-cluster
Generating tags...
- go-hello-world -> gcr.io/abx-lernende/go-hello-world:latest
Checking cache...
- go-hello-world: Not found. Building
Building [go-hello-world]...
Sending build context to Docker daemon 57.86kB
Step 1/8 : FROM golang:1.13
---> 6586e3d10e96
Step 2/8 : RUN go get -u -v github.com/go-delve/delve/cmd/dlv
---> Running in b75ce8e5dae9
[91mgithub.com/go-delve/delve (download)
[0m[91m# cd .; git clone -- https://github.com/go-delve/delve /go/src/github.com/go-delve/delve
Cloning into '/go/src/github.com/go-delve/delve'...
fatal: unable to access 'https://github.com/go-delve/delve/': Failed to connect to github.com port 443: Connection refused
package github.com/go-delve/delve/cmd/dlv: exit status 128
[0mfailed to build: build failed: building [go-hello-world]: build artifact: unable to stream build output: The command '/bin/sh -c go get -u -v github.com/go-delve/delve/cmd/dlv' returned a non-zero code: 1
Exited with code 1.
Python Output
Running: skaffold run --enable-rpc -v info --rpc-http-port 50185 --filename
skaffold.yaml --default-repo gcr.io/abx-lernende
starting gRPC server on port 50051
starting gRPC HTTP server on port 50185
Skaffold &{Version:v1.3.1 ConfigVersion:skaffold/v2alpha3 GitVersion: GitCommit:6ba887a42438d1da578a005cf550e618fee6dfb8 GitTreeState:clean BuildDate:2020-01-31T19:55:18Z GoVersion:go1.13.4 Compiler:gc Platform:windows/amd64}
Using kubectl context: gke_abx-lernende_europe-west4-a_joshu-test-cluster
Generating tags...
- python-hello-world -> Tags generated in 0s
gcr.io/abx-lernende/python-hello-world:latest
Checking cache...
- python-hello-world: Cache check complete in 6.0001ms
Not found. Building
Building [python-hello-world]...
Sending build context to Docker daemon 4.608kB
Step 1/7 : FROM python:3.8
---> efdecc2e377a
Step 2/7 : WORKDIR /app
---> Using cache
---> a131b81cad66
Step 3/7 : COPY requirements.txt .
---> Using cache
---> 4625ef1862bd
Step 4/7 : RUN pip install --trusted-host pypi.python.org -r requirements.txt
---> Running in 4da23a158ae3
[91mWARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f17ba9c9d60>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/flask/
Im assuming this is due to me being behind a corporate proxy. As counter measures I have explicitly configured VSCode, Git, pip, go and google cloud sdk all to use said proxy. On top of that I set the Windows ENV variables for the proxy. sadly without success.
Thanks!
You can configure docker to pass through proxy information into the containers by adding something like the following to your ~/.docker/config.json:
{
"proxies": {
"default": {
"httpProxy": "http://192.168.1.12:3128",
"httpsProxy": "http://192.168.1.12:3128"
}
}
}
Docker will set the HTTP_PROXY/HTTPS_PROXY environment variables within the container which is picked up by many tools.

How to fix "returned a non-zero code: 7" when building docker image

I'm a newer to Docker, when i follow https://docs.confluent.io/current/installation/docker/development.html#create-a-docker-image-containing-local-connectors to build a Docker image with local connector, i got some issue.
below is my Dockerfile:
FROM confluentinc/cp-kafka-connect-base:5.3.0
COPY kafka-connect-solr-sink-0.0.1.zip /tmp/kafka-connect-solr-sink-0.0.1.zip
RUN confluent-hub install --no-prompt /tmp/kafka-connect-solr-sink-0.0.1.zip
when I run "docker build . -t my-custom-image:1.0.0", got below error:
Sending build context to Docker daemon 6.876MB Step 1/3 : FROM
confluentinc/cp-kafka-connect-base:5.3.0 ---> b1491496b48d Step 2/3 :
COPY kafka-connect-solr-sink-0.0.1.zip
/tmp/kafka-connect-solr-sink-0.0.1.zip ---> Using cache --->
85689e66c40a Step 3/3 : RUN confluent-hub install --no-prompt
/tmp/kafka-connect-solr-sink-0.0.1.zip ---> Running in 1d3486732517
Running in a "--no-prompt" mode Failed to unzip
'/tmp/kafka-connect-solr-sink-0.0.1.zip' into
'/tmp/confluent-hub-tmp7724578044817786588' String index out of range:
-1
Error: Unknown error The command '/bin/sh -c confluent-hub install
--no-prompt /tmp/kafka-connect-solr-sink-0.0.1.zip' returned a non-zero code: 7
Anyone can kindly help on this? Thanks.
From the Docker file ,Ensure you set the required proxy settings so that you do not get this error.
In Dockerfile....
ENV http_proxy <proxy_host>:
ENV https_proxy <proxy_host>:
After adding this before running other commands it

Devmode-engine-rust on Sawtooth running on Ubuntu 16.04

I want to install devmode-engine-rust on Sawtooth 1.0.5 running on Ubuntu 16.04. Standard installation using apt-get gives:
sawtooth-devmode-engine-rust :
Depends: libstdc++6 (>= 8.3.0) but 5.4.0-6ubuntu1~16.04.11 is to be installed
Depends: libnorm1 (>= 1.5r6+dfsg1) but it is not installable
Depends: libzmq5 (>= 4.2.5) but 4.1.4-7ubuntu0.1 is to be installed
Depends: libssl1.1 (>= 1.1.1) but it is not installable
Depends: libsodium23 (>= 1.0.16) but it is not installable
Depends: libc6 (>= 2.27) but 2.23-0ubuntu11 is to be installed
Depends: libgcc1 (>= 1:8.3.0) but 1:6.0.1-0ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages
Could not correct this one, so tried to compile from sources. Looks like compilation went OK. Now the question: what are correct directories where to copy compiled binaries and supporting files? Tried the simplest one - put devmode-engine-rust on the path, but that doesn't work.
Alternatively, if anybody knows how to solve the problem with
sudo apt-get install sawtooth-devmode-engine-rust
that would be great, too. Any suggestions on installing sawtooth-devmode-engine-rust are very welcome.
Thank you!
(I did find several stackoverflow articles on that, i.e. adding another depository and doing apt-get update, etc. None of them worked)
P.S. Here is what happens when I start different parts of sawtooth:
Window 1 - Validator:
$ sudo -u sawtooth sawtooth-validator -vv --scheduler parallel
[sudo] password for ahg2009:
[2019-08-04 11:41:31.052 INFO path] Loading path information from config: /etc/sawtooth/path.toml
[2019-08-04 11:41:31.058 INFO validator] Loading validator information from config: /etc/sawtooth/validator.toml
[2019-08-04 11:41:31.076 INFO path] Loading path information from config: /etc/sawtooth/path.toml
[2019-08-04 11:41:31.082 INFO keys] Loading signing key: /etc/sawtooth/keys/validator.priv
[2019-08-04 11:41:31.109 INFO cli] sawtooth-validator (Hyperledger Sawtooth) version 1.0.5
[2019-08-04 11:41:31.110 INFO cli] config [path]: config_dir = "/etc/sawtooth"; config [path]: key_dir = "/etc/sawtooth/keys"; config [path]: data_dir = "/var/lib/sawtooth"; config [path]: log_dir = "/var/log/sawtooth"; config [path]: policy_dir = "/etc/sawtooth/policy" .....etc. long output
Window 2
$ sudo -u sawtooth settings-tp -v
[sudo] password for ahg2009:
[2019-08-04 11:42:06.578 INFO core] register attempt: OK
Window 3.
$ sudo -u sawtooth /home/ahg2009/sawtooth-devmode-master/target/release/devmode-engine-rust -vvv --connect tcp://localhost:5050
TRACE | sawtooth_sdk::messag | Sending 37 bytes
{{After a while...}}
ERROR | devmode_engine_rust: | ReceiveError: TimeoutError
```
If I understand correctly, you are trying to run the consensus engine and connect to the validator. Use Sawtooth version >= 1.1. The 1.0.5 version has the consensus module running inside the validator, so you can't connect it from outside as a separate process. It will be running dev mode consensus by default.

How to install yum repository key with ansible?

I tried it two ways:
- name: Add repository
yum_repository:
# from https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
name: passenger
description: Passenger repository
baseurl: https://oss-binaries.phusionpassenger.com/yum/passenger/el/$releasever/$basearch
repo_gpgcheck: 1
gpgcheck: 0
enabled: 1
gpgkey: https://packagecloud.io/gpg.key
sslverify: 1
sslcacert: /etc/pki/tls/certs/ca-bundle.crt
- name: Add repository key (option 1)
rpm_key:
key: https://packagecloud.io/gpg.key
- name: Add repository key (option 2)
command: rpm --import https://packagecloud.io/gpg.key
- name: Install nginx with passenger
yum: name={{ item }}
with_items: [nginx, passenger]
But for it to work, I need to ssh to the machine, confirm importing the key (by running any yum command, e.g. yum list installed), and then continue provisioning. Is there a way to do it automatically?
UPD here's what ansible says:
TASK [nginx : Add repository key] **********************************************
changed: [default]
TASK [nginx : Install nginx with passenger] ************************************
failed: [default] (item=[u'nginx', u'passenger']) => {"failed": true, "item": ["nginx", "passenger"], "msg": "Failure talking
to yum: failure: repodata/repomd.xml from passenger: [Errno 256] No more mirrors to try.\nhttps://oss-binaries.phusionpassen
ger.com/yum/passenger/el/7/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml signature could not be verified for passenger"}
So, the key is indeed imported in both cases, but to be used it must be confirmed.
Fixed it by running yum directly with -y switch (and using rpm_key module, if anything):
- name: Install nginx with passenger
command: yum -y install {{ item }}
with_items: [nginx, passenger]
After adding the repository and the repository key, just update that repo's metadata with:
- name: update repo cache for the new repo
command: yum -q makecache -y --disablerepo=* --enablerepo=passenger
Then proceed with yum: name=... as before.

Can't install gitlab (in centos 6)

I try install gitlab-ce on CentOS 6.7(Final). but, failed.
My Environment
use proxy (set proxy in /etc/yum.conf)
my gitlab_gitlab-ce.repo file
(https://packages.gitlab.com/gitlab/gitlab-ce/install manual configuration)
[gitlab_gitlab-ce]
name=gitlab_gitlab-ce
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/6/$basearch
repo_gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
[gitlab_gitlab-ce-source]
name=gitlab_gitlab-ce-source
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/6/SRPMS
repo_gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
when excute install command, occur error
yum -q makecache -y --disablerepo='*' --enablerepo='gitlab_gitlab-ce'
https://packages.gitlab.com/gitlab/gitlab-ce/el/6/x86_64/repodata/repomd.xml: [Errno 14] Peer cert cannot be verified or peer cert invalid
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: gitlab_gitlab-ce. Please verify its path and try again
What should I do ? Help me please.
You first check Proxy setting of your system.
Fire below command:
yum update
if it wont work then set proxy in File: /etc/yum.conf
And then check.