How do I deploy .BNA file on IBM cloud blockchain 2.0 resource? - kubernetes

I am trying to set up a rest API that is connected to an IBM blockchain resource. I have developed a model file, logic file, and acl file.
I have it all packed up in a nice tidy .BNA, and now i would like to deploy it to a channel of my IBM cloud blockchain 2.0 resource, running on a free kubernetes cluster.
Everything on the cloud blockchain resource is set up perfectly, and all orgs, peers, orderers, msps, and CAs are set up correctly. The channel is set up properly, and has nodes and an MSP connected. I have all the admin cred .jsons
The channel only accepts smart contract files, so I tried repackaging the files (logic.js, permissions.acl, and model.cto) by putting them in a contract folder, and using the IBM Blockchain vsCode plugin to package them as a smart contract, but trying to install on the IBM cloud crashes the browser.
I am thinking maybe I have to remote connect into the IBM kubernetes cluster that the blockchain resource is sitting on, and use the hyperledger composer CLI to install the .BNA
Seems very unintuitive, but thats the one thing I can think to try while I wait for this question to get answered.
I expected to just be able to install the .BNA as a smart contract, like a .cds.

In August 2018, IBM announced that we are no longer investing in Hyperledger Composer, and instead focusing 100% on Hyperledger Fabric. As a result, IBM Blockchain Platform v2.0 will not provide any support or tooling around Hyperledger Composer.
The good news is that we've significantly invested in the programming model (APIs and SDKs) used to write smart contracts and applications in Fabric v1.4, and we've also released some great developer tooling in the form of an extension for Visual Studio Code: https://marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm-blockchain-platform
The extension offers an extensive set of capabilities for writing smart contracts - with tooling for creating new projects, packaging them, deploying them, testing them, and debugging them - all from within one of the most popular IDEs around.
To get started - just install Visual Studio Code, and then the IBM Blockchain Platform extension (there are a few prereqs, check the README first). After that, you will be presented with a homepage that links you to tutorials and samples to help you get started.

For the first one, I can't really suggest a solution. At best, try installing and using the composer CLI and the latest version to make the bna file. Composer playground isn't maintained as well imo.
For the second part, in the connection.json file and docker there will be a bunch of IP addresses that look something like localhost:7040 and so on for the CA, orderer, org and peer. You will need to replace these using the IPs given by IBM. The examples on github that demonstrate integration are to do with nodejs SDK and not composer, however you can refer to https://github.com/IBM-Blockchain/vehicle-manufacture to get the idea.
This link is the only I could find for Hyperledger Composer and IBM platform.
(comments were getting too long to fit)

Related

Hyperledger Console usability

I'm tasked with creating a hyperledger application that will represent a consortium of same-skilled organizations.
I have the barebones prototype with a network of 2 orgs, built by following the fabric-samples example that I created as a capstone project; I am looking to upgrade the application to a production level.
My question is, is there a GUI/platform available to create and maintain hyperledger fabric networks?
What are the alternatives for tools like the Console?
What would be the best way to start building such an application considering the goal is to get to the production level?
Is IBM Cloud Blockchain Platform the best option for me?
Thank you for taking the time to reply.
I know of Hyperledger Console. I have used it previously for school projects. But can it be used to create and maintain+govern a production-grade HLF app?
IBM Blockchain Platform on IBM Cloud is withdrawn (https://www.ibm.com/common/ssi/cgi-bin/ssialias?htmlfid=872/ENUSWP22-0062&infotype=AN&subtype=CA). But the console is open sourced as https://github.com/hyperledger-labs/fabric-operations-console

How to deploy code to IBM Cloud using DevOps approach?

Can somebody bring some light in IBM Cloud deployments tools / platforms whatever?
I am new to it, so I am looking at their docs, watching videos and still i am confused.
What I want to achieve is typical scenario fetch code from repo, build it, test it, deploy it to cloud. I found strategies / platforms how to achieve that and i still can't see differences advantages / disadvantages between them.
So we have:
toolchain
cloud foundry
code engine
Continuous Delivery (service)
and maybe something more? :)
I am looking at Cloud Foundry explained video and the guy is saying if you want to do not care about the bottom part like networking, security, containers you can choose deploy using K8S service. Wtf? So from total automatic thing you can now handle something in the cloud foundry by yourself. So for me its total mix of everything together and i don't know now which tool / platform / strategy to use.
Any comment is appreciated.
It all depends on your requirements.
IBM DevOps/Continuous Delivery/Toolchanis is set of services that can build and deploy your application to given runtime. You can find various tutorials here - https://www.ibm.com/cloud/architecture/courses/toolchain-tutorials. These tutorials shows you various things that you can embed in your build pipelines (like code scanning with CRA, image scanning, signing etc)
These runtimes can be different depending on your requirements:
CloudFoundry, where you deploy app using a buildpak, but this is rather fading technology, so I wouldn't recommend that
as docker image in K8s/OpenShift cluster - use this if your organization is planning or already utilizing Docker/Kubernetes/OpenShift. You will need to create K8s/OpenShift cluster first.
as serverless app, using the IBM Code Engine
If you are just starting and just want to deploy simple, single app to the Cloud I'd consider using IBM Code Engine and not investigate Toolchains for now. Check basic demo here - How to deploy source code with IBM Cloud Code Engine

Can't find Blockchain Cloud Foundry app

I followed the instructions on IoT Asset Tracking on a Hyperledger Blockchain . BUILD and DEPLOY finished successfully, but I can't find the composer-rest-server- app under Cloud Foundry Applications.
I can use the CF Blockchain services, enter the Monitor and open the Swagger UI. The question is, where can I find the application-specific APIs mentioned in the tutorial:
If everything deployed correctly, you can find the app in the IBM Cloud dashboard at https://console.bluemix.net. If you have many apps and services deployed, make sure to filter correctly or to be aware of paging.
If you suspect that something got wrong during build and deploy, go to the toolchain and check the logs. The toolchains can also be reached from the dashboard.

