Hyperledger Fabric(v1.1.0)编译时遇到的问题
Hyperledger Fabric(v1.1.0)编译时遇到的问题
0. 编译过程的坑
编译时,按照如下顺序编译
- make release,编译源码生成二进制文件
- make docker,生成一系列的docker镜像
第一步没什么问题,第二部时会遇到一些问题,比如:
go get
不能获取golang.org包的问题- docker中ubuntu官方镜像源不能访问或者太慢问题
1. go get不能获取golang.org包
在编译过程中,生成docker镜像时需要go相关的工具,github上的可以正常,但是golang.org的包由于墙的原因不能获取。尝试过设置全局代理、设置git代理,不过试了半天都没成功。
我的解决方法是:
- 首先在github上获取包的源码
- 然后只编译gotools,
make gotools
- 将生成的可执行文件复制到
fabric/build/docker/gotools/bin
目录下
在fabric/gotools/Makefile文件中,可以看到编译时需要的golang依赖包。
go.fqp.govendor := github.com/kardianos/govendor
go.fqp.golint := golang.org/x/lint/golint
go.fqp.goimports := golang.org/x/tools/cmd/goimports
go.fqp.ginkgo := github.com/onsi/ginkgo/ginkgo
go.fqp.gocov := github.com/axw/gocov/...
go.fqp.misspell := github.com/client9/misspell/cmd/misspell
go.fqp.gocov-xml:= github.com/AlekSi/gocov-xml
go.fqp.manifest-tool := github.com/estesp/manifest-tool
1.1 github上获取包的源码
在目录fabric/build/gopath/src
下分别建立两个目录github.com
和golang.org
。
进入golang.org
目录获取包源码
mkdir x && cd x
git clone https://github.com/golang/tools.git
git clone https://github.com/golang/lint.git
进入github.com
目录获取包源码
git clone https://github.com/kardianos/govendor.git
git clone https://github.com/onsi/ginkgo.git
git clone https://github.com/axw/gocov.git
git clone https://github.com/client9/misspell.git
git clone https://github.com/AlekSi/gocov-xml.git
git clone https://github.com/estesp/manifest-tool.git
1.2 编译gotools并复制可执行文件
make gotools
编译go的工具。然后将将生成的可执行文件复制到fabric/build/docker/gotools/bin
目录下。
2. docker官方镜像源修改
解决完上一个问题后,会卡在生成testenv的docker地方,原因是原有docker中的ubuntu镜像源是Ubuntu官方的,速度很慢或者根本不能访问,直接替换为阿里云的镜像源就好了。
首先定位生成docker的目录位置,是在fabric/build/testenv/
目录下。该目录下的Dockerfile文件描述了该docker要做的东西。我们需要在这个文件中修改镜像源。
在文件中加入这三行:
# add by gexin, change the sources.list
COPY payload/sources.list /etc/apt/
RUN sudo apt-get update
修改后的文件内容如下:
# Copyright Greg Haskins All Rights Reserved
#
# SPDX-License-Identifier: Apache-2.0
#
FROM hyperledger/fabric-buildenv:x86_64-1.1.1-snapshot-feed00ad6
# fabric configuration locations
ENV FABRIC_CFG_PATH /etc/hyperledger/fabric
# add by gexin, change the sources.list
COPY payload/sources.list /etc/apt/
RUN sudo apt-get update
# create needed directories
RUN mkdir -p \
$FABRIC_CFG_PATH \
/var/hyperledger/production
# fabric configuration files
ADD payload/sampleconfig.tar.bz2 $FABRIC_CFG_PATH
# fabric binaries
COPY payload/orderer /usr/local/bin
COPY payload/peer /usr/local/bin
# softhsm2
COPY payload/install-softhsm2.sh /tmp
RUN bash /tmp/install-softhsm2.sh && rm -f install-softhsm2.sh
# typically, this is mapped to a developer's dev environment
WORKDIR /opt/gopath/src/github.com/hyperledger/fabric
LABEL org.hyperledger.fabric.version=1.1.1-snapshot-feed00ad6 \
org.hyperledger.fabric.base.version=0.4.6
加入的三行就是我们用 自己的sources.list文件替换原有的文件。需要注意的是,这时我们还没有需要替换的文件呢。
在payload目录下,新建一个sources.list文件,在文件内容为阿里云的镜像源,如下所示:
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
总结
先是golang包的问题折腾了一下午,解决之后又遇到了镜像源的问题。
对golang以及docker的理解还不深入,需要继续在解决问题的过程中提高多这两个部分的认知。
Hyperledger Fabric(v1.1.0)编译时遇到的问题的更多相关文章
- Hyperledger Fabric(v1.2.0)代码分析1——channel创建
Hyperledger Fabric(v1.2.0)代码分析1--channel创建 0. e2e_cli Hyperledger Fabric提供了一个e2e的例子,该例中创建了一个基础的区块链网络 ...
- 使用docker加载已有镜像安装Hyperledger Fabric v1.1.0
背景 每次在新的服务器上安装Hyperledger Fabric网络时,通过fabric官方提供的脚本安装时,需要从网络上down下近10G的fabric相关镜像,这个过程是漫长及痛苦的,有时因网络问 ...
- Hyperledger Fabric v1.1.0安装记录(国内源版)
1. 安装虚拟机 虚拟机软件采用:VirtualBox 操作系统选择:Ubuntu 14.04 内存:4G CPU:2核 硬盘:20G 2.(可选)更改 ...
- 阿里云容器服务区块链解决方案全新升级 支持Hyperledger Fabric v1.1
摘要: 全球开源区块链领域影响最为广泛的Hyperledger Fabric日前宣布了1.1版本的正式发布,带来了一系列丰富的新功能以及在安全性.性能与扩展性等方面的显著提升.阿里云容器服务区块链解决 ...
- 三、主流区块链技术特点及Hyperledger Fabric V1.0版本特点
一.Hyperledger fabric V1.0 架构 1.逻辑架构: 2.区块链网络 3.运行时架构 二.架构总结 1.架构要点 分拆Peer的功能,将Blockchain的数据维护和共识服务进行 ...
- 安装hyperledger fabric V1.0.1
安装文档位置: https://github.com/hyperledger/fabric fabric代码托管地址 https://hyperledger-fabric.readthedoc ...
- 安装hyperledger fabric V1.0.0-beta
安装文档位置: https://github.com/hyperledger/fabric fabric代码托管地址 https://hyperledger-fabric.readthedoc ...
- Ubuntu下搭建Hyperledger Fabric v1.0环境
多次尝试才正常启动了Fabric,如遇到各种莫名错误,请参考如下一步步严格安装,特别用户权限需要注意. 一.安装Ubuntu16 虚拟机或双系统,虚拟机有VirtualBox或者VMware,Ub ...
- 003-主流区块链技术特点及Hyperledger Fabric V1.0版本特点
一.Hyperledger fabric V1.0 架构 1.逻辑架构: 2.区块链网络 3.运行时架构 二.架构总结 1.架构要点 分拆Peer的功能,将Blockchain的数据维护和共识服务进行 ...
随机推荐
- macaca自动化初体验
1.安装#cnpm i -g macaca-cli macaca-ios# Install Tools And Driver2.检查安装环境#macaca doctor ANT_HOME未设置,下载 ...
- ubuntu16.04中安装下载工具uget+aria2并配置chrome (stable版)
1.安装uGut sudo apt-get install uget 2.安装aria2 sudo apt-get install arias 3.配置uGet默认下载插件为aria2 菜单栏依次打开 ...
- mongodb的学习-3-在Mac上的安装配置
1.使用homebrew安装: brew install mongodb 查看安装好的版本: mongo --version MongoDB shell version v3.6.4 git vers ...
- kaggle _Titanic: Machine Learning from Disaster
A Data Science Framework: To Achieve 99% Accuracy https://www.kaggle.com/ldfreeman3/a-data-science-f ...
- Kafka设计解析(六)Kafka高性能架构之道
转载自 技术世界,原文链接 Kafka设计解析(六)- Kafka高性能架构之道 本文从宏观架构层面和微观实现层面分析了Kafka如何实现高性能.包含Kafka如何利用Partition实现并行处理和 ...
- Spring事务(三)事务增强器
摘要: 本文结合<Spring源码深度解析>来分析Spring 5.0.6版本的源代码.若有描述错误之处,欢迎指正. 目录 一.创建事务 1. 获取事务 2. 处理已经存在的事务 3. 准 ...
- Eclipse开发工具常用快捷键的使用技巧
Eclipse作为软件开发的常用工具,被很多的人所欢迎,尤其是丰富的快捷键,可以极大的提高编码的效率,下面将常用的快捷键做了整理,便于大家学习和使用. Eclipse常用快捷键 1代码提示 Alt ...
- 跨域(Cross-Domain) AJAX for IE8 and IE9
1.有过这样一段代码,是ajax $.ajax({ url: "http://127.0.0.1:9001", type: "POST", data: JSON ...
- 让你的:active好好工作
在某些版本的safari上,:active伪类不生效,可以通过css和js两种方式hack一下: html <div class="button"> 点击时我应该变红 ...
- @ModelAttribute三个作用:
@ModelAttribute具有如下三个作用: ①绑定请求参数到命令对象:放在功能处理方法的入参上时,用于将多个请求参数绑定到一个命令对象,从而简化绑定流程,而且自动暴露为模型数据用于视图页面展示时 ...