Edge

ClearBlade Edge is an application to synchronize, configure, manage, and deploy IoT systems. It is designed to perform well on a constrained hardware platform and be managed and updated remotely post-deployment.

The ClearBlade Edge contains all the same features of the ClearBlade Platform, and is designed to be deployed in remote networks to interact with sensors, controllers, and industrial systems.

Click here for the edge tutorial.

Purpose

The projected scale of IoT is in magnitude of billions of devices creating and consuming data. ClearBlade has a solution built upon concept of distributed systems to accomplish this:

Distributed Systems - software system whose components are located on different computer networks

A System can have one or more Edges

An Edge is deployed to a particular network to capture, consume, and/or relay IoT data close to the source. Moving the computation closer to the data enables data processing that is magnitudes faster than what purely cloud-based IoT Platforms can offer.

To learn about creating and installing an edge,click here

Requirements

Edge requires Linux and runs on nearly every CPU available. Also, see List of Distro Version Supported

OS RAM Storage
Linux 64MB 64MB

CPUs Supported:

x86* arm PowerPC MIPS s390x
amd64 (x86_64) arm64 ppc64le mips64le s390x
386 armv7 ppc64 mips64
armv6 mipsle
armv5 (TEJ only) mips

Functionality

  • Strong edge security - Encryption, authentication and authorization of API access including tokens and certificates. Sync and state management - Both user and device states are synced with IoT systems as devices go on and offline.
  • Offline Continuity – Devices continue real time behaviors and 100% up time, even when connection to the Internet is lost.
  • Strong integration capabilities – Connectivity via MQTT, REST and sockets along with prebuilt patterns for BLE, Zigbee, MQTT-SN and more.
  • Data filtering and streaming - Store, modify, analyze, manage and route data at the edge.
  • Business rules and events - Implement business rules, trigger and react to events, and analyze results via business logic locally.
  • Messaging – Scalable, secure brokering of messages between devices and users at the edge.
  • Deployment flexibility – ClearBlade EDGE can be deployed onto a broad range of gateway devices.

Installing Edge

Edge Platform Application with Web Frontend (Data Visualization, Portals and Developer Console)

  • Select one of popular OS / CPU Architecture combinations (see full list below):
OS-ARCH
linux-amd64
darwin-amd64
linux-arm64
linux-armv7
linux-armv6
linux-armv5
  • Verify which version needs to be installed. For the edge to work, we recommend the edge, platform & console version should match. There is a chance things will work fine, however having mismatched versions is highly advised against.

Refer the below script to perform the installations.

# Replace OSARCH if needed
OSARCH=linux-amd64
curl -fsSL https://get.clearblade.com -o get-clearblade.sh
sh get-clearblade.sh edge $OSARCH
sh get-clearblade.sh cb_console $OSARCH

Configuration

There are two ways to configure an Edge:

Configuration File

Recommended: Get the latest version of the toml file using edge -h

Title = "ClearBlade Configuration File"

[Debug]
DevelopmentMode = false # (boolean) Enables debug messages and triggers. Used only for development
DisablePprof = true # (boolean) This will disable pprof output file creation and pprof web-server creation if set to true
PprofCPUInterval = 10 # (int) The length of time, in minutes, to wait between successive pprof cpu profile generations
PprofHeapInterval = 10 # (int) The length of time, in minutes, to wait between successive pprof heap profile generations
PprofMaxFiles = 30 # (int) The maximum number of cpu and heap profiles to retain. 0 indicates keep all of them
PprofMaxFileAge = 1440 # (int) The maximum amount of time, specified in minutes, in which to retain cpu and heap profile data files
DumpRoutes = false # (boolean) Dump the routes being served for diagnostic purposes

[LeanMode]
LeanMode = false # (boolean) Stop storing analytics, message history and code logs if set to true
StoreAnalytics = true # (boolean) Stop storing analytics if set to false
StoreMessageHistory = true # (boolean) Stop storing message history if set to false
StoreCodeLogs = true # (boolean) Stop storing code logs if set to false
MaxPageSize = 1000 # (int) Maximum page size for analytics calls

[Logging]
Logfile = "" # (string) Location of logfile. If the value "stderr" or "stdout" are supplied, then it will forward to their respective file handles
MaxLogFileSizeInKB = -1 # (int64) Maximum size of log file before rotation in KB. Must be greater than 100 KB. -1 indicates no limit
MaxLogFileBackups = 1 # (int) Maximum backups of the log file. Must be greater than 1
LogLevel = "info" # (string) Raise minimum log-level (debug,info,warn,error,fatal)

