recordevolution / devicemanagementagent Goto Github PK
View Code? Open in Web Editor NEWA daemon running on edge devices to establish a connection to the Reswarm router and manage apps and containers
License: Apache License 2.0
A daemon running on edge devices to establish a connection to the Reswarm router and manage apps and containers
License: Apache License 2.0
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,
when deciding how to execute the transition.
To avoid the download step on restart after failed.
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
Create a generic abstraction in case we want to switch container implementation in future
For Docker we should implement the following:
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”}’
Would be handy for testing mobile connections.
determine version of any binary by reagent -version
For e.g. whitelisting IP addresses
When someone presses BUILD in the devstudio it should work flawlessly with the current agent
As of ReswarmOS v0.2.9.2 the version number is included in the os-release file
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
All three parameters should be possible to read from the system with the script instead of asking the user.
In order to flawlessly build the agent in any environment (mac,linux,cloud) we need to setup some Dockerfile to build the agent binary
implement network management according to architectural draft:
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
This way not all devices don't all show up in the office
especially in low bandwidth scenarios the ping pong should have high priority.
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.
One extra feature would be to start containers with fixed resource assignment. (Docker allows that.) But this is something for next year.
implement API required for system management:
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)
There should be a failed counter to track the attempts. Not sure how to store this properly.
proper history will be implemented in later stage of development
to be able to break infinite crash cycles
This also helps users to see that their build is still progressing when the progress lines don't change
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:
I get this error in the console when I click Scan Wifi:
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"}
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.
e.g. if we want to use MQTT for example
because the state machine tries to produce a successful build again.
In dev mode it should not do that
Sometimes it seems that when an app fails, it's possible that it appears stuck in the 'RUNNING' state due to the observer not picking this up
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 .... ....
straightforward cross-compiling is disabled with CGO enabled (e.g. for github.com/mattn/go-sqlite3)
It seems that sometimes docker pull fails to authenticate when pulling an app on first boot
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.