set module name in deployment.json with template to reduce user effort

This commit is contained in:
Qingqing Sun 2017-08-23 20:19:27 +08:00
Родитель cb08350cde
Коммит aa17dfd0b2
4 изменённых файлов: 32 добавлений и 22 удалений

Просмотреть файл

@ -101,7 +101,7 @@ docker run -d -p 5000:5000 --name registry registry:2
```
### Build docker image for your module
Update the name:tag (localhost:5000/<lower_case_module_name>) with your module name (lower case). Mark up the image name.
```
docker build --build-arg EXE_DIR=./publish -t localhost:5000/<lower_case_module_name>:latest <docker_file_directory>
```
@ -114,12 +114,16 @@ docker push localhost:5000/<lower_case_module_name>
### Deploy the module
Deployment is accomplished using the edge cli tool. This tool uses Azure IoT Hub to send deployment information to the edge device.
Deployment is accomplished using the edge cli tool. This tool uses Azure IoT Hub to send deployment information to the edge device. Run the following command
Update the deployment.json file with the image name marked in previous step. Then run the following command ```
edge-explorer edge deployment create -m <path to deployment file> -d <edge device ID>```
```
edge-explorer edge deployment create -m <path to deployment file> -d <edge device ID>
```
Now we have the sample module deployed and running, you could monitor it with command
```edge-explorer monitor events <deviceID> --login <iothub connection string not device connection string>```
```
edge-explorer monitor events <deviceID> --login <iothub connection string not device connection string>
```
There will be regular and continuing temperature message show in the console. If not, go back check if each step accomplished correctly.

Просмотреть файл

@ -81,7 +81,10 @@ module.exports = class extends Generator {
this.fs.copyTpl(this.templatePath('csharp/Program.cs'), this.destinationPath(answers.name + '/Program.cs'), {
ModuleName: answers.name
});
this.fs.copyTpl(this.templatePath('csharp/deployment.json', this.destinationPath(answers.name + '/deployment.json')));
this.fs.copyTpl(this.templatePath('csharp/deployment.json', this.destinationPath(answers.name + '/deployment.json'), {
ModuleName: answers.name,
LowerCaseModuleName: answers.name.toLowerCase()
}));
answers.architectures.forEach((architecture, index) => {
this.fs.copyTpl(this.templatePath('csharp/DockerFile'), this.destinationPath(answers.name + '/Docker/' + architecture + '/DockerFile'), {
@ -94,7 +97,10 @@ module.exports = class extends Generator {
this.fs.copyTpl(this.templatePath('node/package.json'), this.destinationPath(answers.name + '/package.json'), {
ModuleName: answers.name
});
this.fs.copyTpl(this.templatePath('node/deployment.json', this.destinationPath(answers.name + '/deployment.json')));
this.fs.copyTpl(this.templatePath('node/deployment.json'), this.destinationPath(answers.name + '/deployment.json'), {
ModuleName: answers.name,
LowerCaseModuleName: answers.name.toLowerCase()
});
this.fs.copyTpl(this.templatePath('node/package-lock.json'), this.destinationPath(answers.name + '/package-lock.json'), {
ModuleName: answers.name
});

Просмотреть файл

@ -1,15 +1,15 @@
{
"modules": {
"sensor": {
"name": "sensor",
"version": "1.0",
"type": "docker",
"status": "running",
"config": {
"image": "localhost:5000/<lower_case_module_name>",
"tag": "latest",
"env": {}
}
}
"<%= ModuleName %>": {
"name": "sensor",
"version": "1.0",
"type": "docker",
"status": "running",
"config": {
"image": "localhost:5000/<%= LowerCaseModuleName %>",
"tag": "latest",
"env": {}
}
}
}
}
}

Просмотреть файл

@ -1,12 +1,12 @@
{
"modules": {
"qisun-node-module": {
"name": "qisun-node-module",
"<%= ModuleName %>": {
"name": "<%= ModuleName %>",
"version": "1.0",
"type": "docker",
"status": "running",
"config": {
"image": "localhost:5000/qisun-node-module",
"image": "localhost:5000/<%= LowerCaseModuleName %>",
"tag": "latest",
"env": {}
}