Skip to content

Commit

Permalink
Better doc
Browse files Browse the repository at this point in the history
  • Loading branch information
le99 committed May 1, 2021
1 parent 86e696d commit 8bd5271
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 148 deletions.
159 changes: 11 additions & 148 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,161 +26,24 @@ npm install --global --production windows-build-toolsnpm config set msvs_version

## docker-compose



```bash
cd ./docker-compose
./init.sh
./up.sh
cd
```

```bash
#Run Sawtooth transaction processor
cd ./tp
npm install
rm ./.env
cp ./.env.docker-compose ./.env
node ./index.js
cd -


```

Mongo Express to see mongodb:
http://localhost:8081/


```bash

cd ./app
npm install
rm ./.env
cp ./.env.docker-compose ./.env

node ./sawtooth-sub-events.js
node ./sawtooth-post.js
node ./sawtooth-get.js
node ./mongo-sample.js

#kafka
node ./send.js
node ./receive.js
node ./send.js #Repeat
cd -

```

```bash
#Close
cd ./docker-compose
./down.sh
cd -
```

## K8s

```bash
cd ./k8s
./up-dev.sh
cd -

#Run Sawtooth transaction processor
cd ./tp
npm install
rm ./.env
cp ./.env.minikube ./.env
node ./index.js
cd -
```

Mongo Express:
http://192.168.99.100:30081/
Deploys Kafka, Mongodb and Kafka.

Mongo-express: http://localhost:8081
Sawtooth-explorer: http://localhost:8091
Sawtooth-rest-api: http://localhost:8008

```bash

cd ./app
npm install
rm ./.env
cp ./.env.minikube ./.env

node ./sawtooth-sub-events.js
node ./sawtooth-post.js
node ./sawtooth-get.js
node ./mongo-sample.js
## Code:
In `./app/` there are scripts to test sawtooth, kafka and mongo.

`tp1` has the transaction procesor (similar to a smart contract). This transaction processor stores a value with a key like a map or hashtable.

#kafka
node ./send.js
node ./receive.js
node ./send.js #Repeat
cd -


./down.sh

```

```bash
cd ./k8s
./down.sh
cd -
```

## k8s inside cluster

```bash
cd ./k8s
./up.sh
cd -

./docker-build.sh
```

```bash
kubectl run --rm -it borrar --image le999/app:1.0 --restart=Never -- bash

cp ./.env.k8s ./.env

node ./sawtooth-sub-events.js
node ./sawtooth-post.js
node ./sawtooth-get.js
node ./mongo-sample.js


#kafka
node ./send.js
node ./receive.js
node ./send.js #Repeat

```

```bash
cd ./k8s
./down.sh
cd -
```

## Details

Only tested with node v10, Im not sure sawtooth SDK works for other versions


## Docs Kafka
https://hub.docker.com/r/bitnami/kafka/
'Accessing Kafka with internal and external clients'

https://github.com/Blizzard/node-rdkafka
https://kafka.apache.org/quickstart


```bash

docker exec -it kafka_kafka_1 bash
/opt/bitnami/kafka/bin/kafka-topics.sh --create --zookeeper zookeeper:2181 --topic mytopic --partitions 1 --replication-factor 1
/opt/bitnami/kafka/bin/kafka-topics.sh --describe --zookeeper zookeeper:2181 --topic mytopic
/opt/bitnami/kafka/bin/kafka-console-producer.sh --topic mytopic --bootstrap-server localhost:9092
/opt/bitnami/kafka/bin/kafka-console-consumer.sh --topic mytopic --from-beginning --bootstrap-server localhost:9092

```

## Suggestions
Edit `up.sh` to only run the code that is required.
Edit `./docker-compose/docker-compose.yaml` so that only the required containers are run
107 changes: 107 additions & 0 deletions README2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
## K8s

```bash
cd ./k8s
./up-dev.sh
cd -

#Run Sawtooth transaction processor
cd ./tp
npm install
rm ./.env
cp ./.env.minikube ./.env
node ./index.js
cd -
```

Mongo Express:
http://192.168.99.100:30081/


```bash

cd ./app
npm install
rm ./.env
cp ./.env.minikube ./.env

node ./sawtooth-sub-events.js
node ./sawtooth-post.js
node ./sawtooth-get.js
node ./mongo-sample.js


#kafka
node ./send.js
node ./receive.js
node ./send.js #Repeat
cd -


./down.sh

```

```bash
cd ./k8s
./down.sh
cd -
```

## k8s inside cluster

```bash
cd ./k8s
./up.sh
cd -

./docker-build.sh
```

```bash
kubectl run --rm -it borrar --image le999/app:1.0 --restart=Never -- bash

cp ./.env.k8s ./.env

node ./sawtooth-sub-events.js
node ./sawtooth-post.js
node ./sawtooth-get.js
node ./mongo-sample.js


#kafka
node ./send.js
node ./receive.js
node ./send.js #Repeat

```

```bash
cd ./k8s
./down.sh
cd -
```

## Details

Only tested with node v10, Im not sure sawtooth SDK works for other versions


## Docs Kafka
https://hub.docker.com/r/bitnami/kafka/
'Accessing Kafka with internal and external clients'

https://github.com/Blizzard/node-rdkafka
https://kafka.apache.org/quickstart


```bash

docker exec -it kafka_kafka_1 bash
/opt/bitnami/kafka/bin/kafka-topics.sh --create --zookeeper zookeeper:2181 --topic mytopic --partitions 1 --replication-factor 1
/opt/bitnami/kafka/bin/kafka-topics.sh --describe --zookeeper zookeeper:2181 --topic mytopic
/opt/bitnami/kafka/bin/kafka-console-producer.sh --topic mytopic --bootstrap-server localhost:9092
/opt/bitnami/kafka/bin/kafka-console-consumer.sh --topic mytopic --from-beginning --bootstrap-server localhost:9092

```

0 comments on commit 8bd5271

Please sign in to comment.