Skip to content

Commit

Permalink
[CE-407]Allow agent to deploy peer or orderer only
Browse files Browse the repository at this point in the history
Currently the agent deploy both peers and orderers. but in
some cases, users may only want to deploy just peers or
just orderers, this patch set will provide that capability
and give the users the capability.

Change-Id: I762c474cdeb2f2cbb5b57b9124793f25230f84c8
Signed-off-by: Tong Li <litong01@us.ibm.com>
  • Loading branch information
Tong Li committed Jul 3, 2018
1 parent 589ea4c commit d0ed152
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
src: "{{ playbook_dir }}/../deploy_k8s/fabricsetup/templates/dochannel.j2"
dest: "{{ fabricworkdir }}/keyfiles/dochannel.sh"
mode: "u=rx,g=rx"
when: allorderers | length > 0
when: (allorderers | length > 0) and (allpeers | length > 0)

- name: Create persistent volume
command: >-
Expand Down Expand Up @@ -107,14 +107,14 @@
- "{{ playbook_dir }}/../deploy_k8s/fabricsetup/templates/firstcode.go"
tags: "placecerts"

- name: Copy certs onto the persistent volume
- name: Copy channel operation script onto the persistent volume
command: >-
./kubectl --kubeconfig kubeconfig cp {{ item }} fabriccertspod:/fabriccerts
args:
chdir: "{{ playbook_dir }}/../../vars/"
with_items:
- "{{ fabricworkdir }}/keyfiles/dochannel.sh"
when: allorderers | length > 0
when: (allorderers | length > 0) and (allpeers | length > 0)
tags: "placecerts"

- name: Untar certs.tgz in the Persistent volume
Expand Down Expand Up @@ -177,11 +177,12 @@
args:
chdir: "{{ playbook_dir }}/../../vars/"
with_items: "{{ dindpods.stdout_lines }}"
when: allpeers | length > 0
tags: "downloadccenv"

- name: Start channel operations
command: "./kubectl --kubeconfig kubeconfig apply -f ../run/cli-k8s.yaml"
args:
chdir: "{{ playbook_dir }}/../../vars/"
tags: "channeloperation"
when: allorderers | length > 0
when: (allorderers | length > 0) and (allpeers | length > 0)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
./kubectl --kubeconfig='kubeconfig' delete -f ../run/cli-k8s.yaml
args:
chdir: "{{ playbook_dir }}/../../vars/"
when: allorderers | length > 0
when: (allorderers | length > 0) and (allpeers | length > 0)
tags: "clientdown"

- name: Stop fabric pod and chaincode endpoint daemon set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@
dest: "/opt"
remote_src: True

- name: Fix up the search domain
lineinfile:
path: /etc/resolvconf/resolv.conf.d/base
state: present
line: search {{ cluster.domain | default('fabric') }}

- name: Setup golang profile
template:
src: "{{ playbook_dir }}/../env_flanneld/fastinitnode/templates/goroot.j2"
Expand Down
81 changes: 81 additions & 0 deletions src/agent/ansible/vars/ordereronly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
# The url to the fabric source repository
GIT_URL: "http://gerrit.hyperledger.org/r/fabric"

# The gerrit patch set reference, should be automatically set by gerrit
# GERRIT_REFSPEC: "refs/changes/23/11523/3" # 1.0.0
# GERRIT_REFSPEC: "refs/changes/47/12047/3" # 1.0.1
# GERRIT_REFSPEC: "refs/changes/13/13113/1"
# GERRIT_REFSPEC: "refs/tags/v1.0.4" # 1.0.4
GERRIT_REFSPEC: "" # 1.0.5