How to integrate Watson IOT service to Hyperledger Fabric?

Due to IBM doesn't provide free plan for IBM Blockchain anymore, I come up with with solution to integrate Watson IOT to Hyperledger Fabric instead of IBM Blockchain.
I found this document, it say that Watson IoT Platform blockchain integration supports connecting to both IBM Blockchain fabrics and Hyperledger fabrics
(in section Config Blockchain IBM environment)
But I can not find any guideline.
Anyone can help?
I have several related comments:
1) The page you linked to shows an early version of the IoT Contract Platform that I authored. I have not been funded to port it to Hyperledger v1 so it must be considered deprecated at this time. Instead, I suggest that you get comfortable with the Hyperledger Composer, which provides a huge development environment and a powerful data modelling language.
https://hyperledger.github.io/composer/introduction/introduction.html
2) Which leads me to IBM's free container service. If you want to get started with IBM Blockchain on Bluemix, you can create a free kubernetes cluster using the instructions found here.
https://ibm-blockchain.github.io/
The "create_all" script gives you a working fabric on a lite cluster (as in free) with hyperledger composer running (with playground) and with a copy of the example02 ubiquitous sample Go chaincode running on the same channel.
https://github.com/IBM-Blockchain/ibm-container-service
EDIT: As for the iot connection, you can use node-red to create iot apps that will catch your events on a topic and then forward them to the blockchain. This is for experimentation of course, but you will get the idea how an application must be written.
If you want to follow my "partial state as event" pattern in composer contracts, you can look at the deep-merge npm project and mimick that code while we wait for the node based chaincode that is coming in Fabric 1.1, at which time I hope that we can import it as normal in our business network js files.
Using deep-merge requires that you create your own transactions for create, replace, update and delete in your smart contracts, but these are straightforward. The bonus is that it is also easy then to emit custom events defining what happened to listening applications.
I think you will like these two technologies together.
Instead of using the IBM Blockchain, you should create your own Blockchain. You should use the Hyperledger Fabric for that. You have the documentacion about it here. I suggest you to start reading from the Building Your First Network chapter.
Then, you should integrate your Blockchain with the Watson IoT.

Heroku-like services for Scala?

I love Heroku but I would prefer to develop in Scala rather than Ruby on Rails.
Does anyone know of any services like Heroku that work with Scala?
UPDATE: Heroku now officially supports Scala - see answers below for links
As of October 3rd 2011, Heroku officially supports Scala, Akka and sbt.
http://blog.heroku.com/archives/2011/10/3/scala/
Update
Heroku has just announced support for Java.
Update 2
Heroku has just announced support for Scala
Also
Check out Amazon Elastic Beanstalk.
To deploy Java applications using
Elastic Beanstalk, you simply:
Create your application as you
normally would using any editor or IDE
(e.g. Eclipse).
Package your
deployable code into a standard Java
Web Application Archive (WAR file).
Upload your WAR file to Elastic
Beanstalk using the AWS Management
Console, the AWS Toolkit for Eclipse,
the web service APIs, or the Command
Line Tools.
Deploy your application.
Behind the scenes, Elastic Beanstalk
handles the provisioning of a load
balancer and the deployment of your
WAR file to one or more EC2 instances
running the Apache Tomcat application
server.
Within a few minutes you will
be able to access your application at
a customized URL (e.g.
http://myapp.elasticbeanstalk.com/).
Once an application is running,
Elastic Beanstalk provides several
management features such as:
Easily deploy new application versions
to running environments (or rollback
to a previous version).
Access
built-in CloudWatch monitoring metrics
such as average CPU utilization,
request count, and average latency.
Receive e-mail notifications through
Amazon Simple Notification Service
when application health changes or
application servers are added or
removed.
Access Tomcat server log
files without needing to login to the
application servers.
Quickly restart
the application servers on all EC2
instances with a single command.
Another strong contender is Cloud Foundry. One of the nice features of Cloud Foundry is the ability to have a local version of "the cloud" running on your laptop so you can deploy and test offline.
I started working on the exact same thing as what you said a few weeks ago. I use Lift, which is a great framework and has a lot of potential, on top of Linux chroot environment.
I'm done with a demo version, but Linux chroot is not that stable (nor secure), so I'm now switching to FreeBSD jail on Amazon EC2, and hopefully it'll be done soon.
http://lifthub.net/
There are also other Java hosting environment including VMForce mentioned above.
If you are looking for a custom setup which also has the ease of deployment that heroku offers: http://dotcloud.com. They are invite only right now but I was given access in under three days. I am working on a Lift/MongoDB project there and it works well.
Off the top of my head, only VMForce comes to mind, but its not available yet. This will be a Java-oriented service, so that probably means you'll have to spend a wee bit of time figuring out how to package the app.
For more discussion, there was a debate about this in 2008.
I'm not entirely sure if it's really suitable or not, but people have deployed Scala applications to Google App Engine, for example http://mawson.wordpress.com/2009/04/10/first-steps-with-scala-on-google-app-engine/
Actually you can run scala on heroku right now. You don't believe it?
https://github.com/lstoll/heroku-playframework-scala
I'm not sure the tricks lstoll has used are legit but using the
new cedar platform where you can run custom processes and some
ingenious Gemfile hacking he has managed to bootstrap the Java
play platform into a process. Seems to work as he has a live
site running a test page.
Stax cloud service offers preconfigured lift project skeleton. Also, there is a tutorial on how to deploy lift project to appengine.