Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.2.neworg #27

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions 014.purge_swarm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ansible-playbook -v 014.purge_swarm.yml -u root

- name: Initialize the host machines
- name: Purge all swarm services
hosts: all
gather_facts: no
become: yes
Expand All @@ -13,10 +13,27 @@
ignore_errors: yes
when: "inventory_hostname in groups.swarm_manager_prime"

- name: "Remove an Overlay Docker Network"
become: yes
become_user: "root"
docker_network:
name: "{{ swarm_network }}"
state: absent
force: yes
when: "inventory_hostname in groups.swarm_manager_prime"

- name: Remove any orphan containers on any machine
shell: 'docker rm $(docker ps -aq)'
ignore_errors: yes

- name: Remove created volumes on any machone
shell: 'docker volume rm $(docker volume ls -q)'
ignore_errors: yes

- name: prune all networks on any machine
shell: 'docker network prune -f'
ignore_errors: yes

- name: Leave swarm for a node
docker_swarm:
state: absent
Expand All @@ -32,7 +49,7 @@
docker_swarm:
state: absent
force: true
when: "inventory_hostname in groups.swarm_managers"
when: "inventory_hostname in groups.swarm_managers"

- name: Remove data for all services
shell: "rm -rf /root/hlft-store/*"
6 changes: 4 additions & 2 deletions 101.deploy_orderer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

- name: Spawn a Hyperledger Fabric Topology
hosts: swarm_manager_prime
gather_facts: no
gather_facts: no
vars:
Consenters: []
roles:
- hlf/cli/orderer
- hlf/cli/orderer_prime
- hlf/orderer
9 changes: 9 additions & 0 deletions 101.export_org_artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

# ansible-playbook -v 101.export_org_artifacts.yml --flush-cache -u root

- name: Spawn a Hyperledger Fabric Topology
hosts: swarm_manager_prime
gather_facts: no
roles:
- hlf/newOrg/gen_new_org_artifacts
11 changes: 11 additions & 0 deletions 101.import_org_artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

# ansible-playbook -v 101.import_org_artifacts.yml --flush-cache -u root

- name: Spawn a Hyperledger Fabric Topology
hosts: swarm_manager_prime
gather_facts: no
vars:
artifact_path: "/tmp/bityoga_export.tgz"
roles:
- hlf/newOrg/add_new_org_artifacts
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,45 +210,48 @@ Setting up of hyperledger fabric cluster requires the following steps. Creating
- Contains mounts of MSPs for all agents (admin, orderer, peers, ...)
- Can perfrom any and all operations on the blockchain by changing its profile to any of the mounted agents
- Mounts a test chaincode under `/root/CLI/chaincodes/test_chaincode`
- Sanity Check the working of the cluster
- Sanity Check the working of the cluster [OPTIONAL]
- Test chaincode is automatically installed when *INSTALL_TEST_CHAINCODE: "yes"* in *group_vars/all.yml*. If, *INSTALL_TEST_CHAINCODE: "no"* then you can install it manually, if needed, by following the steps bellow:
- Install, Instanciate and Test Chaincode
```bash
docker exec -it <<CLI_ID>> bash
PEER_HOST=peer2
CORE_PEER_ADDRESS=${PEER_HOST}:7051
CORE_PEER_MSPCONFIGPATH=/root/CLI/${ORGCA_HOST}/${ADMIN_USER}/msp
CORE_PEER_TLS_ROOTCERT_FILE=/root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp/tls/ca.crt
CORE_PEER_TLS_CLIENTAUTHREQUIRED=true
CORE_PEER_TLS_CLIENTCERT_FILE=/root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp/tls/server.crt #fully qualified path of the client certificate
CORE_PEER_TLS_CLIENTKEY_FILE=/root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp/tls/server.key #fully qualified path of the client private key
```
- Install the chaincode on peer 2
```bash
CORE_PEER_ADDRESS=$CORE_PEER_ADDRESS CORE_PEER_MSPCONFIGPATH=$CORE_PEER_MSPCONFIGPATH CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_ROOTCERT_FILE peer chaincode install -n testcc -v 1.0 -l node -p /root/CLI/chaincodes/test_chaincode/node
CORE_PEER_ADDRESS=$CORE_PEER_ADDRESS CORE_PEER_MSPCONFIGPATH=$CORE_PEER_MSPCONFIGPATH CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_ROOTCERT_FILE CORE_PEER_TLS_CLIENTAUTHREQUIRED=$CORE_PEER_TLS_CLIENTAUTHREQUIRED CORE_PEER_TLS_CLIENTCERT_FILE=$CORE_PEER_TLS_CLIENTCERT_FILE CORE_PEER_TLS_CLIENTKEY_FILE=$CORE_PEER_TLS_CLIENTKEY_FILE peer chaincode install -n testcc -v 1.0 -l node -p /root/CLI/chaincodes/test_chaincode/node
```

