Skip to content

Commit

Permalink
Release v2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
npeditto committed May 21, 2018
1 parent 4265e99 commit 4d052e8
Show file tree
Hide file tree
Showing 21 changed files with 3,083 additions and 1,112 deletions.
2 changes: 1 addition & 1 deletion bin/server
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ nconf.file ({file: IotronicHome + '/settings.json'});

var wampR_url = nconf.get('config:wamp:url')+":"+nconf.get('config:wamp:port');
var wamp_realm = nconf.get('config:wamp:realm');
console.log(wampR_url);
//console.log(wampR_url);

var server = new iotronic.server;
server.start(wampR_url, wamp_realm);
109 changes: 86 additions & 23 deletions docs/installation_ubuntu_14.04.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ if you would like to use HTTPS to expose them you have to specify the "https" se
```
"db":{
"host":"localhost",
"port":3306,
"user":"root",
"password":"<MYSQL-PASSWORD>",
"db_name": "s4t-iotronic"
Expand All @@ -160,9 +161,13 @@ if you would like to use HTTPS to expose them you have to specify the "https" se
"email": {
"address": "<SENDER-EMAIL>",
"password": "<SENDER-PASSWORD-EMAIL>"
"smtp":{
"smtp_server": "<SMTP-MAIL-SERVER>"",
"smtp_port": "<SMTP-PORT>"",
"smtp_secure": "[ true | false ]"
}
},
"enable_notify":"[ true | false ]",
"retry":<ATTEMPTS-NUMBER>
}
```