# This variable defines fabric network attributes
fabric: {

# The user to connect to the server
ssh_user: "ubuntu",

# options are "goleveldb", "CouchDB", default is goleveldb
peer_db: "goleveldb",
tls: false,
logging_level: "ERROR",
k8s: {
exposeserviceport: True,
storageclass: "default",
storagecapacity: "2Gi",
shared_storage: false,
mem_req: "512Mi",
mem_limit: "1024Mi",
cpu_req: "0.1",
cpu_limit: "0.2"
},

# The following section defines how the fabric network is going to be made up
# cas indicates certificate authority containers
# peers indicates peer containers
# orderers indicates orderer containers
# kafka indicates kafka containers
# all names must be in lower case. Numeric characters cannot be used to start
# or end a name. Character dot (.) can only be used in names of peers and orderers.
network: {
fabric001: {
cas: ["ca1st.orgc"],
peers: [],
orderers: ["orderer1st.orgc","orderer2nd.orgc","orderer3rd.orgc"],
zookeepers: ["zookeeper1st","zookeeper2nd","zookeeper3rd"],
kafkas: ["kafka1st","kafka2nd","kafka3rd"]
}
},

# the container tag for main fabric components such as orderer, peer,
# tools and chaincode. If left blank, then fabric components will be built
# from the latest fabric source code with the combination of the refspec
# specified above. If it is not empty, then its values must be the full
# container tag like the following:
# x86_64-1.1.0-alpha # alpha release
# DAILY_STABLE # daily stable
# DEV_STABLE # dev stable
# s390x-0.4.2 # release 0.4.2 for s390x
# 048c91eb47812582f36665fbea3d7e0e68e396bf # commit build
# x86_64-1.0.0-snapshot-8d3275f # snapshot build
baseimage_tag: "amd64-1.1.0",

# The container tag for accessory fabric components such as ca, kafka,
# zookeeper and couchdb. It has to be the full tag just like the
# baseimage_tag
helper_tag: "amd64-0.4.8",
ca: { admin: "admin", adminpw: "adminpw", image_tag: "amd64-1.1.0" },

# Only use this field when you have a docker repository.
repo: {
# the url defines docker hub project access point
# official hub - url: "hyperledger/",
# fabric build hub - url: "nexus3.hyperledger.org:10001/hyperledger/",
url: "hyperledger/",

# locations to download fabric binaries. This url should point to a
# compressed such as tar or zip file which contains necessary binaries
# such as configtxgen, configtxlator, cryptogen etc.
bin: "https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/linux-amd64-1.1.0/hyperledger-fabric-linux-amd64-1.1.0.tar.gz"
}
}
81 changes: 81 additions & 0 deletions src/agent/ansible/vars/peeronly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
# The url to the fabric source repository
GIT_URL: "http://gerrit.hyperledger.org/r/fabric"

# The gerrit patch set reference, should be automatically set by gerrit
# GERRIT_REFSPEC: "refs/changes/23/11523/3" # 1.0.0
# GERRIT_REFSPEC: "refs/changes/47/12047/3" # 1.0.1
# GERRIT_REFSPEC: "refs/changes/13/13113/1"
# GERRIT_REFSPEC: "refs/tags/v1.0.4" # 1.0.4
GERRIT_REFSPEC: "" # 1.0.5

# This variable defines fabric network attributes
fabric: {

# The user to connect to the server
ssh_user: "ubuntu",

# options are "goleveldb", "CouchDB", default is goleveldb
peer_db: "goleveldb",
tls: false,
logging_level: "ERROR",
k8s: {
exposeserviceport: True,
storageclass: "default",
storagecapacity: "2Gi",
shared_storage: false,
mem_req: "512Mi",
mem_limit: "1024Mi",
cpu_req: "0.1",
cpu_limit: "0.2"
},

# The following section defines how the fabric network is going to be made up
# cas indicates certificate authority containers
# peers indicates peer containers
# orderers indicates orderer containers
# kafka indicates kafka containers
# all names must be in lower case. Numeric characters cannot be used to start
# or end a name. Character dot (.) can only be used in names of peers and orderers.
network: {
fabric001: {
cas: ["ca1st.orgt"],
peers: ["anchor@peer1st.orgt","worker@peer2nd.orgt","worker@peer3rd.orgt"],
orderers: [],
zookeepers: [],
kafkas: []
}
},

# the container tag for main fabric components such as orderer, peer,
# tools and chaincode. If left blank, then fabric components will be built
# from the latest fabric source code with the combination of the refspec
# specified above. If it is not empty, then its values must be the full
# container tag like the following:
# x86_64-1.1.0-alpha # alpha release
# DAILY_STABLE # daily stable
# DEV_STABLE # dev stable
# s390x-0.4.2 # release 0.4.2 for s390x
# 048c91eb47812582f36665fbea3d7e0e68e396bf # commit build
# x86_64-1.0.0-snapshot-8d3275f # snapshot build
baseimage_tag: "amd64-1.1.0",

# The container tag for accessory fabric components such as ca, kafka,
# zookeeper and couchdb. It has to be the full tag just like the
# baseimage_tag
helper_tag: "amd64-0.4.8",
ca: { admin: "admin", adminpw: "adminpw", image_tag: "amd64-1.1.0" },

# Only use this field when you have a docker repository.
repo: {
# the url defines docker hub project access point
# official hub - url: "hyperledger/",
# fabric build hub - url: "nexus3.hyperledger.org:10001/hyperledger/",
url: "hyperledger/",

# locations to download fabric binaries. This url should point to a
# compressed such as tar or zip file which contains necessary binaries
# such as configtxgen, configtxlator, cryptogen etc.
bin: "https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/linux-amd64-1.1.0/hyperledger-fabric-linux-amd64-1.1.0.tar.gz"
}
}

0 comments on commit d0ed152

Please sign in to comment.