-
1Install
One way to get started is by installing the SDK. Let us start by running:
npm install decentralized-internet
-
2cd into the module
$ cd node_modules $ cd decentralized-internet $ ls
-
3Look at the components
Now, multiple folders are setup for routing, but the easiest folder to cd into for looking at the components is addon so:
$ cd addon $ ls
Now you can see there are four main components to this project:
- CluserPost
- GridBee
- LNRChain
- Reinvent the Internet
Those are the core folder/component names of what we will be looking at.
-
4What is Clusterpost?
Clusterpost is a grid computing tool that allows you to offload processes to a CouchDB database. However, for this SDK the migration is suggesting to use BigChainDB over CouchDB on the basis of decentralization opportunities. Clusterpost is also utilized for remotely scheduling and executing computational processes.
Here you can look at the code so:
$ cd clusterpost $ sudo ./setUpDevelopment.sh $ sudo nano conf.production.json
-
5Look at and change the Clusterpost configs
Let us start with looking at the following configs in the conf.production.json file
"host": "localhost", "port": 8180, "plugins": { "vision": {}, "inert": {}, "lout": {}, "h2o2": {}, "hapi-auth-jwt": {}, "clusterpost-auth": { "privateKey": "someRandomKey", "saltRounds": 10, "algorithm": { "algorithm": "HS256" }, "algorithms": { "algorithms": [ "HS256" ] },
Here, you see the default port it should run on is 8180, you are welcome to change that if needed or open the port. Also you see the plugins or default NPM packages the production environment uses and the default algorithm for clusterpost’s authentication.
Next let us change the credentials as needed:
}, "mailer": { "nodemailer": "nodemailer-stub-transport", "from": "clusterpost server <insertemail@here.com>", "message": "Hello @USERNAME@,<br>Somebody asked me to send you a link to reset your password, hopefully it was you.<br>Follow this <a href='@SERVER@/public/#/login/reset?token=@TOKEN@'>link</a> to reset your password.<br>The link will expire in 30 minutes.<br>Bye." }, "userdb" : { "hostname": "http://localhost:5984", "database": "clusterjobs" } },
You need to setup the login either through nodemailer or the database program you are using and change the credentials so that clusterpost will be able to authenticate into the database.
-
6Running the first tests
Next while running the database you could run some tests, so:
$ cd test $ nautilus .
You are free to look into the configs and test code as needed, but you can get started testing the default setup right away running:
npm run
ornode filename.js
A good example would be
$ cd test $ node createNewJob.js
-
7The GridBee Framework
Now, let us take a look at the GridBee Framework, which is an open source library that allows web browsers to act as clients and communicate with BOINC. It is coded in JavaScript and the HaXe programming language.
Make sure to download HaXe and FlashDevelop. FlashDevelop is an IDE but is needed to compile the project file GridBee.hxproj.
-
8Make sure you are in the right folder
If you are still in the clusterpost test folder then here is what to run in the terminal:
$ cd ../ $ cd ../ $ cd gridbee-framework-old $ cd GridBee $ nauilus .
-
9Build project file
Now you can see the project file GridBee.hxproj, right click it to open w/ FlashDevelop and press F8 to build.
-
10Optional Merge
You can also merge local storage with the BigChainDB that clusterpost is utilizing, and http requests to offload processes from your application and start optimally building a pipeline, but this is beyond the scope of this introduction.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.