[Edge]
EdgeID = "" # (string) Edge name
PlatformIP = "" # (string) The IP address of the platform without port
PlatformPort = "8951" # (string) RPC port of the platform. Defaults to 8951 for TLS
EdgeCookie = "" # (string) The cookie for the edge's session
ParentSystemKey = "" # (string) The parent system of the edge
EdgeIP = "localhost" # (string) The edge's IP. Defaults to localhost
EdgePrivateIP = "localhost" # (string) The edge's IP. Defaults to localhost
  [Adaptors]
  AdaptorsRootDir = "" # (string) Directory where adaptor files are stored. Defaults to ./
  [Provisioning]
  ProvisioningMode = false # (boolean) Need to provison (point at a platform) before edge is functional (default: false)
  ProvisioningSystem = "" # (string) System key of the provisioning system (default: '')
  ProvisionalSqliteAdmin = "./prov_clearblade.db" # (string) Location of the provisioning sqlite admin db file
  ProvisionalSqliteUserdata = "./prov_clearblade_users.db" # (string) Location of the provisioning sqlite userdata db file

[FileHostingConfig]
URL = "http://localhost:8915" # (string) URL with port for the file hosting server. Defaults to http://localhost:8915
EdgeBinaryLocation = "/edge/" # (string) Location where the edge binaries are stored on the file hosting server

[Triage]
PerformTriage = (bool) Turns triaging on and off (default on)
TriageDays = (int) Number of days to keep triage information in the database
TriageIntervalMinutes = (int) How often in minutes to report triage information

[HTTP]
HttpPort = ":9000" # (string) Listen port for HTTP server
HttpURL = "https://platform.clearblade.com" # (string) External URL for the platform
TimeProfile = -1 # (int64) Enables time profiling of HTTP requests (in ms). Default is disabled (-1)

[KVStore]
Store = "local" # (string) Specifies which KVStore to use. Supported stores are local and redis
Address = "" # (string) Address of the Redis server. Empty if using local store
Port = "" # (string) Redis port. Empty if using local store
Password = "" # (string) Redis username. Empty if using local store

[Security]
Tls = false # (boolean) Enable TLS
Key = "" # (string) Location of TLS key file
Cert = "" # (string) Location of TLS cert file
ExpireTokens = true # (boolean) Set to invalidate user/device tokens issued more than the system's tokenTTL (defaults to 5 days). Dev tokens will not be removed
InsecureAuth = false # (boolean) Disables password hashing if set to true. Used only for development
Insecure = false # (boolean) Disables edge to platform TLS communication if set to true. Used only for development

[MQTT]
BrokerTCPPort = ":1883" # (string) Listen port for MQTT broker
BrokerTLSPort = ":1884" # (string) TLS listen port for MQTT broker
BrokerWSPort = ":8903" # (string) Websocket listen port for MQTT broker
BrokerWSSPort = ":8904" # (string) TLS websocket listen port for MQTT broker
MessagingAuthPort = ":8905" # (string) Listen port for MQTT Auth broker
MessagingAuthWSPort = ":8907" # (string) Websocket listen port for MQTT Auth broker
UseTLSMessagingAuth = false # (boolean) Use TLS for MQTT Auth broker
MaxPublishSize = 1e9 # (unit64) Maximum MQTT publish packet size
MessagingURL = "messaging.clearblade.com" # (string) Used to configure the external messaging url for the platform. May be proxied

[Bus] # Deprecated
ScoringFunction = "" # (string) The name of the scoring function to use
ClusterNodes = "" # (string) Overrides 'Nodes' in bus config filer
BusConfFile = "" # (string) Configuration file for the Bus

[Database]
DBStore = "postgres" # (string) Database store to use. postgres for platform and sqlite for edge
DBHost = "127.0.0.1" # (string) Address of the database server
DBPort = "5432" # (string) Database port
DBUsername = "myUser" # (string) Username for connecting to the database
DBPassword = "myPassword" # (string) Password for connecting to the database
Local = false # (boolean) Use only local cache for storage. Used only for development
SqliteAdmin = "" # (string) Location for storing sqlite admin database file
SqliteUserdata = "" # (string) Location for storing sqlite admin database file
DBType = "postgres" # (string) Similar to DBStore. postgres for platform and sqlite for edge
Logging = false # (boolean) Additional logging for postgres
MaxMySQLDBConnections = 5 # (int) Max # of connections to MySQL to open, per collection

