Speed Demon Agent 
The Speed Demon Agent is a software agent intended, ideally, to be daemonized
(run in the background) on, ideally, an always-on device. Once running, the
agent will execute speed tests at periodic intervals. The canonical use case for
the Speed Demon Agent is installation on a Raspberry Pi or similar device.
Kicking the tires
Placeholder
Installation on a Raspbery Pi
Placeholder
Configuration
Placeholder
Development
The Speed Demon Agent is implemented in Go and additionally utilizes Glide for
dependency management. Executing end-to-end tests (manually, for now) also
requires the Speed Demon Collector micro-service. In order to obviate the need
for managing precise versions of any of the aforementioned tools or assets, the
Speed Demon Agent leverages a fully containerized development environment.
Hacking on the Speed Demon Agent, therefore, does not require you to even have
Go or Glide installed on your local system. The only requirements are:
- GNU Make
- Docker
- Docker Compose
Any fairly recent version of the above tools should suffice.
Convenient make targets are provided in order to establish a streamlined
development and testing workflow. These targets are summarized in the following
sections.
Common targets
bootstrap: This is the first target you should run after initially cloning
this repository (or any time you switch branches). This performs dependency
resolution using Glide within the containerized development environment.
test: Execute unit tests within the containerized development environment.
run: Runs the containerized Speed Demon Collector service, on which the
agent depends, then builds and runs the Speed Demon Agent in the containerized
development environment. Both will continue running until interrupted with
ctrl
+ c
.
clean: Deletes all built binaries and destroys all project-related
containers-- even those that have already exited. If you're at all concerned
about the state of running or suspended containers, this will guarantee a fresh
start.
Less common targets
build-dev-env: This target seldom needs to be invoked manually. It will
rebuild the development environment from the source Dockerfile
, therefore it
only needs to be run when the development environment itself is being redefined.
This is rare.
dev: This target permits developers to step into an interactive bash shell
within the containerized development environment. This permits exploration and
execution of arbitrary commands within that environment.
glideup: This target is similar to bootstrap
, but used less frequently.
This uses Glide within the containerized development environment to upgrade
all dependencies. This will not only resolve all upgraded dependencies, but also
update the glide.lock
file. Do not use this target if you do not understand
Glide well.
build: This target will use the containerized development environment to
build a statically linked linux/amd64 binary. The run
target uses this under
the covers, as does the docker-build
target.
docker-build: This will build a "production" Speed Demon Docker image. The
canonical use case for the Speed Demon Agent is installation on a Raspberry Pi
or similar device, and Docker is not required to facilitate that. The intent
behind the "production" image, therefore, is not actual use, but rather to
provide a lightweight, Debian-based image that, due to Debian's similarity to
Raspbian, is a reasonable approximation of the environment where the Speed Demon
Agent is actually intended to run. This permits those without access to a
Raspberry Pi to easily experiment with the Speed Demon Agent. (See the Kicking
the tires section.)
docker-push: Pushes the "production" Docker image to a Docker registry. The
precise location one pushes to can be controlled through the SD_IMAGE_PREFIX
environment variable. Setting SD_IMAGE_PREFIX=krancour
, for instance, will
result in the image being pushed to hub.docker.com/krancour/agent:<version>
.
SD_IMAGE_PREFIX=quay.io/krancour
would result in the image being pushed to
quay.io/krancour/agent:<version>
. Note, you must be pre-authenticated to
whatever registry you push to. There's seldom a need for anyone to make use of
this, unless you intend to produce customized images and push them to your own
registry. For the most part, this target is utilized exclusively by CI to
publish official Speed Demon Agent images only after all tests have passed.
pi-build: This target will use the containerized development environment to
cross-compile a statically linked linux/arm binary suitable for installation on
a Raspberry Pi.
pi-push: Installs the linux/arm binary and configration file on a Raspberry
Pi.