-
Notifications
You must be signed in to change notification settings - Fork 0
/
catalog.bom
285 lines (251 loc) · 10.1 KB
/
catalog.bom
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
brooklyn.catalog:
version: 0.1.0-SNAPSHOT
publish:
description: |
Entities for running the Hyperledger Cello project in Apache Brooklyn.
license_code: Apache-2.0
icon_url: https://github.com/hyperledger/cello/raw/master/docs/imgs/logo.png
items:
- id: hyperledger-cello-cluster-template
description: |
A Hyperledger Cello cluster of a master node and worker nodes.
name: "Hyperledger Cello Cluster"
iconUrl: https://github.com/hyperledger/cello/raw/master/docs/imgs/logo.png
itemType: template
item:
services:
- type: hyperledger-cello-cluster-application
name: "Hyperledger Cello Cluster"
- id: hyperledger-cello-cluster-application
description: |
A Hyperledger Cello cluster of a master node and worker nodes.
publish:
license_code: Apache-2.0
overview: README.md
name: "Hyperledger Cello Cluster"
iconUrl: https://github.com/hyperledger/cello/raw/master/docs/imgs/logo.png
itemType: entity
item:
type: org.apache.brooklyn.entity.stock.BasicApplication
brooklyn.parameters:
- name: num.worker.nodes
label: "Number of Worker Nodes"
description: |
The number of Cello worker nodes to create.
type: integer
default: 3
constraints:
- required
- name: worker.capacity
label: "Capacity Per Worker"
description: |
The max number of peers that can be created on each worker node.
type: integer
default: 10
- name: peer.logging.level
label: "Peer Logging Level"
description: |
The logging level to be run by the peer nodes.
type: string
default: "DEBUG"
- name: worker.schedulable
label: "Worker Schedulable"
description: |
Whether the worker is schedulable for a cluster request.
type: boolean
default: false
- name: worker.autofill
label: "Worker Autofill"
description: |
Whether the worker will be automatically filled.
type: boolean
default: false
brooklyn.enrichers:
- type: org.apache.brooklyn.enricher.stock.Transformer
brooklyn.config:
uniqueTag: cello-main-uri-publisher
enricher.producer: $brooklyn:component("my-hyperledger-cello-master-node")
enricher.triggerSensors:
- $brooklyn:sensor("service.isUp")
- $brooklyn:sensor("host.address")
enricher.targetSensor:
$brooklyn:sensor("org.apache.brooklyn.core.entity.Attributes", "main.uri")
enricher.targetValue:
$brooklyn:formatString:
- "http://%s:8080"
- $brooklyn:component("my-hyperledger-cello-master-node").attributeWhenReady("host.address")
brooklyn.children:
- type: hyperledger-cello-master-node
name: "Hyperledger Cello Master Node"
id: my-hyperledger-cello-master-node
- type: hyperledger-cello-worker-cluster
name: "Hyperledger Cello Worker Cluster"
id: my-hyperledger-cello-worker-cluster
- id: hyperledger-cello-master-node
description: "A Hyperledger Cello master node"
itemType: entity
item:
type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
name: "Cello Master Node"
brooklyn.config:
provisioning.properties:
osFamily: ubuntu
imageNameRegex: ".*16.04.*"
minRam: 4gb
required.ports:
- 22
- 80
- 8080
- 27017
- 27018
shell.env:
INSTALL_DIR: brooklyn:attributeWhenReady("install.dir")
install.command: |
sudo apt-get update -y
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
sudo apt-get update -y
sudo apt-cache policy docker-engine
sudo apt-get install -y docker-engine git make
sudo systemctl status docker
sudo docker pull python:3.5 \
&& sudo docker pull mongo:3.2 \
&& sudo docker pull yeasy/nginx:latest \
&& sudo docker pull mongo-express:0.30
git clone https://github.com/hyperledger/cello.git
cd cello
sudo make setup
launch.command: |
cd ${INSTALL_DIR}/cello
sudo make restart
checkRunning.command: |
# TODO: Improve check logic
sudo service docker status
- id: hyperledger-cello-worker-cluster
description: "A cluster of Hyperledger Cello worker nodes"
name: "Hyperledger Cello Worker Cluster"
item:
type: org.apache.brooklyn.entity.group.DynamicCluster
brooklyn.config:
initialSize: $brooklyn:config("num.worker.nodes")
memberSpec:
$brooklyn:entitySpec:
type: hyperledger-cello-worker-node
name: "Hyperledger Cello Worker Node"
brooklyn.config:
provisioning.properties:
osFamily: ubuntu
imageNameRegex: ".*16.04.*"
minRam: 4gb
required.ports:
- 22
- 2375
- 7050
- 7051
- 7052
- 7053
- 7054
- 7055
- 7056
- 7057
- 7058
- 7059
launch.latch: $brooklyn:component("my-hyperledger-cello-master-node").attributeWhenReady("service.isUp")
- id: hyperledger-cello-worker-node
description: "A Hyperledger Cello worker node"
itemType: entity
item:
type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
name: "Cello Worker Node"
brooklyn.config:
name:
$brooklyn:formatString:
- "docker_host_%d"
- $brooklyn:config("cluster.member.id")
master.endpoint:
$brooklyn:formatString:
- "http://%s:8080/api/host"
- $brooklyn:component("my-hyperledger-cello-master-node").attributeWhenReady("host.address")
shell.env:
NAME: $brooklyn:config("name")
DAEMON_URL: $brooklyn:attributeWhenReady("daemon.url")
CAPACITY: $brooklyn:config("worker.capacity")
LOG_TYPE: "local"
LOG_LEVEL: $brooklyn:config("peer.logging.level")
AUTOFILL: $brooklyn:config("worker.autofill")
SCHEDULABLE: $brooklyn:config("worker.schedulable")
MASTER_ENDPOINT: $brooklyn:config("master.endpoint")
install.command: |
sudo apt-get update -y
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
sudo apt-get update -y
sudo apt-cache policy docker-engine
sudo apt-get install -y docker-engine
sudo systemctl stop docker
sudo mkdir -p /etc/systemd/system/docker.service.d/
sudo -E tee /etc/systemd/system/docker.service.d/docker.conf <<-EOF
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket firewalld.service
Requires=docker.socket
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
EnvironmentFile=-/etc/default/docker
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock --api-cors-header='*' --default-ulimit=nofile=8192:16384 --default-ulimit=nproc=8192:16384
LimitNOFILE=1048576
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker.service
sudo systemctl status docker
sudo docker pull hyperledger/fabric-peer:x86_64-0.6.1-preview \
&& sudo docker pull hyperledger/fabric-membersrvc:x86_64-0.6.1-preview \
&& sudo docker pull yeasy/blockchain-explorer:latest \
&& sudo docker tag hyperledger/fabric-peer:x86_64-0.6.1-preview hyperledger/fabric-peer \
&& sudo docker tag hyperledger/fabric-peer:x86_64-0.6.1-preview hyperledger/fabric-baseimage \
&& sudo docker tag hyperledger/fabric-membersrvc:x86_64-0.6.1-preview hyperledger/fabric-membersrvc
launch.command: |
if [ $AUTOFILL == 'true' ]
then
AF='on'
else
AF='off'
fi
if [ $SCHEDULABLE == 'true' ]
then
SCHED='on'
else
SCHED='off'
fi
curl -X POST -u admin:pass \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "name=$NAME&daemon_url=$DAEMON_URL&capacity=$CAPACITY&log_level=$LOG_LEVEL&log_type=$LOG_TYPE&autofill=$AF&schedulable=$SCHED&log_server=" \
$MASTER_ENDPOINT
checkRunning.command: |
# TODO: Improve check logic
sudo systemctl status docker
brooklyn.enrichers:
- type: org.apache.brooklyn.enricher.stock.Transformer
brooklyn.config:
enricher.sourceSensor: $brooklyn:sensor("host.address")
enricher.targetSensor: $brooklyn:sensor("daemon.url")
enricher.targetValue: $brooklyn:formatString("%s:%s", $brooklyn:attributeWhenReady("host.address"), "2375")