[License]
PKey = "" # (string) Platform Key Issued by ClearBlade
RegistrationKey = "" # (string) Key required for creating a new developer account

[Sync]
SyncTransport = "mqtt" # (string) (Deprecated)
E2PInsertOnDeploy = true # (boolean) Disables or enables e2p insert behaviour when only deploy is set in a deployment
SyncOptimize = false # (boolean) Optimizes the syncing process if set to true
SyncOptimizeExceptions = "" # (string) Exceptions for the sync optimization process
SyncOptimizations = "" # (string) List specific optimizations to run. Default is all
SyncDistributeWaitTime = 1 # (int) How long to wait before distributing asset sync events

[MessageHistory]
DeletionEnabled = false # (boolean) Sets the default setting for message history autodeletion for new systems
ExpirationAgeSeconds = 1209600 # (int64) Sets the default setting for new systems for age at which a message should be deleted
MaxRowCount = 10000 # (int) Sets the default setting for new systems for maximum rows after message history deletion
MaxSizeKb = 15000 # (int) Sets the default setting for message history maximum size for new systems
TimePeriodDeleteMsgHistory = 120 # (int) Set the time interval to periodically erase msgHistory and analytics{Time.seconds}

[RPC]
RPCTransport = "tcp" # (string) Transport layer for RPC communications
RPCPort = "8950" # (string) Listen port for external RPC server. Used to edge to platform communication
RPCPortInternal = "8952" # (string) Listen port for internal RPC server. Used to node to node communication
RPCTimeout = 30 # (int) Timeout for all RPC calls either within the platform or from platform to edge
RPCKeepaliveInterval = 60 # (int) Keepalive interval for RPC connections

[Cluster]
HostAddress = "" # (string) The IP address for other clustered nodes to contact this platform

Flags

Default Config, Required Flags

TLS: Enabled

Parameter Type Desc Example
platform-ip string ClearBlade Platform URL platform.clearblade.com
parent-system string System Key for this Edge’s Parent System f49bf79f0b9ac5eda5aba4e08c17
edge-id string name for this Edge, aliased as edge-id in the config my-edge
edge-cookie string token for edge 5eda5aba4e08c17

Command:

edge -platform-ip=<PLATFORM_URL> -parent-system=<SYSTEM_KEY> -edge-id=<EDGE_ID> -edge-cookie=<EDGE_COOKIE>

Example:

edge -platform-ip=platform.clearblade.com -parent-system=f49bf79f0b9ac5eda5aba4e08c17 -edge-id=my-edge -edge-cookie=5eda5aba4e08c17

Non-TLS Config

TLS: False (Not Recommended)

Parameter Type Desc Example
see required
insecure boolean Connect MQTT over non-TLS true

Command:

edge -platform-ip=<PLATFORM_URL> -parent-system=<SYSTEM_KEY> -edge-id=<EDGE_ID> -edge-cookie=<EDGE_COOKIE> -insecure=true -platform-port=<NONTLS_PORT>

Example:

edge -platform-ip=platform.clearblade.com -parent-system=f49bf79f0b9ac5eda5aba4e08c17 -edge-id=my-edge -edge-cookie=5eda5aba4e08c17 -insecure=true -platform-port=8950

Enhanced Performance

Parameter Type Desc Example
see required
lean-mode boolean Drop code service logs, TODO true
edge -platform-ip=<PLATFORM_URL> -parent-system=<SYSTEM_KEY> -edge-id=<EDGE_ID> -edge-cookie=<EDGE_COOKIE> -lean-mode=true
edge -platform-ip=platform.clearblade.com -parent-system=f49bf79f0b9ac5eda5aba4e08c17 -edge-id=my-edge -edge-cookie=5eda5aba4e08c17 -lean-mode=true

Use with Web Console

Parameter Type Desc Example
see required
edge-ip string IP Address on selected interface, or 0.0.0.0 for all interfaces 192.168.0.34

