feature(agent,pkg): add connector mode #3809
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ShellHub Connector is a new kind of ShellHub Agent that turns Docker
containers into ShellHub Devices. It instances a new ShellHub Agent, in
memory, for each container running, redirecting the SSH IO, connections
in general, and authentication credentials to the container its file
system.
The initial implementation has support for these kinds of connections:
To initialize the ShellHub Connector, enter the
agent/
directory, build andrun the agent's binary with connector sub command.
To configure the ShellHub Connector, you can/must provide these environmental
variables.
SERVER_ADDRESS (required) Set the ShellHub server address of the
agent will use to connect
PRIVATE_KEYS (required) Specify the path to store the devices/containers
private keys. If not provided, the agent will generate a new one.
TENANT_ID (required) Sets the account tenant ID used during communication
to associate the devices to a specific tenant.
KEEPALIVE_INTERVAL Determine the interval to send the keep alive message to
the server. This has a direct impact on the bandwidth used by the device when
in idle state.
As this implementation uses the Docker Client, you can override the environment
variables provided for Docker in order to change some behaviors, but the
ShellHub Connector doesn't guarantee its right operation with these changes.
Check [Docker Client documentation about
this](https://pkg.go.dev/github.com/docker/[email protected]+incompatible/client#
FromEnv) for more information.