set module name in deployment.json with template to reduce user effort
This commit is contained in:
Родитель
cb08350cde
Коммит
aa17dfd0b2
14
README.md
14
README.md
|
@ -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.
|
10
app/index.js
10
app/index.js
|
@ -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": {}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче