GithubHelp home page GithubHelp logo

recordevolution / devicemanagementagent Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 1.09 MB

A daemon running on edge devices to establish a connection to the Reswarm router and manage apps and containers

License: Apache License 2.0

Makefile 0.26% Go 99.19% Shell 0.50% Dockerfile 0.06%
apps container device-management iot reswarm wamp

devicemanagementagent's People

Contributors

dewitteruben avatar mario-fink avatar markope avatar tartaruga2 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

devicemanagementagent's Issues

check network connection state

make sure the reagent provides up to date info about network connection/state and access to list of certain URL/endpoints like i.a. registry.reswarm.io, db.reswarm.io,

early logs are sometimes not sent (on container start)

This happens, due to us reader the Docker logs with tail 0, so if the Docker container has a few milliseconds of leading time, it's possible that we miss some logs in the beginning.

Possible fix: include a bit of history in the follow command

implement basic container api functionality (docker)

Create a generic abstraction in case we want to switch container implementation in future

For Docker we should implement the following:

  • DockerPull()
  • DockerRun()
  • DockerStop()
  • DockerPush()
  • DockerBuild()
  • DockerTag()
  • DockerBuildCancel()
  • DockerRemoveImage()
  • DockerPruneImages()
  • DockerLogs()
  • DockerBuildLogs(imageid)
  • DockerPushLogs(imageid)
  • DockerStats()
  • DockerImages()
  • DockerProcess()
  • DockerVolumes()
  • DockerNetworks()

wait for docker daemon to be started before starting initial state sync

Occurs when agent is started before the daemon is:

‘{“level”:“fatal”,“error”:“Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?“,”caller”:“/source/main.go:89”,“time”:“1970-01-01T00:00:37Z”,“message”:“failed to CorrectLocalAndUpdateRemoteAppStates”}’

add DEVICE_URL as standard env variable into the docker_run

just like DEVICE_NAME

attention: The base url can be conti or studio.record-evolution.com

The use case is: I would like to send a warning email from an app and want to include the device url for the email recipient to be able to click that link in the email and directly navigate to the device that had the warning.

probably easy

network management

implement network management according to architectural draft:

  • ListWiFI
  • SetWiFi
  • AdjustSettings

error report system to help us debug devices we don't have physical access to

One pretty annoying problem we also have right now is that whenever something agent related breaks in conti (or anywhere we don’t have physical access to the device), we don’t know how or why since we don’t have access to the devices / logs.

We should implement something that can give us access to the logs remotely, some kind of error report system. We could just send the .log file in that case, which is already setup now

We need some kind of system monitoring in the agent

The agent should be aware of resource consumption on the system, should be able to handle them and should send info/warning to users if some resources are short on supply.

  1. Free disk space
  2. Memory pressure
  3. CPU load

One extra feature would be to start containers with fixed resource assignment. (Docker allows that.) But this is something for next year.

system managment

implement API required for system management:

  • Reboot()
  • ShutDown()

implement basic terminal management system

Prerequisites:

  • WAMP

  • Docker

  • setup container attach

  • stream data via wamp/messaging (read)

  • stream input via wamp/messaging (write)

  • properly manage active terminal session (close when no longer used / unsubscribed)

log management system

  • subscription handling and proper unsub
  • container logs

proper history will be implemented in later stage of development

network api implementations for other OS's

The generic interface that is currently used:

type Network interface {
	Scan(timeoutParam ...time.Duration) error
	ListWifiNetworks() ([]WiFi, error)
	ListEthernetDevices() ([]EthernetDevice, error)
	ActivateWiFi(mac string, ssid string) error
	RemoveWifi(ssid string) error
	EnableDHCP(mac string) error
	GetActiveWirelessDeviceConfig() ([]IPv4AddressData, []IPv6AddressData, error)
	SetIPv4Address(mac string, ip string, prefix uint32) error
	AddWiFi(mac string, credentials WiFiCredentials) error
	Reload() error
}

