Deploying Hyperledger Composer Playground to Bluemix


Since I’ve been deploying my own variations of Composer Playground to Bluemix recently, I thought it might be worth jotting down a few notes for anyone else who wants to do the same. For example, it might be useful to have your own known level of the Playground if you’re giving demos, to avoid any new functionality from the weekly releases causing surprises.

Assuming that you already have a working Composer development environment, a Bluemix account, and the Cloud Foundry CLI installed, here’s how…

First you need the main Composer repository if you don’t have it already

git clone https://github.com/hyperledger/composer.git

 

Next, checkout the code you want to deploy. In most cases you’ll want a release that’s been through one of our weekly release parties. I’ve picked the v0.14.2 release here

cd composer
git checkout -b v0.14.2-deploy v0.14.2

 

Get lerna to do its thing

lerna bootstrap

 

Now build the playground

cd packages/composer-playground
npm run build:prod

 

Create a manifest.yml file for your application with the following content

---
  command: node cli.js
  instances: 2
  memory: 128M
  env:
    COMPOSER_CONFIG: '{"webonly":true}'

 

Log in to Bluemix (you may need to use the –sso option)

cf login

 

Push the new app

cf push <APP_NAME>

 

Enjoy!

Advertisement

Game on for Fabric Composer


Earlier in the week I was pondering some blockchain gamification with @howard_is, inspired by a recent GameOn challenge for early professionals in IBM. After helping out with a run through of the IBM InterConnect Fabric Composer lab this morning, it seemed like a good opportunity to make a start.

BlueBlockAlone

Instead of running yet another car auction, I think it could be fun to have a demo based on a ‘business’ network for playing games. To keep some similar elements to the more common trading examples, I’m currently wondering if keeping tabs on multi-player adventure games would work. This is the model I’ve come up with so far, and it seems like something that could be hooked up to a simple text based (powered by Watson Conversation of course!) or graphical game interface.


/**
* Defines a data model for a multi-player game
*/
namespace org.example.game
enum ItemType {
o POTION
o WEAPON
}
asset Item identified by itemId {
o String itemId
o String name
o ItemType type
–> Player owner optional
}
asset Trophy identified by trophyId {
o String trophyId
o String name
–> Player owner optional
}
asset Game identified by gameId {
o String gameId
o Player[] players
–> Trophy prize
}
participant Player identified by characterName {
o String characterName
}

If you’re interested in playing with your own blockchain network, fire up the Fabric Composer Playground and have a go. If you want to know more @danielselman will be at InterConnect next week, or get in touch with the community. Better yet, join in!