-
Notifications
You must be signed in to change notification settings - Fork 8
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
Upgrade to Fabric 1.0 #52
base: master
Are you sure you want to change the base?
Changes from all commits
34e1d92
53526c9
f0331d6
e8440eb
4de50a1
fa58a8f
2927c2a
a6f9ba6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,200 @@ | ||
brooklyn.catalog: | ||
version: 0.18.0-SNAPSHOT # BROOKLYN_HYPERLEDGER_VERSION | ||
version: 0.19.0-SNAPSHOT # BROOKLYN_HYPERLEDGER_VERSION | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you're going to change the version you should use the change version script as you've missed a number of places such as here |
||
|
||
publish: | ||
description: | | ||
Entities for running the Hyperledger Fabric project in Apache Brooklyn. | ||
license_code: Apache-2.0 | ||
Entities for Hyperledger Fabric. | ||
license_code: APACHE-2.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't a valid spdx code but the original was, see here. Note the same is true for other files in which this has been changed. |
||
icon_url: classpath://io.brooklyn.hyperledger:icon/hyperledger-fabric.png | ||
|
||
items: | ||
- id: hyperledger-docker-engine | ||
description: "The engine for running Docker containers" | ||
itemType: entity | ||
item: | ||
|
||
name: "Docker Engine (host)" | ||
type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess | ||
|
||
install.command: | | ||
sudo yum -y update | ||
sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' | ||
[dockerrepo] | ||
name=Docker Repository | ||
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/ | ||
enabled=1 | ||
gpgcheck=1 | ||
gpgkey=https://yum.dockerproject.org/gpg | ||
EOF | ||
sudo yum -y install docker-engine | ||
|
||
post.install.command: | | ||
# Configure Docker | ||
sudo mkdir -p /etc/systemd/system/docker.service.d | ||
echo "[Service]" | sudo tee --append /etc/systemd/system/docker.service.d/docker.conf > /dev/null | ||
echo "ExecStart=" | sudo tee --append /etc/systemd/system/docker.service.d/docker.conf > /dev/null | ||
echo 'ExecStart=/usr/bin/docker daemon -D --api-cors-header="*" --storage-driver=devicemapper -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock' | sudo tee --append /etc/systemd/system/docker.service.d/docker.conf > /dev/null | ||
|
||
sudo systemctl enable docker.service | ||
sudo systemctl daemon-reload | ||
|
||
launch.command: | | ||
sudo service docker start | ||
|
||
stop.command: | | ||
sudo service docker stop | ||
|
||
checkRunning.command: | | ||
sudo service docker status | ||
|
||
provisioning.properties: | ||
osFamily: centos | ||
minRam: 4gb | ||
installDevUrandom: true | ||
required.ports: | ||
- 22 | ||
- 4243 | ||
- 7050 | ||
- 7051 | ||
- 7052 | ||
- 7053 | ||
- 7054 | ||
- 7055 | ||
- 7056 | ||
- 7057 | ||
- 7058 | ||
- 7059 | ||
- 8080 | ||
- 9999 | ||
|
||
childStartMode: foreground_late | ||
- id: hyperledger-docker-engine | ||
description: | | ||
The Docker engine for running containers. | ||
itemType: entity | ||
item: | ||
name: "hyperledger-docker-engine" | ||
type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess | ||
|
||
brooklyn.parameters: | ||
- name: docker.package | ||
description: "Docker Package Name" | ||
type: string | ||
default: "docker-ce" | ||
- name: docker.port | ||
description: "Docker Package Number" | ||
type: integer | ||
default: 2376 | ||
|
||
brooklyn.config: | ||
shell.env: | ||
DOCKER_PACKAGE: $brooklyn:config("docker.package") | ||
HOST_ADDRESS: $brooklyn:attributeWhenReady("host.address") | ||
DOCKER_PORT: $brooklyn:config("docker.port") | ||
|
||
install.command: | | ||
sudo yum -y update | ||
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 | ||
sudo yum-config-manager --add-repo \ | ||
https://download.docker.com/linux/centos/docker-ce.repo | ||
sudo yum-config-manager --enable extras | ||
sudo yum-config-manager --enable epel-testing | ||
sudo yum install -y ${DOCKER_PACKAGE} | ||
|
||
post.install.command: | | ||
echo "[HLF] docker installed" | ||
|
||
customize.command: | | ||
sudo tee /etc/docker/daemon.json <<EOF | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The file
Adding |
||
{ | ||
"debug": true, | ||
"hosts": [ | ||
"unix://var/run/docker.sock", | ||
"tcp://0.0.0.0:${DOCKER_PORT}" | ||
], | ||
"labels": [ | ||
"org.apache.brooklyn.entity=hyperledger-docker-engine" | ||
] | ||
} | ||
EOF | ||
|
||
launch.command: | | ||
sudo service docker start | ||
echo "[HLF] docker started" | ||
|
||
stop.command: | | ||
sudo service docker stop | ||
|
||
checkRunning.command: | | ||
sudo service docker status | ||
|
||
provisioning.properties: | ||
osFamily: centos | ||
minRam: 4gb | ||
installDevUrandom: true | ||
required.ports: | ||
[ 22, 4243, 7050, 7051, 7052, 7053, 7054, 7055, 7056, 7057, 7058, 7059, 8080, 8888, 9999 ] | ||
|
||
childStartMode: foreground_late | ||
|
||
- id: hyperledger-docker-container | ||
description: | | ||
The Docker container for running Hyperledger images. | ||
itemType: entity | ||
item: | ||
type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess | ||
name: "hyperledger-docker-container" | ||
|
||
brooklyn.parameters: | ||
- name: hyperledger.version | ||
description: "Hyperledger Version" | ||
type: string | ||
default: "1.0.3" | ||
- name: container.name | ||
description: "Container Name" | ||
type: string | ||
constraints: | ||
- required | ||
|
||
brooklyn.config: | ||
shell.env: | ||
ENTITY_ID: $brooklyn:entityId() | ||
HYPERLEDGER_VERSION: | ||
$brooklyn:formatString: | ||
- "x86_64-%s" | ||
- $brooklyn:config("hyperledger.version") | ||
DOCKER_PORT: $brooklyn:config("docker.port") | ||
CONTAINER_NAME: $brooklyn:config("container.name") | ||
|
||
post.install.command: | | ||
echo "[HLF] container ${ENTITY_ID} installed" | ||
|
||
stop.command: | | ||
sudo docker rm -f ${CONTAINER_NAME} | ||
|
||
checkRunning.command: | | ||
STATUS=$(sudo docker inspect -f {{.State.Running}} ${CONTAINER_NAME}) | ||
sudo service docker status && [ "${STATUS}" = "true" ] | ||
|
||
- id: hyperledger-fabric-composer-node | ||
description: | | ||
A Hyperledger Fabric Composer CLI installation | ||
itemType: entity | ||
item: | ||
type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess | ||
name: "hyperledger-fabric-composer-node" | ||
|
||
brooklyn.config: | ||
#templates.install: | ||
# "classpath://io.brooklyn.hyperledger:hyperledger/fabric-composer-templates/connection-template.json": "connection.json" | ||
|
||
shell.env: | ||
INSTALL_DIR: $brooklyn:attributeWhenReady("install.dir") | ||
|
||
install.command: | | ||
curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash | ||
sudo yum -y update | ||
sudo yum -y install git nodejs gcc-c++ python | ||
sudo npm install -g composer-cli | ||
sudo npm install -g generator-hyperledger-composer | ||
sudo npm install -g composer-rest-server | ||
sudo npm install -g yo | ||
sudo npm install -g composer-playground | ||
|
||
launch.command: | | ||
echo "No-op launch.command" | ||
|
||
checkRunning.command: | | ||
which composer | ||
|
||
provisioning.properties: | ||
osFamily: centos | ||
minRam: 4gb | ||
installDevUrandom: true | ||
required.ports: | ||
- 22 | ||
- 3000 | ||
|
||
brooklyn.initializers: | ||
- type: org.apache.brooklyn.core.effector.ssh.SshCommandEffector | ||
brooklyn.config: | ||
name: "Run Getting Started Application" | ||
description: "Creates and deploys the business network and runs the Getting Started application" | ||
|
||
shell.env: | ||
INSTALL_DIR: $brooklyn:attributeWhenReady("install.dir") | ||
|
||
command: | | ||
git clone https://github.com/hyperledger/composer-sample-applications.git | ||
cd composer-sample-applications/packages/getting-started | ||
|
||
sed -i 's| "install": "scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork"||g' package.json | ||
sed -i 's|DJY27pEnl16d",|DJY27pEnl16d"|g' package.json | ||
npm install || true | ||
|
||
mkdir -p ~/.composer-credentials | ||
mkdir -p ~/.composer-connection-profiles/defaultProfile | ||
|
||
sed -i "s|brooklyn-managed-processes||g" ${INSTALL_DIR}/connection.json | ||
cp ${INSTALL_DIR}/connection.json ~/.composer-connection-profiles/defaultProfile | ||
|
||
composer archive create --sourceName digitalproperty-network --sourceType module --archiveFile digitalPropertyNetwork.bna | ||
composer network deploy --archiveFile digitalPropertyNetwork.bna --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d | ||
composer network list -n digitalproperty-network --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d | ||
|
||
npm test | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why run the tests here? |
||
|
||
nohup composer-rest-server -p defaultProfile -n digitalproperty-network -i WebAppAdmin -s DJY27pEnl16d > compose-rest-server.out 2>&1& | ||
|
||
brooklyn.enrichers: | ||
- type: org.apache.brooklyn.enricher.stock.Transformer | ||
brooklyn.config: | ||
uniqueTag: rest-server-address-generator | ||
enricher.sourceSensor: $brooklyn:sensor("host.address") | ||
enricher.targetSensor: $brooklyn:sensor("hyperledger.compose.url") | ||
enricher.targetValue: | ||
$brooklyn:formatString: | ||
- "%s:%d%s" | ||
- $brooklyn:attributeWhenReady("host.address") | ||
- 3000 | ||
- "/explorer" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This catalog.bom needs to be at the root of the project