How do you deploy micro services to agents?

microservices

(Goroya) #1

I can not confirm that microservice is running with agent.
The current situation is below.
The method of deploying microservice in ioFog-agent is “iofog-controller microservice add - name” newservice “- catalog - id 1 - - iofog - id - flow - id 1 - u 1”.
Is it correct by designation?

root@test-vm:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES root@test-vm:~# docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest 4ab4c602aa5e 3 months ago 1.84kB root@test-vm:~#

root@test-vm:~# iofog-agent info
Iofog UUID : nH42xZPT4WyvHbNqLbxGGRCVnDCYGKQz
IP Address : 192.168.11.19
Network Interface : ens33
Developer’s Mode : on
ioFog Controller : http://192.168.11.10:22222/api/v3/
ioFog Certificate : /etc/iofog-agent/cert.crt
Docker URL : unix:///var/run/docker.sock
Disk Usage Limit : 50.00 GiB
Message Storage Directory : /var/lib/iofog-agent/
Memory RAM Limit : 4096.00 MiB
CPU Usage Limit : 80.00%
Log Disk Limit : 10.00 GiB
Log File Directory : /var/log/iofog-agent/
Log Rolling File Count : 10
Status Update Frequency : 30
Get Changes Frequency : 60
Scan Devices Frequency : 60
Post Diagnostics Frequency : 10
Isolated Docker Containers Mode : off
GPS mode : auto
GPS coordinates(lat,lon) : 35.6906,139.77
Fog type : intel_amd

iofog-controller microservice list { "microservices": [ { "uuid": "J7xbtcVFjhZrPYfwZKpv9PG29wR6yWGM", "config": "{ \"maxWindowSize\": 10 }", "name": "Moving Average 1", "rootHostAccess": false, "logSize": 0, "delete": false, "deleteWithCleanup": false, "flowId": 1, "catalogItemId": 1, "iofogUuid": null, "userId": 1 }, { "uuid": "TXQWXfntvtXZWjqfc33gL9RBLzFfMqdZ", "config": "{ \"maxWindowSize\": 10 }", "name": "Moving Average 3", "rootHostAccess": false, "logSize": 0, "delete": false, "deleteWithCleanup": false, "flowId": 1, "catalogItemId": 1, "iofogUuid": null, "userId": 1 }, { "uuid": "T8JDRhxkx3gbz4vZMfFDGCXFkwR2RZNH", "config": "{ \"maxWindowSize\": 10 }", "name": "Moving Average 4", "rootHostAccess": false, "logSize": 0, "delete": false, "deleteWithCleanup": false, "flowId": 1, "catalogItemId": 1, "iofogUuid": null, "userId": 1 }, { "uuid": "vGkyCbCjBMYqqQHdn4TRFXz29GD9Vnzg", "config": "{ \"maxWindowSize\": 10 }", "name": "Moving Average 100", "rootHostAccess": false, "logSize": 0, "delete": false, "deleteWithCleanup": false, "flowId": 1, "catalogItemId": 1, "iofogUuid": null, "userId": 1 }, { "uuid": "3PzGgBB7F9QwVgvZdhvpk9c9pVLNfX6v", "config": "{ \"maxWindowSize\": 10 }", "name": "Moving Average 101", "rootHostAccess": false, "logSize": 0, "delete": false, "deleteWithCleanup": false, "flowId": 1, "catalogItemId": 1, "iofogUuid": "nH42xZPT4WyvHbNqLbxGGRCVnDCYGKQz", "userId": 1 }, { "uuid": "VT9CmQYQFPgj7vdLnMqVNZQ3ddqkxtqc", "config": "{ \"maxWindowSize\": 10 }", "name": "Moving Average 102", "rootHostAccess": false, "logSize": 0, "delete": false, "deleteWithCleanup": false, "flowId": 1, "catalogItemId": 1, "iofogUuid": "nH42xZPT4WyvHbNqLbxGGRCVnDCYGKQz", "userId": 1 }, { "uuid": "jrqbcHLBLQK6CRL6NkV6C8YW8ZgTPPHy", "config": "", "name": "newservice", "rootHostAccess": false, "logSize": 0, "delete": false, "deleteWithCleanup": false, "flowId": 1, "catalogItemId": 1, "iofogUuid": "nH42xZPT4WyvHbNqLbxGGRCVnDCYGKQz", "userId": 1 } ] } Microservices have been retrieved successfully.

