HTTP Gateway

6 minutes read
Edit on GitHub

HTTP Gateway exposes the client’s REST API to manage user’s devices, as well as the Web UI known as plgd Dashboard.

SOURCE Copy
Copied
        docker pull ghcr.io/plgd-dev/hub/http-gateway:latest
    

A configuration template is available on http-gateway/config.yaml.

PropertyTypeDescriptionDefault
log.levelstringLogging enabled from level."info"
log.encodingstringLogging format. The supported values are: "json", "console""json"
log.stacktrace.enabledboolLog stacktrace.false
log.stacktrace.levelstringStacktrace from level."warn"
log.encoderConfig.timeEncoderstringTime format for logs. The supported values are: "rfc3339nano", "rfc3339"."rfc3339nano"

APIs of the HTTP Gateway service as defined uri and swagger for REST API.

PropertyTypeDescriptionDefault
apis.http.addressstringListen specification <host>:<port> for http client connection."0.0.0.0:9100"
apis.http.readTimeoutstringThe maximum duration for reading the entire request, including the body by the server. A zero or negative value means there will be no timeout.8s
apis.http.readHeaderTimeoutstringThe amount of time allowed to read request headers by the server. If readHeaderTimeout is zero, the value of readTimeout is used. If both are zero, there is no timeout.4s
apis.http.writeTimeoutstringThe maximum duration before the server times out writing of the response. A zero or negative value means there will be no timeout.16s
apis.http.idleTimeoutstringThe maximum amount of time the server waits for the next request when keep-alives are enabled. If idleTimeout is zero, the value of readTimeout is used. If both are zero, there is no timeout.30s
apis.http.tls.caPool[]stringFile paths to the root certificates in PEM format. The file may contain multiple certificates.[]
apis.http.tls.keyFilestringFile path to private key in PEM format.""
apis.http.tls.certFilestringFile path to certificate in PEM format.""
apis.http.tls.clientCertificateRequiredboolIf true, require client certificate.true
apis.http.websocket.streamBodyLimitintLimit a size for the buffer used while reading the grpc stream.262144
apis.http.websocket.pingFrequencystringPing frequency specifies the ping interval between pings.10s
apis.http.authorization.authoritystringAuthority is the address of the token-issuing authentication server. Services will use this URI to find and retrieve the public key that can be used to validate the token’s signature.""
apis.http.authorization.audiencestringIdentifier of the API configured in your OAuth provider.""
apis.http.authorization.http.maxIdleConnsintIt controls the maximum number of idle (keep-alive) connections across all hosts. Zero means no limit.16
apis.http.authorization.http.maxConnsPerHostintIt optionally limits the total number of connections per host, including connections in the dialing, active, and idle states. On limit violation, dials will block. Zero means no limit.32
apis.http.authorization.http.maxIdleConnsPerHostintIf non-zero, controls the maximum idle (keep-alive) connections to keep per-host. If zero, DefaultMaxIdleConnsPerHost is used.16
apis.http.authorization.http.idleConnTimeoutstringThe maximum amount of time an idle (keep-alive) connection will remain idle before closing itself. Zero means no limit.30s
apis.http.authorization.http.timeoutstringA time limit for requests made by this Client. A Timeout of zero means no timeout.10s
apis.http.authorization.http.tls.caPool[]stringFile paths to the root certificates in PEM format. The file may contain multiple certificates.[]
apis.http.authorization.http.tls.keyFilestringFile path to private key in PEM format.""
apis.http.authorization.http.tls.certFilestringFile path to certificate in PEM format.""
apis.http.authorization.http.tls.useSystemCAPoolboolIf true, use system certification pool.false
apis.http.authorization.tokenTrustVerification.cacheExpirationstringDuration for which a valid token is kept in a runtime cache before re-verification is required.30s

Client configurations to internally connect to GRPC Gateway service.

PropertyTypeDescriptionDefault
clients.grpcGateway.grpc.addressstringGRPC Gateway service address."127.0.0.1:9100"
clients.grpcGateway.grpc.tls.caPool[]stringFile paths to the root certificates in PEM format. The file may contain multiple certificates.[]
clients.grpcGateway.grpc.tls.keyFilestringFile path to private key in PEM format.""
clients.grpcGateway.grpc.tls.certFilestringFile path to certificate in PEM format.""
clients.grpcGateway.grpc.tls.useSystemCAPoolboolIf true, use system certification pool.false
clients.grpcGateway.grpc.keepAlive.timestringAfter a duration of this time if the client doesn't see any activity it pings the server to see if the transport is still alive.10s
clients.grpcGateway.grpc.keepAlive.timeoutstringAfter having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that the connection is closed.20s
clients.grpcGateway.grpc.keepAlive.permitWithoutStreamboolIf true, client sends keepalive pings even with no active RPCs. If false, when there are no active RPCs, Time and Timeout will be ignored and no keepalive pings will be sent.false

