Skip to content

Releases: doporg/Mictract-go-server

[2021-04-20] Version 0.6

20 Apr 14:09
Compare
Choose a tag to compare

Main Content

Add Prometheus for network monitor functions.

Commints

  • [36a04ad] release(v0.6): merge branch 'dev'
  • [24531ac] docs(README): add prometheus deployment
  • [c04520c] feat(k8s): add prometheus for network monitor

[2021-04-19] Version 0.5

19 Apr 02:44
Compare
Choose a tag to compare

Main Content

Add chaincode, chaincode transaction, and network detail information management functions.

Commits

  • [ae7e4d1] release(v0.5.0): merge branch 'dev'
  • [b4edd38] fix(API):delete transaction where id in ids
  • [fe977d7] integrate(model): rename some field in chaincode transaction model
  • [76c139a] fix(API): /api/transaction -> /api/transaction
  • [01495ec] fix:network.TlsEnabled = true
  • [c39c505] fix:Simplify chaincode address
  • [7dff395] add(API):Get a single resource
  • [1a7b1f4] add(API):GetNetwork ListUserInNetwork ListChannelInNetwork ListChaincodeInNetwork ListOrganizationInNetwork
  • [9de41bc] feat(transaction): CURD
  • [9e31036] add(API chaincode): add retry
  • [a03532f] fix(response organization): fix org.Peers ans org.Users
  • [4b92c4d] add(API chaincode):install approve commit start
  • [4efe4cc] fix:API listChannel
  • [bccfcbc] fix:The user id should be specified when calling the chaincode
  • [e7fa745] fix:stupid bug(I don't know why)
  • [e4ed9c7] fix:Solve the problem that the channel information is not updated when adding an organization to the channel
  • [2a672bd] integrate(model.resp): change some field name
  • [65ab399] fix:Solved the problem that the peer did not join the channel after creating a new channel due to a programming error in the coroutine function.
  • [ce0e7f2] fix:1.response.orderer response.peer 2. networkID to id and userID to ID
  • [fd3de9d] fix: add src/dao
  • [f8d9aec] chore()
  • [396756f] fix:Fixed the bug caused by refactoring. Basic functions passed a simple test
  • [b2350ea] fix:close sdk when delete network
  • [57440ed] refactor(almost all):Split code
  • [a32102d] refactor(almost all): network, channel, org, chaincode related functions have passed simple tests
  • [4052ddb] add(API peer orderer): list peer or orderer
  • [ceb457d] Merge branch 'dev' of https://github.com/doporg/Mictract-go-server into dev
  • [1bc90c5] fix(API user):add cert and privKey to response
  • [3023f28] fix(API block):fix req and resp
  • [7441eee] fix(api): change some field
  • [c26c41e] fix(k8s,config): set nfs-server and log level info
  • [0e8e116] fix(API listCC): add nickname
  • [bbd8259] fix(API:channel):list channel by network
  • [32e8b2b] refactor(user)
  • [ba2cd5e] add(network,org,channel):Add nickname attribute
  • [8df440f] Merge branch 'dev' of https://github.com/doporg/Mictract-go-server into dev
  • [bfd4a77] fix(network):Delete users in cascade when deleting a network

[2021-03-26] (hotfix) Version 0.4.2

26 Mar 15:50
Compare
Choose a tag to compare

Main Content

Changed the API request on POST /api/channel field 'orgs' into 'organizations'

Comments

  • [2322ece] hotfix(v0.4.2): merge branch 'dev'
  • [5bb8807] hotfix(api): change field 'orgs' into 'organizations'

[2021-03-22] (hotfix) Version 0.4.1

22 Mar 02:43
Compare
Choose a tag to compare

Main Content

Fixed informer callback multiple calls.

Comments

  • [7f0be45] hotfix(v0.4.1): merge branch 'dev'
  • [b09f05e] fix(model.kubernetes): a callback is called twice

[2021-03-22] Version 0.4

22 Mar 02:32
Compare
Choose a tag to compare

Main Content

Add channel, organization, and user management functions.

Notable Problems

1. 如何监控 Kubernetes 服务的状态?

监控服务状态是必要的特性,主要有两点原因:需求中提到每个 Fabric 网络都需要监控维护一个状态信息,它的取值是[ starting, running, stopped, error ]。而且在 Fabric 网络的创建过程中,存在创建的依赖关系,如 CA 需要首先启动并运行好 raft 协议,然后才可以让peerorderer等实例去申请证书。

首先每个实例依次轮询的方案被排除了,轮询不是一个合适的选择,软件会启动大量的 k8s 服务,因此它会启动大量的连接。@TangliziGit 使用了 Kubernetes Informer 来实现。它的原理是用 ListAndWatch 的方法,用 APIServer 的 LIST API“获取”所有最新版本的 API 对象;然后,再通过 WATCH API 来“监听”所有这些缓存的实例的变化;用户可以注册相应的事件,之后如果监听到的事件变化就会调用事件对应的EventHandler,实现回调。

为了实现监控状态的需求,回调函数的内容可以有两种写法:

  1. 添加全局回调,内容是将状态直接写入数据库。特点是方便且简洁。
  2. 为软件中的kubernetes.model按需建立回调。特点是灵活且功能强。

@TangliziGit 选择了后者。因为后续还有不同的需求存在,等迭代到再行设计(其实更多为了娱乐)。

2. Kubernetes 服务是异步创建的,那么如何实现同步的方法?

创建实例后申请锁,在 Informer 回调中释放锁即可。需要注意的是,回调函数会被同时多次调用,那么回调中的锁会被多次释放,导致panic@TangliziGit 使用 DCL 解决这个问题,实际上只要多个线程竞争同一个临界区且该临界区只能进入一次的情况下,使用 DCL 解决是很合适的。

Comments

  • [58e976e] release(v0.4): merge branch 'dev'
  • [7b6c5dc] fix(API):Fix front-end feedback api problem
  • [524cf97] fix(api): change the request field 'orgs' into 'organizations'
  • [e3ef1d4] fix(API):Fix front-end feedback api problem
  • [eb25f51] feat(chaincode):Improve the function
  • [5fe2830] fix(model.k8s.peer): Fix gossip setting error
  • [d961f03] fix(model.kubernetes): use DCL to prevent multiple threads from competing to release the lock
  • [2d3016d] feat(peer):external chaincode
  • [772aa6a] fix(network):The sdk is not closed after deleting the network
  • [7df9e97] fix(network):Deleting a non-existent network raises a null pointer exception
  • [2dc0b7b] feat: Add chaincode lifecycle management
  • [59aec38] feat(chaincode):add chaincode.go and chaincodeInstance.go
  • [8dc5bad] fix(sdk):The old sdk was not closed after the update
  • [29ac1f1] refactor:Refactor code using synchronous functions
  • [2dc570a] feat(k8sModel): add error handling on awaitableCreate
  • [e227f03] chore(.gitignore): update
  • [e28dfa3] feat(k8sModel): add AwaitableCreate as synchronous create method
  • [56f5dd2] feat:Add org to consortiums
  • [d2dc318] fix:1.fix some stupid mistakes;2.add log
  • [ed38b2c] fix:add org and channel by Goroutine

[2021-03-17] Version 0.1

17 Mar 07:52
Compare
Choose a tag to compare

Main Content

Add network management functions.

Notable Problems

1. 如何开发和调试一个在 kubernetes 中运行的程序?

因为需求中需要创建大量的 kubernetes 服务,但大多数端口只是软件内部互相调用,并不需要暴露给外界,内部是需要使用 FQDN 即可访问。

这里有两种方法解决。第一种同时也是目前的选择,@lilingj 提出在 k8s 上创建一个 linux 发行版的 deployment 作为开发环境,在其上进行后端的开发和调试。这样 k8s 只需要暴露一个后端 api 的端口。但是 IDE 的调试功能受到很大的影响,@TangliziGit 因此使用了 dlv。但 dlv 依然不方便使用,每次调式前需要手动开启 dlv 的服务。

第二种则是在开发调试阶段大量暴露端口,用反向代理进行 endpoint 的矫正。这种方法在本地上集成了运行的环境,极大方便了本地调试(IDE和各种命令行的调试工具)。但是部署开发的环境却非常麻烦,需要考虑大量的服务端口的矫正。
为了开发环境部署的简洁,我们选择了第一种方法。

2. 如何管理各种 Fabric 服务的配置和证书等文件?为何选择 Deployment 来作为 Fabric 应用的形式而非 StatefulSet

在项目设计阶段,@TangliziGit 考虑过使用StatefulSet的形式配置peerorderer,因为其提供了稳定唯一的ID(这样就可以在 k8s 层面上扩增peer或者orderer)、稳定持久的存储(比如新启动的ca使用旧存储,会出现问题)、有序且分配PV的缩放和部署。

但这会存在一个很明显的问题,配置和证书等文件是零散的,不便于软件后续的集中管理。同时在 k8s 层面上缩放也不是必要的需求。最终使用 Deployment 配置它们,同时使用 NFS 集中管理。

3. 如何使用 Fabric Go SDK 中未涉及或难以调用的方法?

比如如下代码:

configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./generated/channel-artifacts/${CHANNEL_NAME}.tx -channelID $CHANNEL_NAME

在SDK文档及源码中没有发现相关方法,但是 CLI 中存在。为了便于统计和运行其他服务中没有的 CLI,@TangliziGit 建立全局唯一的 hyperledger/fabric-tools 服务,专门用于调用。

4. 如何建立大量 hyperledger 网络的 SDK 对象和对应的网络配置文件?

在 Fabric Go SDK 中,每个网络都需要对应一个配置文件来声明所有的组织、ordererspeers等 MSP 位置和访问端口等信息。

@lilingj 在内存中维护所有对应 SDK 信息,软件启动时从数据库中获取所有网络来设定所有 SDK,同时当网络变动后主动更新 SDK。
@TangliziGitconfigtx.yaml等配置文件根据网络渲染至 NFS 对应位置。

5. 如何正确设置 X509 证书的 DN 字段以免访问错误?

在 SSL 中 X509 证书通过信任链和公钥进行服务的安全访问,DN 字段规定了只能用什么样的域名来访问该服务。需要注意的是,在 k8s 中,服务不能通过 FQDN 来访问自己所在环境下的进程。所以当应用程序访问自己时,@TangliziGit 选择用本地回环来访问。所以在 DN 中需要留一个本地回环的域名。

Commits

  • [549c2d1] release(v0.1): merge branch 'dev'
  • [44a6edb] fix:fix some stupid mistakes
  • [88089f9] fix:1. Fix the slicing problem when removing ordererorg; 2. Remove some useless payloads
  • [b96b8be] fix: 1. remove ordererorg from response.network; 2.fix response.network createTime to unix;3.deploy network by Goroutine
  • [2e1a8f1] fix:Fix the return value of organization
  • [bf16f39] add: Add response structure
  • [291e7f4] Merge branch 'dev' of https://github.com/doporg/Mictract-go-server into dev
  • [6f420aa] add:add API about user
  • [5f07e55] docs(README.md): add external mysql deployment
  • [6aaf849] feat: use external database service
  • [996947b] docs(README.md): add unit-test method
  • [09b2e93] fix: NFS_SERVER_URL, variable rename, tier correction and go.mod updation
  • [d32e7a7] fix:remove PageInfo
  • [e74351e] fix:fix request bug
  • [7200665] fix:fix API about organization
  • [f0f4c29] fix:fix API about network
  • [13bf55e] refactor:db
  • [2575047] chore:Improve the domain name parse function
  • [4d14942] Start or close mysql and tools in init
  • [15b2d24] Make the API more in line with restful
  • [02e7c42] Improved the function of starting the network
  • [fb7a059] add:add API GetBlockByBlockID and GetChannelInfo
  • [d540823] Modified the bug of ca user type and changed user to client
  • [eb820f7] add:Add API AddChannel
  • [755f49b] fix:Modified the bug of addOrderer API
  • [6bcb88a] Add api (addOrg, addPeer, addOrderer). Modified the database bug
  • [62b0ad3] Expose port 32323
  • [471a458] add:Add the function of dynamically adding orderer (solo is not supported)
  • [6cdac41] add:add MYSQL
  • [5be5960] test:Test update anchor node function
  • [3f315a5] add:Add dynamic add organization function
  • [4290a18] chore:Refactor part of the code
  • [aec7032] Modified /model/sdkConfig, inserting the user certificate into it. Added global variable Nets
  • [87a43db] fix:Several errors have been corrected. At present, the basic network can create and join channels.
  • [c99b541] fix:No error is reported for repeated registration
  • [cad3169] style(test): fix a typo and clear the style
  • [92ed480] fix(test): add a new arg TLS for BuildDir
  • [18e62c3] fix(k8s-model): use localhost in x509 to connect peer itself
  • [728d0cc] Merge branch 'dev' of https://github.com/doporg/Mictract-go-server into dev
  • [4ae41ff] Modified certificate related errors
  • [d82f8e5] fix(k8s-model): correctify FQDN
  • [b52b00b] Modify the mount path of orderer model
  • [f9df350] fix: use nfs-server DN
  • [7e263c9] fix(model): remove tabs from config.yaml
  • [e17874f] fix(model): set unescape angle bracket and correctify FQDN
  • [d6e27ed] Modified the relevant code of k8s deployment network, corrected some errors, and the ca part of sdkconfig can work normally at present
  • [df4f01e] fix:fix about sdk
  • [683286b] fix:fix orgMSP
  • [75a20ff] docs(README.md): use minikube ip and change exposed path
  • [6e227fd] docs(README.md): place configtx.yaml.tpl
  • [7ee9e4c] fix(RenderConfigtx): add testcase and move template
  • [8196ab6] docs(README.md): changed NFS_EXPOSED_PATH and added kube-config example
  • [4421704] fix(NewCaUserFromDomainName): confused username and domain name
  • [8b57276] fix(network): set correct ID and render configtx.yaml
  • [049f425] test(DeployNetwork): failed on Network.UpdateSDK
  • [81f510d] add:Add something about ‘dynamic addition’
  • [ff1fc39] add:Added the script addorg.sh, which can generate channel configuration update files, including dynamically adding organizations, anchor nodes, and orderer
  • [d11b498] docs(README.md): add NFS deployment doc
  • [5460949] refactor: extract NFS server address
  • [05bfd2a] fix:add channel to sdkconfig
  • [ea7fb6e] add:add config.yaml
  • [225c19f] feat: deploy network
  • [859978a] src: move enroll and register into CaUser methods
  • [c87a040] test: add k8s model watch and exec command test cases
  • [35daae5] feat: k8s model watching and exec command feature
  • [99f3ef8] chore: add k8s dependencies
  • [f5a96f2] fix: init db
  • [b373993] test: test k8s models
  • [e31d819] feature: add kubernetes models
  • [71d3bbc] feature: setup kubernetes sdk
  • [11c624d] readme: deployment for dev env
  • [06a7525] feature: k8s configurations for dev env
  • [293aeb3] feature: dockerfile for dev env
  • [4b464bf] update:modify some model, make it better
  • [9f15e0a] fix:fix some code
  • [39ce519] test: add some test case about sdkConfig
  • [946cb94] feat: sdk config file generator
  • [99a75dd] src: add .gitignore
  • [81bcd10] test: add some test case about CaUser
  • [36309fc] update: modify some code, make it better
  • [4687384] 重写了证书存储相关代码
  • [94b73d8] 添加ca注册服务
  • [989991c] 添加ca注册服务
  • [ba2f8db] Add user model and test
  • [e34f271] src: init code strcuture and write a demo
  • [d39b236] init