iofog-controller iofog list
{
“fogs”: [
{
“uuid”: “6Hvqy4yKDtLGKKkfbWqXD2Fv3zcRQBrF”,
“name”: “my-fog-node”,
“location”: null,
“gpsMode”: null,
“latitude”: null,
“longitude”: null,
“description”: null,
“lastActive”: null,
“daemonStatus”: “UNKNOWN”,
“daemonOperatingDuration”: 0,
“daemonLastStart”: null,
“memoryUsage”: 0,
“diskUsage”: 0,
“cpuUsage”: 0,
“memoryViolation”: null,
“diskViolation”: null,
“cpuViolation”: null,
“catalogItemStatus”: null,
“repositoryCount”: null,
“repositoryStatus”: null,
“systemTime”: null,
“lastStatusTime”: null,
“ipAddress”: “0.0.0.0”,
“processedMessages”: 0,
“catalogItemMessageCounts”: null,
“messageSpeed”: null,
“lastCommandTime”: null,
“networkInterface”: “eth0”,
“dockerUrl”: “unix:///var/run/docker.sock”,
“diskLimit”: 50,
“diskDirectory”: “/var/lib/iofog/”,
“memoryLimit”: 4096,
“cpuLimit”: 80,
“logLimit”: 10,
“logDirectory”: “/var/log/iofog/”,
“bluetoothEnabled”: false,
“abstractedHardwareEnabled”: false,
“logFileCount”: 10,
“version”: null,
“isReadyToUpgrade”: true,
“isReadyToRollback”: false,
“statusFrequency”: 10,
“changeFrequency”: 20,
“deviceScanFrequency”: 20,
“tunnel”: “”,
“watchdogEnabled”: true,
“created_at”: “2018-12-06T17:41:40.429Z”,
“updated_at”: “2018-12-06T17:41:40.429Z”,
“fogTypeId”: 0,
“userId”: 1
},
{
“uuid”: “vJGxDd3HDhmVvK4ZvjJWWRv7PLMGhNPt”,
“name”: “my-fog-node”,
“location”: null,
“gpsMode”: null,
“latitude”: null,
“longitude”: null,
“description”: null,
“lastActive”: null,
“daemonStatus”: “UNKNOWN”,
“daemonOperatingDuration”: 0,
“daemonLastStart”: null,
“memoryUsage”: 0,
“diskUsage”: 0,
“cpuUsage”: 0,
“memoryViolation”: null,
“diskViolation”: null,
“cpuViolation”: null,
“catalogItemStatus”: null,
“repositoryCount”: null,
“repositoryStatus”: null,
“systemTime”: null,
“lastStatusTime”: null,
“ipAddress”: “0.0.0.0”,
“processedMessages”: 0,
“catalogItemMessageCounts”: null,
“messageSpeed”: null,
“lastCommandTime”: null,
“networkInterface”: “eth0”,
“dockerUrl”: “unix:///var/run/docker.sock”,
“diskLimit”: 50,
“diskDirectory”: “/var/lib/iofog/”,
“memoryLimit”: 4096,
“cpuLimit”: 80,
“logLimit”: 10,
“logDirectory”: “/var/log/iofog/”,
“bluetoothEnabled”: false,
“abstractedHardwareEnabled”: false,
“logFileCount”: 10,
“version”: null,
“isReadyToUpgrade”: true,
“isReadyToRollback”: false,
“statusFrequency”: 10,
“changeFrequency”: 20,
“deviceScanFrequency”: 20,
“tunnel”: “”,
“watchdogEnabled”: true,
“created_at”: “2018-12-06T17:47:25.176Z”,
“updated_at”: “2018-12-06T17:47:25.176Z”,
“fogTypeId”: 0,
“userId”: 1
},
{
“uuid”: “nH42xZPT4WyvHbNqLbxGGRCVnDCYGKQz”,
“name”: “my-fog-node”,
“location”: null,
“gpsMode”: “auto”,
“latitude”: 35.6906,
“longitude”: 139.77,
“description”: null,
“lastActive”: 1544128782291,
“daemonStatus”: “RUNNING”,
“daemonOperatingDuration”: 2876984,
“daemonLastStart”: 1544125900934,
“memoryUsage”: 101.98486328125,
“diskUsage”: 0,
“cpuUsage”: 0.5025125741958618,
“memoryViolation”: “0”,
“diskViolation”: “0”,
“cpuViolation”: “0”,
“catalogItemStatus”: null,
“repositoryCount”: 2,
“repositoryStatus”: “[]”,
“systemTime”: 1544128721330,
“lastStatusTime”: 1544128777918,
“ipAddress”: “192.168.11.19”,
“processedMessages”: 2,
“catalogItemMessageCounts”: null,
“messageSpeed”: 0,
“lastCommandTime”: 0,
“networkInterface”: “ens33”,
“dockerUrl”: “unix:///var/run/docker.sock”,
“diskLimit”: 50,
“diskDirectory”: “/var/lib/iofog-agent/”,
“memoryLimit”: 4096,
“cpuLimit”: 80,
“logLimit”: 10,
“logDirectory”: “/var/log/iofog-agent/”,
“bluetoothEnabled”: false,
“abstractedHardwareEnabled”: false,
“logFileCount”: 10,
“version”: “1.0.4”,
“isReadyToUpgrade”: true,
“isReadyToRollback”: false,
“statusFrequency”: 30,
“changeFrequency”: 60,
“deviceScanFrequency”: 60,
“tunnel”: “”,
“watchdogEnabled”: false,
“created_at”: “2018-12-06T17:50:42.504Z”,
“updated_at”: “2018-12-06T20:39:42.331Z”,
“fogTypeId”: 1,
“userId”: 1
},
{
“uuid”: “TRpRgWpxpNBDMPYQkrQXBzWQRqp6ZfqH”,
“name”: “my-fog-node”,
“location”: null,
“gpsMode”: null,
“latitude”: null,
“longitude”: null,
“description”: null,
“lastActive”: null,
“daemonStatus”: “UNKNOWN”,
“daemonOperatingDuration”: 0,
“daemonLastStart”: null,
“memoryUsage”: 0,
“diskUsage”: 0,
“cpuUsage”: 0,
“memoryViolation”: null,
“diskViolation”: null,
“cpuViolation”: null,
“catalogItemStatus”: null,
“repositoryCount”: null,
“repositoryStatus”: null,
“systemTime”: null,
“lastStatusTime”: null,
“ipAddress”: “0.0.0.0”,
“processedMessages”: 0,
“catalogItemMessageCounts”: null,
“messageSpeed”: null,
“lastCommandTime”: null,
“networkInterface”: “eth0”,
“dockerUrl”: “unix:///var/run/docker.sock”,
“diskLimit”: 50,
“diskDirectory”: “/var/lib/iofog/”,
“memoryLimit”: 4096,
“cpuLimit”: 80,
“logLimit”: 10,
“logDirectory”: “/var/log/iofog/”,
“bluetoothEnabled”: false,
“abstractedHardwareEnabled”: false,
“logFileCount”: 10,
“version”: null,
“isReadyToUpgrade”: true,
“isReadyToRollback”: false,
“statusFrequency”: 10,
“changeFrequency”: 20,
“deviceScanFrequency”: 20,
“tunnel”: “”,
“watchdogEnabled”: true,
“created_at”: “2018-12-06T17:56:05.470Z”,
“updated_at”: “2018-12-06T17:56:05.470Z”,
“fogTypeId”: 0,
“userId”: 1
}
]
}
Fog list has been gotten successfully.


