Skip to content
This repository was archived by the owner on Jan 20, 2021. It is now read-only.

Commit ae32b1b

Browse files
author
Simon Stone
authored
Merge pull request #112 from sstone1/issue-111
Add Docker hostname configuration (resolves #111)
2 parents 35f9d78 + fc73b01 commit ae32b1b

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ Example Playbook
118118
docker:
119119
# The name to use for this Docker container and associated Docker volumes.
120120
name: ca.org1.example.com
121+
# The hostname to use for this Docker container.
122+
hostname: ca.org1.example.com
121123
# The external port to use for this Docker container.
122124
port: 18050
123125
# IBM Blockchain Platform on IBM Cloud specific configuration.
@@ -153,6 +155,8 @@ Example Playbook
153155
docker:
154156
# The name to use for this Docker container and associated Docker volumes.
155157
name: peer0.org1.example.com
158+
# The hostname to use for this Docker container.
159+
hostname: peer0.org1.example.com
156160
# The external request port to use for this Docker container.
157161
port: 18051
158162
# The prefix to use for naming all chaincode Docker images and containers.
@@ -165,6 +169,8 @@ Example Playbook
165169
couchdb:
166170
# The name to use for the CouchDB Docker container and associated Docker volumes.
167171
name: couchdb0.org1.example.com
172+
# The hostname to use for the CouchDB Docker container.
173+
hostname: couchdb0.org1.example.com
168174
# The external CouchDB port to use for the CouchDB Docker container.
169175
port: 18054
170176
# IBM Blockchain Platform on IBM Cloud specific configuration.
@@ -208,6 +214,8 @@ Example Playbook
208214
docker:
209215
# The name to use for this Docker container and associated Docker volumes.
210216
name: ca.orderer.example.com
217+
# The hostname to use for this Docker container.
218+
hostname: ca.orderer.example.com
211219
# The external port to use for this Docker container.
212220
port: 17050
213221
# IBM Blockchain Platform on IBM Cloud specific configuration.
@@ -242,6 +250,8 @@ Example Playbook
242250
docker:
243251
# The name to use for this Docker container and associated Docker volumes.
244252
name: orderer.example.com
253+
# The hostname to use for this Docker container.
254+
hostname: orderer.example.com
245255
# The external port to use for this Docker container.
246256
port: 17051
247257
# The external operations port to use for this Docker container.

tasks/docker/create-ca.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
networks:
2121
- name: "{{ infrastructure.docker.network }}"
2222
networks_cli_compatible: yes
23+
hostname: "{{ ca.docker.hostname | mandatory }}"
2324
command: sh -c 'fabric-ca-server start -b {{ ca.admin_identity }}:{{ ca.admin_secret }}'
2425
env:
2526
FABRIC_CA_SERVER_CA_NAME: "ca"
@@ -66,8 +67,10 @@
6667
combine({
6768
ca.id: {
6869
'protocol': 'https' if ca.tls.enabled else 'http',
69-
'hostname': 'localhost', 'internal_hostname': ca.docker.name,
70-
'port': ca.docker.port, 'pem': organization.wallet + '/tls-root.pem' if ca.tls.enabled else '',
70+
'hostname': 'localhost',
71+
'internal_hostname': ca.docker.hostname,
72+
'port': ca.docker.port,
73+
'pem': organization.wallet + '/tls-root.pem' if ca.tls.enabled else '',
7174
'caname': 'ca',
7275
'tlscaname': 'ca'
7376
}

tasks/docker/create-orderer.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
networks:
100100
- name: "{{ infrastructure.docker.network }}"
101101
networks_cli_compatible: yes
102+
hostname: "{{ orderer.docker.hostname | mandatory }}"
102103
env:
103104
ORDERER_GENERAL_GENESISMETHOD: file
104105
ORDERER_GENERAL_GENESISFILE: /var/hyperledger/production/genesis.block
@@ -230,7 +231,7 @@
230231
orderer.id: {
231232
'protocol': 'grpcs' if orderer.tls.enabled else 'grpc',
232233
'hostname': 'localhost',
233-
'internal_hostname': orderer.docker.name,
234+
'internal_hostname': orderer.docker.hostname,
234235
'port': orderer.docker.port,
235236
'pem': organization.wallet + '/tls-root.pem' if orderer.tls.enabled else ''
236237
}

tasks/docker/create-peer.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
networks:
102102
- name: "{{ infrastructure.docker.network }}"
103103
networks_cli_compatible: yes
104+
hostname: "{{ peer.docker.couchdb.hostname | mandatory }}"
104105
published_ports:
105106
- "{{ peer.docker.couchdb.port }}:5984"
106107
volumes:
@@ -127,6 +128,7 @@
127128
networks:
128129
- name: "{{ infrastructure.docker.network }}"
129130
networks_cli_compatible: yes
131+
hostname: "{{ peer.docker.hostname | mandatory }}"
130132
env:
131133
CORE_PEER_ID: "{{ peer.id }}"
132134
CORE_PEER_NETWORKID: "{{ peer.docker.chaincode_name_prefix | default(omit) }}"
@@ -143,7 +145,7 @@
143145
CORE_CHAINCODE_NODE_RUNTIME: hyperledger/fabric-baseimage:0.4.18
144146
CORE_LEDGER_STATE_STATEDATABASE: "{{ 'CouchDB' if peer.database_type is defined and peer.database_type == 'couchdb' else 'goleveldb' }}"
145147
CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS: "{{
146-
peer.docker.couchdb.name + ':5984' if peer.database_type is defined and peer.database_type == 'couchdb' else ''
148+
peer.docker.couchdb.hostname + ':5984' if peer.database_type is defined and peer.database_type == 'couchdb' else ''
147149
}}"
148150
CORE_OPERATIONS_LISTENADDRESS: 0.0.0.0:{{ peer.docker.operations_port }}
149151
CORE_OPERATIONS_TLS_ENABLED: "{{ 'true' if peer.tls.enabled else 'false' }}"
@@ -241,7 +243,7 @@
241243
peer.id: {
242244
'protocol': 'grpcs' if peer.tls.enabled else 'grpc',
243245
'hostname': 'localhost',
244-
'internal_hostname': peer.docker.name,
246+
'internal_hostname': peer.docker.hostname,
245247
'port': peer.docker.port,
246248
'chaincode_port': peer.docker.chaincode_port,
247249
'pem': organization.wallet + '/tls-root.pem' if peer.tls.enabled else ''

tests/test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
enabled: true
2727
docker:
2828
name: ca.org1.example.com
29+
hostname: ca.org1.example.com
2930
port: 18050
3031
ibp:
3132
display_name: "Org1 CA"
@@ -41,11 +42,13 @@
4142
secret: "org1peer1tlspw"
4243
docker:
4344
name: peer0.org1.example.com
45+
hostname: peer0.org1.example.com
4446
port: 18051
4547
chaincode_port: 18052
4648
operations_port: 18053
4749
couchdb:
4850
name: couchdb0.org1.example.com
51+
hostname: couchdb0.org1.example.com
4952
port: 18054
5053
ibp:
5154
display_name: "Org1 Peer1"
@@ -60,11 +63,13 @@
6063
secret: "org1peer2tlspw"
6164
docker:
6265
name: peer1.org1.example.com
66+
hostname: peer1.org1.example.com
6367
port: 18055
6468
chaincode_port: 18056
6569
operations_port: 18057
6670
couchdb:
6771
name: couchdb1.org1.example.com
72+
hostname: couchdb1.org1.example.com
6873
port: 18058
6974
ibp:
7075
display_name: "Org1 Peer2"
@@ -87,6 +92,7 @@
8792
enabled: true
8893
docker:
8994
name: ca.org2.example.com
95+
hostname: ca.org2.example.com
9096
port: 19050
9197
ibp:
9298
display_name: "Org2 CA"
@@ -102,11 +108,13 @@
102108
secret: "org2peer1tlspw"
103109
docker:
104110
name: peer0.org2.example.com
111+
hostname: peer0.org2.example.com
105112
port: 19051
106113
chaincode_port: 19052
107114
operations_port: 19053
108115
couchdb:
109116
name: couchdb0.org2.example.com
117+
hostname: couchdb0.org2.example.com
110118
port: 19054
111119
ibp:
112120
display_name: "Org2 Peer1"
@@ -121,11 +129,13 @@
121129
secret: "org2peer2tlspw"
122130
docker:
123131
name: peer1.org2.example.com
132+
hostname: peer1.org2.example.com
124133
port: 19055
125134
chaincode_port: 19056
126135
operations_port: 19057
127136
couchdb:
128137
name: couchdb1.org2.example.com
138+
hostname: couchdb1.org2.example.com
129139
port: 19058
130140
ibp:
131141
display_name: "Org2 Peer2"
@@ -148,6 +158,7 @@
148158
enabled: true
149159
docker:
150160
name: ca.orderer.example.com
161+
hostname: ca.orderer.example.com
151162
port: 17050
152163
ibp:
153164
display_name: "Orderer CA"
@@ -165,6 +176,7 @@
165176
- *Org2
166177
docker:
167178
name: orderer.example.com
179+
hostname: orderer.example.com
168180
port: 17051
169181
operations_port: 17052
170182
ibp:

0 commit comments

Comments
 (0)