Skip to content

Commit

Permalink
refactoring scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
FerrariAndrea committed Aug 25, 2022
1 parent ea63b13 commit 4e7c684
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 83 deletions.
41 changes: 33 additions & 8 deletions DApp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,54 @@ You can verify if your wallet was successfully configured with the command:
The DAPP in DESMO-LD project will be used by the Iexec worker pool, it needs to be dockerized, published on docker-hub, and finally registered on iexec.

```bash
docker build . --tag desmo-dapp
npm run clean
```
Now you can run the DApp locally.
Build the TS code
```bash
./scripts/runLocally.bat
npm run build
```
If you want to change the argument passed to the DApp, you can edit the `runLocally.bat` file.
Now you can run the DApp locally with a test query.
```bash
npm start
```
If you want to change the argument passed to the DApp, you can edit the `package.json` file.
The first argument is the RequestID (used in the DApp to get the list of Directory from the chain). The second one is the query that the DApp needs to resolve, the query is a stringify json with some replacements: you must use `__!_` instead of the double quotes `"` and `--#-` instead of the single quote `'`.

Build the docker image
```bash
npm run docker_build
```

Publish the DApp on docker-hub.
```bash
dockerPush.bat
docker tag desmo-dapp <your_docker_username>/desmo-dapp:1.0.0
docker push <your_docker_username>/desmo-dapp:1.0.0
```

You can check if the image work, running it locally
```bash
npm run docker_run
```

Copy the checksum of the docker image in the file `iexec.json` under `app.checksumm`.
Check the `app.multiaddr` and `app.owner` of the same file.

Register the DApp on IExec.
```bash
./scripts/onChainDeploy.bat
npm run onchain_deploy
```
With that script will be shown the chain that you are using, make sure to use Viviani which is the free one.

Make sure to use Viviani which is the free chain.
​```bash
iexec app show --chain viviani
iexec account show --chain viviani
```
Tun the Dapp on a workerpool
```bash
npm run onchain_run
```

If you want that others can run your application you must create an app order. For this run the following command:
```bash
Expand Down
10 changes: 8 additions & 2 deletions DApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@
"scripts": {
"clean": "rimraf build",
"build": "tsc",
"test":"npx jest /tests",
"lint": "eslint . --ext .ts"
"start":"node build/app.js \"0x000000000000000000000000000000000000000000000000000000000000000b\" \"{__!_prefixList__!_:[{__!_abbreviation__!_:__!_desmo__!_,__!_completeURI__!_:__!_https://desmo.vaimee.it/__!_},{__!_abbreviation__!_:__!_qudt__!_,__!_completeURI__!_:__!_http://qudt.org/schema/qudt/__!_},{__!_abbreviation__!_:__!_xsd__!_,__!_completeURI__!_:__!_http://www.w3.org/2001/XMLSchema/__!_},{__!_abbreviation__!_:__!_monas__!_,__!_completeURI__!_:__!_https://pod.dasibreaker.vaimee.it/monas/__!_}],__!_property__!_:{__!_identifier__!_:__!_value__!_,__!_unit__!_:__!_qudt:DEG_C__!_,__!_datatype__!_:1},__!_staticFilter__!_:__!_$[?(@[--#-type--#-]==--#-Sensor--#-)]__!_}\"",
"test":"cd tests && npx jest",
"lint": "eslint . --ext .ts",
"docker_build": "docker build . --tag desmo-dapp",
"docker_run": "docker run --rm -v %CD%/mount/iexec_in:/iexec_in -v %CD%/mount/iexec_out:/iexec_out -e IEXEC_IN=/iexec_in -e IEXEC_OUT=/iexec_out desmo-dapp \"0x000000000000000000000000000000000000000000000000000000000000000b\" \"{__!_prefixList__!_:[{__!_abbreviation__!_:__!_desmo__!_,__!_completeURI__!_:__!_https://desmo.vaimee.it/__!_},{__!_abbreviation__!_:__!_qudt__!_,__!_completeURI__!_:__!_http://qudt.org/schema/qudt/__!_},{__!_abbreviation__!_:__!_xsd__!_,__!_completeURI__!_:__!_http://www.w3.org/2001/XMLSchema/__!_},{__!_abbreviation__!_:__!_monas__!_,__!_completeURI__!_:__!_https://pod.dasibreaker.vaimee.it/monas/__!_}],__!_property__!_:{__!_identifier__!_:__!_value__!_,__!_unit__!_:__!_qudt:DEG_C__!_,__!_datatype__!_:1},__!_staticFilter__!_:__!_$[?(@[--#-type--#-]==--#-Sensor--#-)]__!_}\"",
"onchain_deploy":"iexec app deploy --chain viviani",
"onchain_run":"iexec app run --watch --chain viviani"

},
"repository": {
"type": "git",
Expand Down
1 change: 0 additions & 1 deletion DApp/scripts/build.bat

This file was deleted.

3 changes: 0 additions & 3 deletions DApp/scripts/dockerPush.bat

This file was deleted.

3 changes: 0 additions & 3 deletions DApp/scripts/getResults.bat

This file was deleted.

4 changes: 0 additions & 4 deletions DApp/scripts/onChainDeploy.bat

This file was deleted.

15 changes: 0 additions & 15 deletions DApp/scripts/queryExample.txt

This file was deleted.

6 changes: 0 additions & 6 deletions DApp/scripts/runLocally copy.bat

This file was deleted.

6 changes: 0 additions & 6 deletions DApp/scripts/runLocally.bat

This file was deleted.

1 change: 0 additions & 1 deletion DApp/scripts/runOnChain.bat

This file was deleted.

30 changes: 0 additions & 30 deletions DApp/src/MockSourceNumb.ts

This file was deleted.

2 changes: 1 addition & 1 deletion DApp/src/model/WotSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class WotSource implements ISource {
try {
const reader = await this.thing.readProperty(this.propertyName);
const ris = await reader.value();
Logger.getInstance().addLog(componentName, "Ask for a velue, response: " + ris);
Logger.getInstance().addLog(componentName, "Ask for a value, response: " + ris);

if (ris === null) {
Logger.getInstance().addLog(componentName, "Not valid value getted by source: " + this.index, true);
Expand Down
9 changes: 6 additions & 3 deletions DApp/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"paths": {
"$/*": ["./src/*"],
"$test/*": ["./test/*"]
"src/": ["./src/*"]
}
}
},
"exclude": [
"support",
"tests"
]
}

0 comments on commit 4e7c684

Please sign in to comment.