#2

Hi, goroya

The method of deploying microservice is correct. But you need to verify that iofog-node, which you use for microservice, is provisioned on your iofog-agent. According to information you sent, only this node “uuid”: “nH42xZPT4WyvHbNqLbxGGRCVnDCYGKQz” is provisioned. That’s why this microservice “uuid”: “VT9CmQYQFPgj7vdLnMqVNZQ3ddqkxtqc” has chance to work.
Also, you need to check, that the flow, which you use, is activated. The simplest way to do it, is:

  1. enter iofog-controller flow info -i flow-id command on controller side
  2. verify that in the output parameter “isActivated” has value “true”, if not, just update flow by using sych command:
    iofog-controller flow update -i flow-id -a

After that your microservice has to be shown in output of docker ps command.

As I can see, you are trying to create system container. Generally, system containers creating automatically by other commands. It maybe difficult to interact with it manually. So, I can suggest you to use another catalog item, such as “Hello Web Demo”(id=5) for simple tests.


(Goroya) #3

Thank you for answering.

I succeeded in deploying.
Thank you.


(Jagadeeshi2i) #4

I am running iofog-agent on a raspberry Pi and controller on my laptop. I am trying to add hello-web microservice on the raspberry PI.

After adding microservice to fog node. I could see a log file create on the microservice uuid at the node, but i don’t see any docker container running.