Expand All @@ -177,7 +182,7 @@ node /usr/lib/node_modules/@mdslab/iotronic-standalone/utils/createAdminToken.js
"encryptKey": "<ENC-KEY>",
"adminToken": "<GENERATED-BEFORE>",
"backend": "iotronic",
"expire_time": 60
"expire_time": "30m"
}
```
The "encryptKey" field is a user-defined keyword/password used to encrypt/decrypt the users passwords during authentication procedures.
Expand Down Expand Up @@ -244,57 +249,115 @@ RESPONSE:


## API documentation management
IoTronic releases its APIs documentation by means of Swagger framework. In particular we used ["swagger-jsdoc"](https://www.npmjs.com/package/swagger-jsdoc) and ["swagger-ui"](https://swagger.io/swagger-ui/) respectively to describe each RESTful API in the source code and publish the produced documentation.
IoTronic releases its APIs documentation by means of Swagger framework. In particular we used ["swagger-jsdoc"](https://www.npmjs.com/package/swagger-jsdoc) and ["swagger-ui"](https://swagger.io/swagger-ui/)
respectively to describe each RESTful API in the source code and publish the produced documentation.

To use swagger-ui we need to clone the git repository from [here](https://github.com/swagger-api/swagger-ui)
and move the "dist" folder where you prefer and specify it inside the "settings.json" configuration file
as showed below:
Iotronic is able to expose the documentation:
1. embedded mode: generate and expose runtime the API documentation
2. exposed mode: only specify the URLs of the web-server that is exposing the documentation

In both cases we need to get the "swagger-ui" cloning the git repository from [here](https://github.com/swagger-api/swagger-ui)
and rename the "dist/" folder in "iotronic-api-docs/".

#### 1. Embedded mode
```
"docs": {
"enable": [ true | false ],
"path": "<SWAGGER-DIST-PATH>"
"embedded":{
"enable": true,
"path": "<SWAGGER-DIST-PATH>"
},
"exposed":{
"enable": false,
"url":"",
"url_spec":""
}
}
```
We have to move the "iotronic-api-docs/" folder in the "/var/lib/iotronic/docs/" and we need to specify it inside the
"settings.json" configuration file, as showed above, in the "path" section substituting "<SWAGGER-DIST-PATH>" variable
and setting to "true" the "enable" flag in the "embedded" section.

You have to edit the "index.html" in <SWAGGER-DIST-PATH> as described in the [official guide](https://swagger.io/docs/swagger-tools/#download-33):
The API documentation will be available at:
```
window.swaggerUi = new SwaggerUi({
url: <URL-SWAGGER-JSON>,
});
http(s)://<IOTRONIC-IP>:<HTTP(S)-API-PORT>/v1/iotronic-api-docs/ (<URL-API-DOCS>)
```
where
and the location of the Swagger JSON file will be:
```
<URL-SWAGGER-JSON> = http(s)://<IOTRONIC-IP>:<HTTP(S)-API-PORT>/<SWAGGER-JSON-LOCATION>/iotronic-swagger.json
http(s)://<IOTRONIC-IP>:<HTTP(S)-API-PORT>/v1/iotronic-swagger.json (<URL-SWAGGER-JSON>)
```

[Link to Official guide](https://swagger.io/docs/swagger-tools/#download-33)

#### Embedded API management
Enabling the above flag ("enable":true) IoTronic will generate end expose the API documentation.
#### 2. Exposed mode
```
"docs": {
The docs will be available at:
"embedded":{
"enable": false,
"path": "<SWAGGER-DIST-PATH>"
},
"exposed":{
"enable": true,
"url":"<URL-API-DOCS>",
"url_spec":"<URL-SWAGGER-JSON>"
}
}
```
In this case we have to
1. move the "iotronic-api-docs/" folder in the web-server public folder to expose the "swagger-ui" (e.g. in Apache we
have to move "iotronic-api-docs/" in "/var/www/html/");
2. generate the swagger json file "iotronic-swagger.json" executing the the script "iotronic-docs-gen.js" provided
by Iotronic in the "docs/" folder; e.g.:
```
node iotronic-docs-gen.js --iotronic=$NODE_PATH"/@mdslab/iotronic-standalone/" -e false -w /var/www/html/iotronic-api-docs/
```
<URL-API-DOCS> = http(s)://<IOTRONIC-IP>:<HTTP(S)-API-PORT>/v1/iotronic-api-docs/
For more information see the below section "Standalone API management".

3. configure the "settings.json" configuration file:
- set to "true" the "enable" flag in the "exposed" section;
- specify the urls of the documentation (<URL-API-DOCS>) and the url that exposes the "iotronic-swagger.json" file
(<URL-SWAGGER-JSON>);

The API documentation will be available at:
```
http(s)://<WEB-SERVER-URL>/iotronic-api-docs/ (<URL-API-DOCS>)
```
and the location of the Swagger JSON file will be:
```
<URL-SWAGGER-JSON> = http(s)://<IOTRONIC-IP>:<HTTP(S)-API-PORT>/v1/iotronic-swagger.json
http(s)://<WEB-SERVER-URL>/iotronic-api-docs/iotronic-swagger.json (<URL-SWAGGER-JSON>)
```


In both the cases you have to edit the "index.html" in <SWAGGER-DIST-PATH> as described in the
[official guide](https://swagger.io/docs/swagger-tools/#download-33):
```
window.swaggerUi = new SwaggerUi({
url: <URL-SWAGGER-JSON>,
});
```
[Link to Official guide](https://swagger.io/docs/swagger-tools/#download-33)




#### Standalone API management
We also provided a NodeJS script ([iotronic-docs-gen.js](iotronic-docs-gen.js)) to do that without using directly IoTronic (we need to set "enable" to false). This script will generate the documentation and will publish it by means of "swagger-ui".
We also provided a NodeJS script ([iotronic-docs-gen.js](iotronic-docs-gen.js)) to do that without using directly
IoTronic or a web-server. This script will generate the documentation and will publish it by means of "swagger-ui".

Script usage:
```
node iotronic-docs-gen.js --iotronic="<IOTRONIC_SOURCE_CODE_PATH>" -e [true|false] [ -p <API_DOCS_PORT> ]
node iotronic-docs-gen.js --iotronic="<IOTRONIC_SOURCE_CODE_PATH>" -e [true|false] [ -p <API_DOCS_PORT> ] [ -w <SWAGGER-JSON-SAVE-PATH>]
```
options:
- -i, --iotronic IoTronic suorce code path. (e.g. "/usr/lib/node_modules/@mdslab/iotronic-standalone/")
- -e, --embedded true | false to spawn API webpage documentation; if "false" the "iotronic-swagger.json" will be created in the <SWAGGER-DIST-PATH> folder specified in the "settings.json" file in the "docs" section.
- -p, --port [only with --embedded=true] Listening port. (this port has to be different from the ports used by IoTronic "http(s)_port")
- -w, --web Web server path: where will be created the swagger json file "iotronic-swagger.json".

The docs will be available at:
```
Expand Down
109 changes: 87 additions & 22 deletions docs/installation_ubuntu_16.04.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ git clone git://github.com/MDSLab/s4t-iotronic-standalone.git
mv s4t-iotronic-standalone/ iotronic-standalone
cp /usr/lib/node_modules/@mdslab/iotronic-standalone/etc/systemd/system/iotronic-standalone.service /etc/systemd/system/
sed -i "s|ExecStart=<IOTRONIC-LAUNCHER>|ExecStart=$NODE_PATH/@mdslab/iotronic-standalone/bin/server|g" /etc/systemd/system/iotronic-standalone.service
chmod +x /etc/systemd/system/iotronic-standalone.service
systemctl daemon-reload
systemctl enable iotronic-standalone.service
Expand Down Expand Up @@ -152,6 +153,7 @@ if you would like to use HTTPS to expose them you have to specify the "https" se
```
"db":{
"host":"localhost",
"port":3306,
"user":"root",
"password":"<MYSQL-PASSWORD>",
"db_name": "s4t-iotronic"
Expand All @@ -164,6 +166,11 @@ if you would like to use HTTPS to expose them you have to specify the "https" se
"email": {
"address": "<SENDER-EMAIL>",
"password": "<SENDER-PASSWORD-EMAIL>"
"smtp":{
"smtp_server": "<SMTP-MAIL-SERVER>"",
"smtp_port": "<SMTP-PORT>"",
"smtp_secure": "[ true | false ]"
}
},
"enable_notify":"[ true | false ]",
}
Expand All @@ -180,7 +187,7 @@ node /usr/lib/node_modules/@mdslab/iotronic-standalone/utils/createAdminToken.js
"encryptKey": "<ENC-KEY>",
"adminToken": "<GENERATED-BEFORE>",
"backend": "iotronic",
"expire_time": 60
"expire_time": "30m"
}
```
The "encryptKey" field is a user-defined keyword/password used to encrypt/decrypt the users passwords during authentication procedures.
Expand Down Expand Up @@ -249,57 +256,115 @@ RESPONSE:


## API documentation management
IoTronic releases its APIs documentation by means of Swagger framework. In particular we used ["swagger-jsdoc"](https://www.npmjs.com/package/swagger-jsdoc) and ["swagger-ui"](https://swagger.io/swagger-ui/) respectively to describe each RESTful API in the source code and publish the produced documentation.
IoTronic releases its APIs documentation by means of Swagger framework. In particular we used ["swagger-jsdoc"](https://www.npmjs.com/package/swagger-jsdoc) and ["swagger-ui"](https://swagger.io/swagger-ui/)
respectively to describe each RESTful API in the source code and publish the produced documentation.

To use swagger-ui we need to clone the git repository from [here](https://github.com/swagger-api/swagger-ui)
and move the "dist" folder where you prefer and specify it inside the "settings.json" configuration file
as showed below:
Iotronic is able to expose the documentation:
1. embedded mode: generate and expose runtime the API documentation
2. exposed mode: only specify the URLs of the web-server that is exposing the documentation

In both cases we need to get the "swagger-ui" cloning the git repository from [here](https://github.com/swagger-api/swagger-ui)
and rename the "dist/" folder in "iotronic-api-docs/".

#### 1. Embedded mode
```
"docs": {
"enable": [ true | false ],
"path": "<SWAGGER-DIST-PATH>"
"embedded":{
"enable": true,
"path": "<SWAGGER-DIST-PATH>"
},
"exposed":{
"enable": false,
"url":"",
"url_spec":""
}
}
```
We have to move the "iotronic-api-docs/" folder in the "/var/lib/iotronic/docs/" and we need to specify it inside the
"settings.json" configuration file, as showed above, in the "path" section substituting "<SWAGGER-DIST-PATH>" variable
and setting to "true" the "enable" flag in the "embedded" section.

You have to edit the "index.html" in <SWAGGER-DIST-PATH> as described in the [official guide](https://swagger.io/docs/swagger-tools/#download-33):
The API documentation will be available at:
```
window.swaggerUi = new SwaggerUi({
url: <URL-SWAGGER-JSON>,
});
http(s)://<IOTRONIC-IP>:<HTTP(S)-API-PORT>/v1/iotronic-api-docs/ (<URL-API-DOCS>)
```
where
and the location of the Swagger JSON file will be:
```
<URL-SWAGGER-JSON> = http(s)://<IOTRONIC-IP>:<HTTP(S)-API-PORT>/<SWAGGER-JSON-LOCATION>/iotronic-swagger.json
http(s)://<IOTRONIC-IP>:<HTTP(S)-API-PORT>/v1/iotronic-swagger.json (<URL-SWAGGER-JSON>)
```

[Link to Official guide](https://swagger.io/docs/swagger-tools/#download-33)

#### Embedded API management
Enabling the above flag ("enable":true) IoTronic will generate end expose the API documentation.
#### 2. Exposed mode
```
"docs": {
The docs will be available at:
"embedded":{
"enable": false,
"path": "<SWAGGER-DIST-PATH>"
},
"exposed":{
"enable": true,
"url":"<URL-API-DOCS>",
"url_spec":"<URL-SWAGGER-JSON>"
}
}
```
In this case we have to
1. move the "iotronic-api-docs/" folder in the web-server public folder to expose the "swagger-ui" (e.g. in Apache we
have to move "iotronic-api-docs/" in "/var/www/html/");
2. generate the swagger json file "iotronic-swagger.json" executing the the script "iotronic-docs-gen.js" provided
by Iotronic in the "docs/" folder; e.g.:
```
node iotronic-docs-gen.js --iotronic=$NODE_PATH"/@mdslab/iotronic-standalone/" -e false -w /var/www/html/iotronic-api-docs/
```
<URL-API-DOCS> = http(s)://<IOTRONIC-IP>:<HTTP(S)-API-PORT>/v1/iotronic-api-docs/
For more information see the below section "Standalone API management".

3. configure the "settings.json" configuration file:
- set to "true" the "enable" flag in the "exposed" section;
- specify the urls of the documentation (<URL-API-DOCS>) and the url that exposes the "iotronic-swagger.json" file
(<URL-SWAGGER-JSON>);

The API documentation will be available at:
```
http(s)://<WEB-SERVER-URL>/iotronic-api-docs/ (<URL-API-DOCS>)
```
and the location of the Swagger JSON file will be:
```
<URL-SWAGGER-JSON> = http(s)://<IOTRONIC-IP>:<HTTP(S)-API-PORT>/v1/iotronic-swagger.json
http(s)://<WEB-SERVER-URL>/iotronic-api-docs/iotronic-swagger.json (<URL-SWAGGER-JSON>)
```


In both the cases you have to edit the "index.html" in <SWAGGER-DIST-PATH> as described in the
[official guide](https://swagger.io/docs/swagger-tools/#download-33):
```
window.swaggerUi = new SwaggerUi({
url: <URL-SWAGGER-JSON>,
});
```
[Link to Official guide](https://swagger.io/docs/swagger-tools/#download-33)




#### Standalone API management
We also provided a NodeJS script ([iotronic-docs-gen.js](iotronic-docs-gen.js)) to do that without using directly IoTronic (we need to set "enable" to false). This script will generate the documentation and will publish it by means of "swagger-ui".
We also provided a NodeJS script ([iotronic-docs-gen.js](iotronic-docs-gen.js)) to do that without using directly
IoTronic or a web-server. This script will generate the documentation and will publish it by means of "swagger-ui".

Script usage:
```
node iotronic-docs-gen.js --iotronic="<IOTRONIC_SOURCE_CODE_PATH>" -e [true|false] [ -p <API_DOCS_PORT> ]
node iotronic-docs-gen.js --iotronic="<IOTRONIC_SOURCE_CODE_PATH>" -e [true|false] [ -p <API_DOCS_PORT> ] [ -w <SWAGGER-JSON-SAVE-PATH>]
```
options:
- -i, --iotronic IoTronic suorce code path. (e.g. "/usr/lib/node_modules/@mdslab/iotronic-standalone/")
- -e, --embedded true | false to spawn API webpage documentation; if "false" the "iotronic-swagger.json" will be created in the <SWAGGER-DIST-PATH> folder specified in the "settings.json" file in the "docs" section.
- -p, --port [only with --embedded=true] Listening port. (this port has to be different from the ports used by IoTronic "http(s)_port")
- -w, --web Web server path: where will be created the swagger json file "iotronic-swagger.json".

The docs will be available at:
```
Expand Down
Loading

0 comments on commit 4d052e8

Please sign in to comment.