Currently there's no working implementation of this API for Windows, OSX and Linux environments that do not have NetworkManager setup.

These are currently replaced with a DummyNetwork implementation. The Dummy implementation returns nill values / empty lists where a return value is expected.

Create implentations for:

  • Windows
  • OSX
  • Linux environments that don't have NetworkManager (OSes other than ReswarmOS and Ubuntu)

No wifi networks are displayed in device-view

I get this error in the console when I click Scan Wifi:

image

the reagent log on this device:

{"level":"error","error":"device not found","caller":"/source/messenger/wamp.go:318","time":1617350218,"message":"An error occured during invocation of re.mgmt.da37c5d4-1836-4476-8c72-526a9cc4c1ee.scan_wifi_networks"}
{"level":"debug","caller":"/go/pkg/mod/github.com/rs/[email protected]/log.go:390","time":1617350218,"message":"[INVOCATION 357056 canceled by callee]\n"}
{"level":"error","error":"device not found","caller":"/source/messenger/wamp.go:318","time":1617350218,"message":"An error occured during invocation of re.mgmt.da37c5d4-1836-4476-8c72-526a9cc4c1ee.list_wifi_networks"}
{"level":"debug","caller":"/go/pkg/mod/github.com/rs/[email protected]/log.go:390","time":1617350218,"message":"[INVOCATION 357058 canceled by callee]\n"}
{"level":"error","error":"device not found","caller":"/source/messenger/wamp.go:318","time":1617350218,"message":"An error occured during invocation of re.mgmt.da37c5d4-1836-4476-8c72-526a9cc4c1ee.list_wifi_networks"}
{"level":"debug","caller":"/go/pkg/mod/github.com/rs/[email protected]/log.go:390","time":1617350218,"message":"[INVOCATION 357060 canceled by callee]\n"}

App Update procedure bug

Currently, if we run an app on a device but that app failed during the run then we see FAILED in actual status. If we make changes in the app and publish it again then we see that there is an update available with Override Status RUNNING and Actual Status as FAILED. In this case, if we try to update the app on the device then the update symbol will vanish and we think that the app is updated on the device but in reality, the app is not updated. If we want to update the app we have to first stop the app with actuall status STOPPED Override status STOPPED and then publish the app again. Now, if we update the app then it will be updated.

wget logs not pretty in log window

When running wget in dockerfile then

RUN wget https://storage.googleapis.com/ki-models/ai-models-conti-squeal-cnn/96_48_4_conv_no_bn_pooling_mean_32_256.hdf5

then output:

......
5208 .... 20% 5.88M 7s 5850K ...
5209 .
5210 ...... ..
5211 ........
5212 ........
5213 .. ......
5214 .... ....
5215 ...... 20% 6.67M 7s 5900K ..
5216 ........
5217 ........
5218 .. ......
5219 .... ....

cross-compile with CGO

straightforward cross-compiling is disabled with CGO enabled (e.g. for github.com/mattn/go-sqlite3)

meta call to crossbar takes too long causing ping pong to timeout

Currently whenever someone opens the log panel, a new subscription is created, this subscription event is subscribed to within the agent.

For the agent to know to which device this event belongs to we are required to get the URI of this subscription using a WAMP meta call.

Problem:
Call can take up to 3 seconds or more, blocking the Nexus WAMP client, causing a ping pong timeout.
The nexus WAMP client is implemented in a way that calls are handled in order, if one WAMP call is ongoing, it will block the rest of the client until this call has been handled. If in that time frame a ping pong is received, it will cause crossbar to think it has disconnected.

In general of a session call takes longer than a certain amount of time it can a ping pong response window to be missed.

Problem 2:
Using Golang's cancel API or setting a timeout option on the WAMP call does not always work. It's still possible for the WAMP call to timeout (5 seconds of no response which is the default timeout of the WAMP client for RPC calls)

Solution:
Call to get history from the frontend instead of checking the subscription event payload. This way we also resolve the issue of only first subscribers receiving log history

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.