Closed brycedjohnson closed 5 months ago
@brycedjohnson, it is nice to see someone pushing for Buildroot support. We try very hard to keep backward compatibility with old agents so we don't expect problems.
Hi @otavio, I had a look at this and did some experimenting. Currently buildroot assumes we are building out of the root of repo and not in a sub directory. https://lore.kernel.org/buildroot/20230624152713.GY24952@scaer/T/
So at this time either buildroot would need work to build out of subdirectories or shellhub agent would need to be living in its own repo. I'm going to clone the agent into its own repo for a test to see if I can get it building in the short term.
It's disappointing that there's no support for building a particular subdirectory in Buildroot but adding the support for it would be a nice contribution, for sure.
Decided the agent was a little too large for our resource constrained device, so decided to implement a reverse ssh tunnel for the devices.
But here is the buildroot mk file if anyone else wanted to try it. Took some broad strokes to shrink it down and had it working on 20 devices reporting in.
I'm not using systemd but rather s6, so a systemd service would probably required for most people, but most of that could be copied from the yocto version.
################################################################################
#
# SHELLHUB_AGENT
#
################################################################################
SHELLHUB_AGENT_VERSION = 8bc37136c254b37f0b5c86f3901bb5758e97c4e8
SHELLHUB_AGENT_SITE = $(call github,brycedjohnson,shellhub-agent,$(SHELLHUB_AGENT_VERSION))
SHELLHUB_AGENT_LICENSE = Apache-2.0
SHELLHUB_AGENT_LICENSE_FILES = LICENSE.md
SHELLHUB_AGENT_DEPENDENCIES = libxcrypt
SHELLHUB_AGENT_LDFLAGS = -X main.AgentVersion=0.1.0
SHELLHUB_AGENT_BIN_NAME = shellhub-agent
SHELLHUB_AGENT_INSTALL_BINS = $(SHELLHUB_AGENT_BIN_NAME)
$(eval $(golang-package))
@brycedjohnson We're really sad to hear that you decided not to use ShellHub.
Decided the agent was a little too large for our resource constrained device, so decided to implement a reverse ssh tunnel for the devices.
I'd like to know more details about how large the ShellHub agent is for the device: Is it regarding the size of the binary or the memory consumption? Additionally, I'm curious to know what would be considered acceptable for the resource-constrained device.
But here is the buildroot mk file if anyone else wanted to try it. Took some broad strokes to shrink it down and had it working on 20 devices reporting in.
I really appreciate all your efforts to support ShellHub on Buildroot. If you ever change your mind or need any help, feel free to reach out. Thanks for your contribution! 😊
SHELLHUB_AGENT_SITE = $(call github,brycedjohnson,shellhub-agent,$(SHELLHUB_AGENT_VERSION))
@Drakonis is working on providing an agent tarball to simplify the compilation process, eliminating the need to maintain a separate repository like you did.
Our Buildroot fork: https://github.com/shellhub-io/buildroot
@gustavosbarreto I'm likely going to use ShellHub for other uses. This particular one is a special case where the the device isn't always on wifi and we need to transfer a delta image over a much lower bandwidth wireless connection. I had gotten the agent down to ~8MB (4MB compressed). Our whole image compressed is only 50MB so that increases size quite a bit (in our case). For many people I'm sure that wouldn't matter.
We are watching ram usage as well, was about 11MB rss and for some reason 796MB vsz (although really only the rss matters, but the vsz did seem large). The reverse ssh tunnel isn't nearly as nice and required some extra work, but the additional size and ram are pretty negligible since we already had everything already in our build.
Also this package was our own go package currently, so adding it in increase our clean build time a bit since the go toolchain takes a few steps in buildroot (and only recently is getting 1.20 support, not sure if that was merged in yet...)
My agent build I'm sure was not optimal, so I'll be happy to check out when someone that knows go and shellhub has a crack at it!
@brycedjohnson https://github.com/shellhub-io/shellhub/discussions/3744
Description
Hi All, I wanted to test out running shellhub on a small embedded linux device without docker that runs on buildroot.
I looked at the previous issue: https://github.com/shellhub-io/shellhub/issues/2615 with suggestions to look at the current yocto build.
I'm part way through adding the package. Looks like v0.12.3 requires go v1.20 (Doc here says 1.18 - https://docs.shellhub.io/developers/agent/installing) Currently on master buildroot only 1.19.10 is included.
There is a patch here to bump it to 1.20.5 which is what I currently applied, but that will need to be pulled into before a shellhub package would be added. https://patchwork.ozlabs.org/project/buildroot/list/?series=358451
I'll keep this issue open if I run into anymore problems. Anyone else using buildroot with shellhub? Is there any problems with the agents and the server versions getting out of sync? The devices I am using have a low bandwidth connection so they are not updated as frequently.
Edition
Community
Version
12.3