- Instanciate the chaincode
```bash
CORE_PEER_ADDRESS=$CORE_PEER_ADDRESS CORE_PEER_MSPCONFIGPATH=$CORE_PEER_MSPCONFIGPATH CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_ROOTCERT_FILE peer chaincode instantiate -C appchannel -n testcc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -o ${ORDERER_HOST}:7050 --tls --cafile ${CORE_PEER_TLS_ROOTCERT_FILE}
CORE_PEER_ADDRESS=$CORE_PEER_ADDRESS CORE_PEER_MSPCONFIGPATH=$CORE_PEER_MSPCONFIGPATH CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_ROOTCERT_FILE CORE_PEER_TLS_CLIENTAUTHREQUIRED=$CORE_PEER_TLS_CLIENTAUTHREQUIRED CORE_PEER_TLS_CLIENTCERT_FILE=$CORE_PEER_TLS_CLIENTCERT_FILE CORE_PEER_TLS_CLIENTKEY_FILE=$CORE_PEER_TLS_CLIENTKEY_FILE peer chaincode instantiate -C appchannel -n testcc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -o ${ORDERER_HOST}:7050 --tls --cafile ${CORE_PEER_TLS_ROOTCERT_FILE} --clientauth --certfile /root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp/tls/server.crt --keyfile /root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp/tls/server.key
```

- List the installed chaincodes
```bash
CORE_PEER_ADDRESS=$CORE_PEER_ADDRESS CORE_PEER_MSPCONFIGPATH=$CORE_PEER_MSPCONFIGPATH CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_ROOTCERT_FILE peer chaincode list --installed
CORE_PEER_ADDRESS=$CORE_PEER_ADDRESS CORE_PEER_MSPCONFIGPATH=$CORE_PEER_MSPCONFIGPATH CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_ROOTCERT_FILE CORE_PEER_TLS_CLIENTAUTHREQUIRED=$CORE_PEER_TLS_CLIENTAUTHREQUIRED CORE_PEER_TLS_CLIENTCERT_FILE=$CORE_PEER_TLS_CLIENTCERT_FILE CORE_PEER_TLS_CLIENTKEY_FILE=$CORE_PEER_TLS_CLIENTKEY_FILE peer chaincode list --installed
```
- List the instanciated chaincodes

```bash
CORE_PEER_ADDRESS=$CORE_PEER_ADDRESS CORE_PEER_MSPCONFIGPATH=$CORE_PEER_MSPCONFIGPATH CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_ROOTCERT_FILE peer chaincode list --instantiated -C appchannel
CORE_PEER_ADDRESS=$CORE_PEER_ADDRESS CORE_PEER_MSPCONFIGPATH=$CORE_PEER_MSPCONFIGPATH CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_ROOTCERT_FILE CORE_PEER_TLS_CLIENTAUTHREQUIRED=$CORE_PEER_TLS_CLIENTAUTHREQUIRED CORE_PEER_TLS_CLIENTCERT_FILE=$CORE_PEER_TLS_CLIENTCERT_FILE CORE_PEER_TLS_CLIENTKEY_FILE=$CORE_PEER_TLS_CLIENTKEY_FILE peer chaincode list --instantiated -C appchannel
```
- GET
```bash
CORE_PEER_ADDRESS=$CORE_PEER_ADDRESS CORE_PEER_MSPCONFIGPATH=/root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_ROOTCERT_FILE peer chaincode query -C appchannel -n testcc -c '{"Args":["query","a"]}'
CORE_PEER_ADDRESS=$CORE_PEER_ADDRESS CORE_PEER_MSPCONFIGPATH=/root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_ROOTCERT_FILE CORE_PEER_TLS_CLIENTAUTHREQUIRED=$CORE_PEER_TLS_CLIENTAUTHREQUIRED CORE_PEER_TLS_CLIENTCERT_FILE=$CORE_PEER_TLS_CLIENTCERT_FILE CORE_PEER_TLS_CLIENTKEY_FILE=$CORE_PEER_TLS_CLIENTKEY_FILE peer chaincode query -C appchannel -n testcc -c '{"Args":["query","a"]}'
```
- PUT
```bash
CORE_PEER_ADDRESS=$CORE_PEER_ADDRESS CORE_PEER_MSPCONFIGPATH=/root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_ROOTCERT_FILE peer chaincode invoke -C appchannel -n testcc -c '{"Args":["invoke","a","b","10"]}' -o ${ORDERER_HOST}:7050 --tls --cafile ${CORE_PEER_TLS_ROOTCERT_FILE}
CORE_PEER_ADDRESS=$CORE_PEER_ADDRESS CORE_PEER_MSPCONFIGPATH=/root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_ROOTCERT_FILE CORE_PEER_TLS_CLIENTAUTHREQUIRED=$CORE_PEER_TLS_CLIENTAUTHREQUIRED CORE_PEER_TLS_CLIENTCERT_FILE=$CORE_PEER_TLS_CLIENTCERT_FILE CORE_PEER_TLS_CLIENTKEY_FILE=$CORE_PEER_TLS_CLIENTKEY_FILE peer chaincode invoke -C appchannel -n testcc -c '{"Args":["invoke","a","b","10"]}' -o ${ORDERER_HOST}:7050 --tls --cafile ${CORE_PEER_TLS_ROOTCERT_FILE} --clientauth --certfile /root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp/tls/server.crt --keyfile /root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp/tls/server.key
```
- GET
```bash
CORE_PEER_ADDRESS=$CORE_PEER_ADDRESS CORE_PEER_MSPCONFIGPATH=/root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_ROOTCERT_FILE peer chaincode query -C appchannel -n testcc -c '{"Args":["query","a"]}'
CORE_PEER_ADDRESS=$CORE_PEER_ADDRESS CORE_PEER_MSPCONFIGPATH=/root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_ROOTCERT_FILE CORE_PEER_TLS_CLIENTAUTHREQUIRED=$CORE_PEER_TLS_CLIENTAUTHREQUIRED CORE_PEER_TLS_CLIENTCERT_FILE=$CORE_PEER_TLS_CLIENTCERT_FILE CORE_PEER_TLS_CLIENTKEY_FILE=$CORE_PEER_TLS_CLIENTKEY_FILE peer chaincode query -C appchannel -n testcc -c '{"Args":["query","a"]}'
```

