Skip to content

Commit

Permalink
description for dapps, host names and container linking
Browse files Browse the repository at this point in the history
  • Loading branch information
Björn Lakeberg committed Mar 30, 2016
1 parent 02389aa commit d29b569
Showing 1 changed file with 71 additions and 22 deletions.
93 changes: 71 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# meteor-nodejs
Based on Offical CentOS image from **centos:centos7**

This Dockerfile stands for a **JavaScript Runtime and App Platform** where you can develop decentralized applications bundled as single html file connected to an running ethereum node with **JavaScript web3 API** communicating internally via **JSON RPC API**.
This Dockerfile stands for a **JavaScript Runtime and App Platform** where you can develop decentralized applications (Dapps) bundled as single html file connected to an running ethereum node with **JavaScript web3 API** communicating internally via **JSON RPC API**.

Image size: 860,3 MByte
Image size: 1.042 GByte

## Installed packages
* openssh-server
* sudo
* passwd
* nodejs
* nodejs *(with solc and meteor-build-client)*
* meteor
* meteor-build-client

## Building & Running
Pull from dockerhub:
Expand All @@ -32,10 +31,17 @@ You can choose to run this container with or without a link to an Ethereum clien
#### with geth
Container blakeberg/ssh:geth-node exists and is running.

docker run -d --name meteor -p 10022:22 -p 3000:3000 --link=geth:geth blakeberg/meteor-nodejs
docker run -d -h meteor --name meteor -p 10022:22 -p 3000:3000 --link=geth:geth blakeberg/meteor-nodejs

> You will need this link for developing decentralized applications with Ethereum.
### Connect
If you are connected to this container you can connect to linked container `geth` too.
If you are connected to this container you can connect to linked container `geth` too.

> If you us boot2docker you shoud add to your /etc/hosts under Windows or Mac OS X the IP and host name of the boot2docker VM `192.168.99.100 meteor` (IP to verify)
>If you have an issue with cross origin requests you can allow all domains with parameter `--rpccorsdomain "*"` and if you can't connect to geth node you can allow all adresses with parameter `--rpcaddr "0.0.0.0"`. Both parameters can be set with geth command see container geth-node *(link below)*
#### to this container
Connect with ssh use the port that was just located:

Expand All @@ -55,37 +61,80 @@ If Ethereum node on geth is running you will get a JSON Response
{"id":67,"jsonrpc":"2.0","result":"Geth/v1.3.5/linux/go1.5.1"}

## Meteor
JavaScript App Platform used for creating decentralized Apps (dapps) with Ethereum.
Meteor is a full stack JavaScript App Platform used for creating Apps and Dapps (in case of Blockchain / Ethereum).

### First App
Create a new dummy app within a running container.
### Sample App
Create a new dummy-app within a running container.

1. connect with ssh
2. create app dummy: `meteor create dummy` (first meteor is installing)
3. change dir: `cd dummy`
2. create app dummy: `meteor create --release 1.2.1 dummy-app` *(first meteor is installing)*
3. change dir: `cd dummy-app`
4. start app dummy: `nohup meteor &`
5. show app in browser: `http://localhost:3000`
5. show app in browser: `http://meteor:3000`

> if you use boot2docker, docker is configured to use the default machine with IP 192.168.99.100
**For a more sophisticated example complete the todo app!** *(link below)*

### Sample Dapp
A Dapp contains one or more contracts and a graphical user interface (UI) to handle it. There are some packages for Meteor includig UI you can simply use for that purpose.

#### create own
Create a new dummy-dapp within a running container.

1. connect with ssh
2. create app dummy: `meteor create --release 1.2.1 dummy-dapp` *(first meteor is not installing if you done the dummy-app before)*
3. change dir: `cd dummy-dapp`
4. install meteor packages for ethereum *(every package show its dependencies and a description if available)*
* Ethereum JS API: `meteor add ethereum:web3`
* helper functions: `meteor add ethereum:tools`
* basic ui elements: `meteor add ethereum:elements`
* CSS/LESS framework for dapps: `meteor add ethereum:dapp-styles` needs also `meteor add less`
* Ethereum Accounts: `meteor add ethereum:accounts`
* Ethereum Blocks: `meteor add ethereum:blocks`
5. add line `@import '{ethereum:dapp-styles}/dapp-styles.less';` to `dummy-dapp.css`
6. rename `mv dummy-dapp.css dummy-dapp.less`
7. start app dummy: `nohup meteor &`
8. everything you edit in js, html, css will changed directly in your browser `http://meteor:3000` *(you can only run one meteor instance on that port)*
9. Try some stuff from ethereum packages *(link below)*

### Bundle App
#### run example
This example is included in this container and show at least on use case for each Meteor package for Ethereum.

With Meteor Build Client you can bundle the client part of a Meteor app with a simple index.html, so it can be hosted on any server or even loaded via the file:// protocol.
1. run step 1-8 of create own sample dapp
2. copy files `cp ~/dummy-dapp.* .`
3. show again in your browser `http://meteor:3000` *(should updated immediately)*

> You see see the result "Hello World!" from sample contact "Greeter" `greeter.greet()` as example in container geth-node *(link below)*
### Bundle (D)Apps

With Meteor Build Client you can bundle the client part of a Meteor app with a simple index.html and javascript (and maybe css and images), so it can be hosted on any server or even loaded via the file:// protocol.

> Note that the Build Client could not executed successful for Meteor 1.3 projects so that is the reason why there built with option `--release 1.2.1`
**There is no need for centralized server!**

1. connect with ssh
2. change dir: `cd dummy`
3. bundle app: `meteor-build-client ../dummy-bundled`
4. change dir: `cd ../dummy-bundled`
5. `chmod g+x` for created js file
1. connect with ssh
2. change dir: `cd dummy-app`
3. bundle app: `meteor-build-client ../bundled-dummy-app -p ""`
4. change dir: `cd ../bundled-dummy-app` and see *(there is only a html and js file)*
5. change dir: `cd ~/dummy-dapp`
6. bundle dapp: `meteor-build-client ../bundled-dummy-dapp -p ""`
7. change dir: `cd ../bundled-dummy-dapp` and see *(there is an additional css file and packages folder with images inside)*

See bundled (d)apps examples:

- <https://github.com/blakeberg/meteor-nodejs/tree/master/bundled-dummy-app>
- <https://github.com/blakeberg/meteor-nodejs/tree/master/bundled-dummy-dapp>

See example <https://github.com/blakeberg/meteor-nodejs/tree/master/bundled-dummy-app>
>You can download these files and run via the file:// protocol. The dapp need a running geth-node *(link below)*
## Useful Links
* Meteor Example App Handson <https://www.meteor.com/tutorials/blaze/creating-an-app>
* Install Meteor <https://www.meteor.com/install>
* Meteor API <http://docs.meteor.com/#/basic/>
* Meteor Build Client <https://github.com/frozeman/meteor-build-client>
* Ethereum Dapp using Meteor <https://github.com/ethereum/wiki/wiki/Dapp-using-Meteor>
* Ethereum Meteor Packages <https://atmospherejs.com/ethereum>
* Ethereum JavaScript web3 API <https://github.com/ethereum/web3.js/tree/master> and <https://github.com/ethereum/wiki/wiki/JavaScript-API>
* Ethereum JSON RPC API <https://github.com/ethereum/wiki/wiki/JSON-RPC>
* Ethereum JSON RPC API <https://github.com/ethereum/wiki/wiki/JSON-RPC>
* Ethereum Container <https://github.com/blakeberg/geth-node>

0 comments on commit d29b569

Please sign in to comment.