By default, an edge is only accessible via localhost interface, localhost or 127.0.0.1. In order for other IP-enabled devices to interact with the ClearBlade Edge, set this value to the IP Address of Edge, or 0.0.0.0 to expose Edge to all interfaces.

Syncing

When an asset is updated on platform, the update is sent to all edges if it is declared by the deployment. Vice versa, when you update an asset on one edge, the update occurs in the other edges and the platform. In the event of a disconnection, the platform stores the sync updates and it is queued for when the edge reconnects.

Advanced

Full list of supported OSARCH

OSARCH
linux-amd64
linux-386
linux-armv7
linux-arm64
linux-armv6
linux-armv5 (TEJ only)
linux-mipsle
darwin-amd64
darwin-386
linux-ppc64le
linux-s390x
linux-mips
linux-mips64
linux-mips64le

Linux Distros Supported

OS Compatible
darwin yes
dragonfly yes
freebsd yes
linux yes
netbsd yes
openbsd yes
plan9 yes
solaris yes
windows no
Distros Minimum Required Release Date Details
Linux (Kernel) 2.6.23 2007-10-01 Details
RHEL 6.0 2010-11-09 Details
Debian 5.0 (Lenny) 2009-02-14 Details
Fedora 8 (Werewolf) 2007-11-08 Details
CentOS 6.0 2011-07-10 Details
SUSE 11.0 2009-03-24 Details
Ubuntu 8.04 2008-04-24 Details

More…

FAQ

  1. What are hardware requirements to run ClearBlade Edge?

  2. How does a ClearBlade Edge connect to a ClearBlade Platform?

    • ClearBlade Edge makes an outbound encrypted MQTT connection to a platform, which enables a bidirectional data transport.
  3. Do I need to modify my private network’s firewall to run a ClearBlade Edge?

    • No. Firewall changes are required to ‘run’ the ClearBlade edge as long as the platform instance, devices it connects to are in the same private network.
  4. What firewall changes do I need if I am trying to access ClearBlade edge from an outside network?

    • One should ensure that the firewall of the network the edge is in, allows ports 9000 for http(s), 18831884 & 8905-8906 for MQTT, 8903-8904 & 8907-8908 for Websockets(if using them, usually web console attempts to connect to the edge using web-sockets).
  5. How do I forward an MQTT message from an Edge client up to ClearBlade Platform?

    • The ClearBlade Message Relay is a way for Edge MQTT messages to relay messages up to the Platform’s MQTT Broker or other Edge brokers.
  6. How do I configure ClearBlade Edge to startup on boot?

  7. What features are available on the ClearBlade Edge?

    • ClearBlade edge platform is the lite version of the ClearBlade platform. So all the features of the platform are available at the edge.
  8. How can I create a collection that is only on the Edge?

    • Log in to the Edge you want to create a collection on. Follow the process on how to create a collection as you would do on the platform. Note: There is no way to sync collections on the Edge to the cloud
  9. How can I create a trigger that only runs on the Edge?

    • Go to Deployments in the platform. Make sure the Deploy and Sync checkboxes next to ‘Name’ under Triggers is unchecked. Then log in to the Edge you want the trigger to run on and either create a service or choose an existing one. In the code service, create a trigger. The trigger should only run on that Edge.
  10. How do device updates on Edge get updated on other Edges and the platform?

    • Go to the Devices section under Assets in Deployment. Select Sync Table and choose all Edges for deployment. Verify by changing data in one edge and see if it updates in the other edges and platform. You can refer to Syncing to read how the mechanism works.

Sync

  1. How can I transfer collection data to the Edge?

    • Go to Deployments and click Collections . Choose Sync Table on the collection(s) that you want the data to transfer to the Edge. Make sure you mark the checkbox for the Edge(s) you want the data to transfer to. Click here to learn more about collection deployment and here to learn about the syncing mechanism.
  2. How can I create a trigger that only runs on the Edge?

    • Go to Deployments in the platform. Make sure the Deploy and Sync checkboxes next to ‘Name’ under Triggers is unchecked. Then log in to the Edge you want the trigger to run on and either create a service or choose an existing one. In the code service, create a trigger. The trigger should only run on that Edge.
  3. How do device updates on Edge get updated on other Edges and the platform?

    • Go to the Devices section under Assets in Deployment. Select Sync Table and choose all Edges for deployment. Verify by changing data in one edge and see if it updates in the other edges and platform. You can refer to Syncing to read how the mechanism works.