- Playbook: `104.deploy_hlf_explorer`
Expand Down
Binary file modified filter_plugins/__pycache__/enumerate.cpython-37.pyc
Binary file not shown.
Binary file modified filter_plugins/__pycache__/enumerate.cpython-38.pyc
Binary file not shown.
15 changes: 8 additions & 7 deletions group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
LOG_LEVEL: "INFO"
LOG_LEVEL: "DEBUG"
INSTALL_TEST_CHAINCODE: "yes"
###########################################################################################
# #
# #
Expand All @@ -21,8 +22,8 @@ glusterd_version: '7'

# Organization Details
org:
name: "hlf"
unit: "bityoga"
name: "agelia"
unit: "energy"

# Creds of various agents
admin_user: "admin1"
Expand Down Expand Up @@ -83,16 +84,16 @@ orgca: { switch: "on", image: "hyperledger/fabric-ca", tag: "1.4", replicas: -1,
######################################### Orderer #############################################
orderer: { switch: "on", image: "hyperledger/fabric-orderer", tag: "2.2", replicas: -1, port: 8053,
caname: "{{orgca.name}}", anchorpeer: "{{peer1.name}}", anchorport: "{{peer1.port}}",
path: "/root/{{orderer_user}}", type: "solo",
name: "{{orderer_user}}", password: "{{orderer_password}}", type: "orderer"
path: "/root/{{orderer_user}}", type: "orderer",
name: "{{orderer_user}}", password: "{{orderer_password}}"
}

######################################### Peers #############################################
peer1: { switch: "on", image: "hyperledger/fabric-peer", tag: "2.2", replicas: -1, port: 8054,
caname: "{{orgca.name}}", path: "/root/{{peer1_user}}", bootstrap: "",
dbtype: "goleveldb",
name: "{{peer1_user}}", password: "{{peer1_password}}", type: "peer",
leader: "{peer1_user}}"
leader: "{{peer1_user}}"
}

peer2: { switch: "on", image: "hyperledger/fabric-peer", tag: "2.2", replicas: -1, port: 8055,
Expand All @@ -103,7 +104,7 @@ leader: "{{peer1_user}}"
}

######################################### CLI #############################################
cli: { switch: "on", image: "hyperledger/fabric-tools", tag: "2.2"}
cli: { switch: "on", name: "CLI", image: "hyperledger/fabric-tools", tag: "2.2"}
######################################### DBs #############################################
sqlite: {type: "sqlite3", source: "fabric-ca-server.db"}

Expand Down
15 changes: 15 additions & 0 deletions inventory/hosts_org1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[all:children]
swarm_manager_prime
swarm_managers
swarm_workers

[swarm_manager_prime]
hlf0 ansible_host=165.232.76.37 ansible_python_interpreter=/usr/bin/python3


[swarm_managers]
hlf0 ansible_host=165.232.76.37 ansible_python_interpreter=/usr/bin/python3

[swarm_workers]
hlf1 ansible_host=138.68.87.60 ansible_python_interpreter=/usr/bin/python3
hlf2 ansible_host=138.68.87.49 ansible_python_interpreter=/usr/bin/python3
14 changes: 14 additions & 0 deletions inventory/hosts_org2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[all:children]
swarm_manager_prime
swarm_managers
swarm_workers

[swarm_manager_prime]
hlf0 ansible_host=142.93.216.173 ansible_python_interpreter=/usr/bin/python3


[swarm_managers]
hlf0 ansible_host=142.93.216.173 ansible_python_interpreter=/usr/bin/python3

[swarm_workers]
hlf1 ansible_host=134.209.146.246 ansible_python_interpreter=/usr/bin/python3
43 changes: 43 additions & 0 deletions notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#adding new orgs
NEW_ORG_NAME=bityoga
CHANNEL_NAME=syschannel

configtxgen -printOrg ${NEW_ORG_NAME}MSP > org${NEW_ORG_NAME}.json -configPath /root/CLI/new_org_artifacts

PEER_HOST=peer1
CORE_PEER_ADDRESS=${PEER_HOST}:7051
CORE_PEER_MSPCONFIGPATH=/root/CLI/${ORGCA_HOST}/${ADMIN_USER}/msp

CORE_PEER_TLS_ENABLED=true
CORE_PEER_TLS_ROOTCERT_FILE=/root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp/tls/server.key
CORE_PEER_TLS_CERT_FILE=/root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp/tls/server.crt
CORE_PEER_TLS_CLIENTAUTHREQUIRED=false

CORE_PEER_MSPCONFIGPATH=$CORE_PEER_MSPCONFIGPATH peer channel fetch config config_block.pb -o ${ORDERER_HOST}:7050 -c $CHANNEL_NAME --tls --cafile ${CORE_PEER_TLS_ROOTCERT_FILE} --clientauth --certfile ${CORE_PEER_TLS_CERT_FILE} --keyfile ${CORE_PEER_TLS_KEY_FILE}


configtxlator proto_decode --input config_block.pb --type common.Block | jq .data.data[0].payload.data.config > config.json

jq -s '.[0] * {"channel_group":{"groups":{"Orderer":{"groups": {"'${NEW_ORG_NAME}MSP'":.[1]}}}}}' config.json org${NEW_ORG_NAME}.json > config1.json

jq -s '.[0] * {"channel_group":{"groups":{"Consortiums":{"groups":{"SampleConsortium":{"groups": {"'${NEW_ORG_NAME}MSP'":.[1]}}}}}}}' config1.json org${NEW_ORG_NAME}.json > config2.json

cert=`base64 ./tls/server.crt | sed ':a;N;$!ba;s/\n//g'`

cat config2.json | jq '.channel_group.groups.Orderer.values.ConsensusType.value.metadata.consenters += [{"client_tls_cert": "'$cert'", "host": "142.93.216.173", "port": 8053, "server_tls_cert": "'$cert'"}] ' > modified_config.json


configtxlator proto_encode --input config.json --type common.Config --output config.pb
configtxlator proto_encode --input modified_config.json --type common.Config --output modified_config.pb
configtxlator compute_update --channel_id ${CHANNEL_NAME} --original config.pb --updated modified_config.pb --output neworg.pb
configtxlator proto_decode --input neworg.pb --type common.ConfigUpdate | jq . > neworg.json
echo '{"payload":{"header":{"channel_header":{"channel_id":"'$CHANNEL_NAME'", "type":2}},"data":{"config_update":'$(cat neworg.json)'}}}' | jq . > org_update_in_envelope.json
configtxlator proto_encode --input org_update_in_envelope.json --type common.Envelope --output org_update_in_envelope.pb




CORE_PEER_MSPCONFIGPATH=$CORE_PEER_MSPCONFIGPATH peer channel signconfigtx -f org_update_in_envelope.pb

CORE_PEER_MSPCONFIGPATH=$CORE_PEER_MSPCONFIGPATH peer channel update -o ${ORDERER_HOST}:7050 -c ${CHANNEL_NAME} -f org_update_in_envelope.pb --tls --cafile ${ORDERER_CA} --clientauth --certfile ${CORE_PEER_TLS_CERT_FILE} --keyfile ${CORE_PEER_TLS_KEY_FILE}
95 changes: 95 additions & 0 deletions register_service/200.deploy_ registrar_service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---

# ansible-playbook -v 200.deploy_registrar_service.yml -u root

- name: Deploy Registrar Service
hosts: all
gather_facts: no
tasks:
- name: Clean Registrar Folder Structure
file:
path: "/root/hlft-store/{{registrar.name}}"
state: absent

- name: Create Registrar Folder Structure
file:
path: "/root/hlft-store/{{registrar.name}}"
state: directory

- name: Create tls-admin Folder Structure
file:
path: "/root/hlft-store/{{registrar.name}}/tls-{{admin.name}}"
state: directory

- name: Copy relevent files
copy:
src: "{{item[0]}}"
dest: "/root/hlft-store/{{registrar.name}}/{{item[0]}}"
mode: "{{item[1]}}"
loop:
- ["package.json", 400]
- ["server.json", 400]
- ["setup.sh", 500]

- name: Template required files
become: yes
template:
src: "{{item}}.j2"
dest: "/root/hlft-store/{{registrar.name}}/{{item}}"
mode: '0750'
force: yes
loop:
- "connection_profile.json"
- "server.js"

- name: Get keystore filename for admin user
shell: ls /root/hlft-store/{{admin.tlsca}}/{{admin.name}}/msp/keystore | sort -n | head -1
register: key_filename
ignore_errors: True

- name: Copy relevent tls files for admin user
copy:
src: "/root/hlft-store/{{admin.tlsca}}/{{admin.name}}/msp/{{item[0]}}"
dest: "/root/hlft-store/{{registrar.name}}/tls-{{admin.name}}/{{item[1]}}"
remote_src: yes
loop:
- ["tlscacerts/tls-{{tlsca.name}}-7054.pem", "ca.crt"]
- ["signcerts/cert.pem", "server.crt"]
- ["keystore/key.pem", "server.key"]

- name: Stop the Registrar Service
become: yes
docker_swarm_service:
name: "{{ registrar.name }}"
state: absent

- name: Start the Registrar Service
become: yes
docker_swarm_service:
name: "{{ registrar.name }}"
hostname: "{{ registrar.name }}"
networks:
- "{{swarm_network}}"
image: "{{registrar.image}}:{{registrar.tag}}"
mode: replicated
replicas: "{{registrar.replicas}}"
mounts:
- source: "/root/hlft-store/{{registrar.name}}"
target: "{{registrar.path}}"
type: bind
publish:
- published_port: "{{registrar.port}}"
target_port: "8080"
protocol: "tcp"
working_dir: "{{registrar.path}}"
command: >
bash -c "{{registrar.path}}/setup.sh;"
placement:
constraints:
- node.role == worker
force_update: yes

# Pause for 25 seconds for yarn install to complete
- name: Pause for 30 seconds for yarn install to complete
pause:
seconds: 30
26 changes: 26 additions & 0 deletions register_service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Registar Server for fabric-as-code (HTTPS Enabled)
The register service is an **optional** service provided for the fabric as code hyperledger fabric network. This service provides a RESTful App for registration of users. This purticularly useful for mobile Hyperledger Fabric clients that would like to call a registration service with admin rights that is able to register a given user.

## Pre-requisites
- Make sure that the the fabric-as-code is up and running
- You have to run the playbook '200.deploy_ registrar_service.yml' on the master node of the fabric-as-code network
- Change the file **inventory/hosts** in this directory
- Please replace the *ip.address* value in the following line inside *inventory/host* to the ip address of the machine running the master node
```hlf1 ansible_host=ip.address ansible_python_interpreter=/usr/bin/python3```
- Change the file **group_vars/all.yml** in this directory
- Change the following two values
- ```admin_name```: name of the user with admin rights that can register new client users. **Note: This user needs to have been already been registered with the hyperledger fabric network**
- ```admin_password```: password of the aforementioned user
- Make sure port **8088** is open for the master node of the hyperledger fabric network

## Start the service
- Inorder to start the service run the following command
- Make sure that the machine form which you are running the following commands, has ansible version of atleast **ansible 2.9.1** or up.
- !!!Required: Ensure that you have password less SSH for these host for a user. Later when you run the playbooks change the value for the playbooks with argument -u to the appropiate user that has passwordless SHH access to these machines
- 200.deploy_ registrar_service.yml: Playbook that runs the registration services
```ansible-playbook -v 200.deploy_ registrar_service.yml -u root```

## Varification
- Test connection: *curl -k -X POST https://165.232.76.37:8088*
- Register a user: *curl -k -X POST -d "username=user1&password=user1pw" https://165.232.76.37:8088/register*
- Change the value for username or password
Loading