These configurations are for plgd Dashboard as described in here.

PropertyTypeDescriptionDefault
ui.enabledstringSet to true if you would like to run the web UI.false
ui.directorystringPath to default web ui built by nodejs"/usr/local/var/www"
ui.webConfiguration.authoritystringAuthority is the address of the token-issuing authentication server.""
ui.webConfiguration.httpGatewayAddressstringExternal address of Http gateway service.""
ui.webConfiguration.webOAuthClient.clientIDstringClient ID to exchange an authorization code for an access token.""
ui.webConfiguration.webOAuthClient.audiencestringIdentifier of the API configured in your OAuth provider.""
ui.webConfiguration.webOAuthClient.scopesstring arrayList of required scopes.""
ui.webConfiguration.deviceOAuthClient.clientIDstringClient ID to get an authorization code for the device.""
ui.webConfiguration.deviceOAuthClient.audiencestringIdentifier of the API configured in your OAuth provider.""
ui.webConfiguration.deviceOAuthClient.scopesstring arrayList of required scopes.""
ui.webConfiguration.deviceOAuthClient.providerNamestringName of provider, which needs to be set to cloud resource during cloud provisioning."plgd"
ui.webConfiguration.visibility.mainSidebar.certificatesboolShow certificates in the main sidebar.true
ui.webConfiguration.visibility.mainSidebar.chatRoomboolShow chat room in the main sidebar.true
ui.webConfiguration.visibility.mainSidebar.configurationboolShow configuration in the main sidebar.true
ui.webConfiguration.visibility.mainSidebar.deviceProvisioningboolShow device provisioning in the main sidebar.true
ui.webConfiguration.visibility.mainSidebar.devicesboolShow devices in the main sidebar.true
ui.webConfiguration.visibility.mainSidebar.docsboolShow docs in the main sidebar.true
ui.webConfiguration.visibility.mainSidebar.pendingCommandsboolShow pending commands in the main sidebar.true
ui.webConfiguration.visibility.mainSidebar.remoteClientsboolShow remote clients in the main sidebar.true
ui.webConfiguration.visibility.mainSidebar.snippetServiceboolShow snippet service in the main sidebar.true
ui.webConfiguration.visibility.mainSidebar.dashboardboolShow dashboard in the main sidebar.false
ui.webConfiguration.visibility.mainSidebar.integrationsboolShow integrations in the main sidebar.false
ui.webConfiguration.visibility.mainSidebar.deviceFirmwareUpdateboolShow device firmware update in the main sidebar.false
ui.webConfiguration.visibility.mainSidebar.deviceLogsboolShow device logs in the main sidebar.false
ui.webConfiguration.visibility.mainSidebar.apiTokensboolShow api tokens in the main sidebar.false
ui.webConfiguration.visibility.mainSidebar.schemaHubboolShow schema hub in the main sidebar.false

The plgd open telemetry exporter configuration.

PropertyTypeDescriptionDefault
clients.openTelemetryCollector.grpc.enabledboolEnable OTLP gRPC exporterfalse
clients.openTelemetryCollector.grpc.addressstringThe gRPC collector to which the exporter is going to send data""
clients.openTelemetryCollector.grpc.keepAlive.timestringAfter a duration of this time if the client doesn't see any activity it pings the server to see if the transport is still alive.10s
clients.openTelemetryCollector.grpc.keepAlive.timeoutstringAfter having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that the connection is closed.20s
clients.openTelemetryCollector.grpc.keepAlive.permitWithoutStreamboolIf true, client sends keepalive pings even with no active RPCs. If false, when there are no active RPCs, Time and Timeout will be ignored and no keepalive pings will be sent.true
clients.openTelemetryCollector.grpc.tls.caPoolstringFile path to the root certificate in PEM format which might contain multiple certificates in a single file.""
clients.openTelemetryCollector.grpc.tls.keyFilestringFile path to private key in PEM format.""
clients.openTelemetryCollector.grpc.tls.certFilestringFile path to certificate in PEM format.""
clients.openTelemetryCollector.grpc.tls.useSystemCAPoolboolIf true, use system certification pool.false
Note

Note that the string type related to time (i.e. timeout, idleConnTimeout, expirationTime) is decimal numbers, each with optional fraction and a unit suffix, such as “300ms”, “1.5h” or “2h45m”. Valid time units are “ns”, “us”, “ms”, “s”, “m”, “h”.

Oct 1, 2021

Get started

plgd makes it simpler to build a successful IoT initiative – to create a proof of concept, evaluate, optimize, and scale.

Get Started Illustration Get Started Illustration