Skip to content

Commit

Permalink
[CE-332]Add connection profile and composer playground
Browse files Browse the repository at this point in the history
This patch set added the function to create composer
connection profile based on the fabric network
configuration. It also sets up composer playground
to make sure that composer playground will be working
with the real fabric network, not the browser based
backend. It installs the car auction business
network by default, it can also install additional
business networks based on bna file.

Also remove few files no longer needed

Change-Id: Id88ba663eba58ee990c0e5cb9346f3fa302d1f86
Signed-off-by: Tong Li <litong01@us.ibm.com>
  • Loading branch information
Tong Li committed Apr 2, 2018
1 parent d8624d9 commit e59cde5
Show file tree
Hide file tree
Showing 16 changed files with 321 additions and 241 deletions.
160 changes: 0 additions & 160 deletions src/agent/ansible/roles/deploy_compose/certgen/tasks/apply.yml

This file was deleted.

This file was deleted.

This file was deleted.

45 changes: 45 additions & 0 deletions src/agent/ansible/roles/deploy_compose/certsetup/tasks/apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,51 @@
- "peerOrganizations"
- "ordererOrganizations"

- name: Create connection profiles
template:
src: "{{ playbook_dir }}/../deploy_compose/certsetup/templates/connection.j2"
dest: "{{ fabricworkdir }}/keyfiles/{{ item }}/connection.json"
with_items: "{{ allorgs }}"
tags: "composer"

- name: Create endorsement policy file
template:
src: "{{ playbook_dir }}/../deploy_compose/certsetup/templates/policy.j2"
dest: "{{ fabricworkdir }}/keyfiles/policy.json"
tags: "composer"

- name: Rename admin private key
shell: >-
ls | cat -n | while read n f; do mv "$f" "admin_private.key"; done
args:
chdir: "{{ fabricworkdir }}/keyfiles/{{ item }}/users/Admin@{{ item }}/msp/keystore"
with_items: "{{ allorgs }}"
tags: "composer"

- name: Rename ca private key
shell: >-
ls *_sk|cat -n|while read n f; do mv "$f" "ca_private.key"; done
args:
chdir: "{{ fabricworkdir }}/keyfiles/{{ item }}/ca"
with_items: "{{ allorgs }}"
tags: "composer"

- name: Rename ca tls private key
shell: >-
ls *_sk|cat -n|while read n f; do mv "$f" "tlsca_private.key"; done
args:
chdir: "{{ fabricworkdir }}/keyfiles/{{ item }}/tlsca"
with_items: "{{ allorgs }}"
tags: "composer"

- name: Upload bna file
copy:
src: "{{ item }}"
dest: "{{ fabricworkdir }}/keyfiles/"
with_fileglob:
- "{{ playbook_dir }}/../../secrets/networks/*.bna"
tags: "composer"

- name: Create core.yml file for every peer
template:
src: "{{ playbook_dir }}/../deploy_compose/certsetup/templates/core.j2"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"name": "{{ item }}-network",
"x-type": "hlfv1",
"version": "1.0.0",
"client": {
"organization": "{{ item }}",
"connection": {
"timeout": {
"peer": { "endorser": "300", "eventHub": "300", "eventReg": "300"},
"orderer": "300"
}
}
},
"channels": {
"firstchannel": {
"orderers": [
{% for orderer in orderers %}
"{{ orderer.name }}"{{ '' if loop.last else ',' }}
{% endfor %}
],
"peers": {
{% for peer in peers %}
"{{ peer.name }}": {
"endorsingPeer": true, "chaincodeQuery": true, "eventSource": true
}{{ '' if loop.last else ',' }}
{% endfor %}
}
}
},
"organizations": {
{% for org in allorgs %}
"{{ org }}": {
"mspid": "{{ org }}",
"peers": [
{% for peer in peers|selectattr('org', 'equalto', org)|list %}
"{{ peer.name }}"{{ '' if loop.last else ',' }}
{% endfor %}
],
"certificateAuthorities": [
{% for ca in cas|selectattr('org', 'equalto', org)|list %}
"{{ ca.name }}"{{ '' if loop.last else ',' }}
{% endfor %}
]
}{{ '' if loop.last else ',' }}
{% endfor %}
},
"orderers": {
{% for orderer in orderers %}
"{{ orderer.name }}": {
"url": "{{ fabric.tls|ternary('grpcs','grpc') }}://{{ orderer.name }}:7050",
"grpcOptions": {
"ssl-target-name-override": "{{ orderer.name }}"
},
"tlsCACerts": {
"pem": "{{ fabricworkdir+'/run/keyfiles/'+orderer.org+'/orderers/'+orderer.name+'.'+orderer.org+'/tls/ca.crt' }}"
}
}{{ '' if loop.last else ',' }}
{% endfor %}
},
"peers": {
{% for peer in peers %}
"{{ peer.name }}": {
"url": "{{ fabric.tls|ternary('grpcs','grpc') }}://{{ peer.name }}:7051",
"eventUrl": "{{ fabric.tls|ternary('grpcs','grpc') }}://{{ peer.name }}:7053",
"grpcOptions": {
"ssl-target-name-override": "{{ peer.name }}"
},
"tlsCACerts": {
"pem": "{{ fabricworkdir+'/run/keyfiles/'+peer.org+'/tlsca/tlsca.'+peer.org+'-cert.pem' }}"
}
}{{ '' if loop.last else ',' }}
{% endfor %}
},
"certificateAuthorities": {
{% for ca in cas %}
"{{ ca.name }}": {
"url": "{{ fabric.tls|ternary('https','http') }}://{{ca.name}}:7054",
"caName": "{{ ca.name }}",
"httpOptions": {"verify": false}
}{{ '' if loop.last else ',' }}
{% endfor %}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"identities": [
{% for org in peerorgs %}
{"role": { "name": "member", "mspId": "{{ org }}" } }{{ '' if loop.last else ',' }}
{% endfor %}
],
"policy": {
"{{ peerorgs | length }}-of": [
{% for org in peerorgs %}
{"signed-by": {{ loop.index0 }} }{{ '' if loop.last else ',' }}
{% endfor %}
]
}
}
Loading

0 comments on commit e59cde5

Please sign in to comment.