The log file with microservice uuid is empty.

Also the iofog-status gives

ioFog daemon                : RUNNING
Memory Usage                : about 28.09 MiB
Disk Usage                  : about 0.00 MiB
CPU Usage                   : about 0.00%
Running Microservices       : 0
Connection to Controller    : ok
Messages Processed          : about 0
System Time                 : 29/01/2019 06:27 PM

Thanks.


#5

Try to check ioFog Agent logs in /var/log/iofog-agent folder, latest log is called iofog-agent.0.log.


(Jagadeeshi2i) #6
[01/30/2019 10:14:31.875] [INFO] [Local API] : Initiating control signals for unacknowledged signals
[01/30/2019 10:14:31.878] [INFO] [Local API] : Initiating message sending for the unacknowledged messages
[01/30/2019 10:14:34.006] [INFO] [Field Agent] : Post ioFog status
[01/30/2019 10:14:34.007] [INFO] [Field Agent] : controller connection verified
[01/30/2019 10:14:34.007] [INFO] [Field Agent] : sending IOFog status...
[01/30/2019 10:14:34.108] [INFO] [Field Agent] : Start posting ioFog status
[01/30/2019 10:14:34.227] [INFO] [Message Bus] : Check message bus server status
[01/30/2019 10:14:39.234] [INFO] [Message Bus] : Check message bus server status
[01/30/2019 10:14:39.336] [INFO] [Field Agent] : Ping controller
[01/30/2019 10:14:39.479] [INFO] [Field Agent] : Get changes list

I could deploy microservice on localhost. But it is not working on Raspberry Pi.
On Raspberry Pi while adding microservice, i see the following logs

[01/30/2019 11:53:14.284] [INFO] [Field Agent] : Ping controller
[01/30/2019 11:53:16.013] [INFO] [Message Bus] : Check message bus server status
[01/30/2019 11:53:18.979] [INFO] [Field Agent] : Get changes list
[01/30/2019 11:53:19.059] [INFO] [Field Agent] : loading microservices...
[01/30/2019 11:53:20.481] [INFO] [Resource Consumption Manager] : get usage data
[01/30/2019 11:53:21.014] [INFO] [Message Bus] : Check message bus server status
[01/30/2019 11:53:21.875] [INFO] [Local API] : Initiating control signals for unacknowledged signals
[01/30/2019 11:53:21.879] [INFO] [Local API] : Initiating message sending for the unacknowledged messages

#7

Looks like no microservices were fetched from Controller for this Agent, try to look through
iofog-controller microservice list, probably this microservice is attached to some other ioFog Agent (iofogUuid field). Also check flow using iofog-controller flow list, flow with this microservice should be activated.

Should be related to this configuration on controller, you’ll see either additional successful messages about container loading or some error when some microservices come from Controller to Agent near “Get changes list”.


(Jagadeeshi2i) #8

Yes, there is some problem in docker configuration for arm architecture. Now looking into it.
Thanks.


(Jagadeeshi2i) #9

Thank you. It was docker issue for arm architecture. Now the microservice is deployed.


(Jagadeeshi2i) #10

Should i enable port-mapping for iofog/hello-web microservice ?


#11

Yes, you need to map 80 internal port to some external, e.g. 5501. And then you’ll be able to open localhost:5501 page.


(Jagadeeshi2i) #12

Yes, I got it working. Thank you.