Core Brightgate Software Stack

Brightgate Product Software

Directories

Directory Description
base/ Resource and Protocol Buffer message definitions
build/ Scripts to do with building and provisioning
client-web/ Web-based frontend
doc/ HTML product documentation
golang/src/bg/ Golang-based command, daemon, and library implementations

Directory naming

Name directories in snake case, as Python module names may not include - characters.

The "proto" area

Objects created by the install target are put into a per-platform directory called a proto area. The directory name starts with proto. and has the output of uname -m appended.

When dealing with appliance components, $ROOT is equivalent to ./proto.$(uname -m)/appliance/. On an imaged system, $ROOT is equivalent to /. Brightgate specific components are in $ROOT/opt/com.brightgate.

When dealing with cloud components, $ROOT is equivalent to ./proto.$(uname -m)/cloud/. Brightgate specific components are in $ROOT/opt/net.b10e/.

Installing Tools

Go (golang) and Node.js are needed to build. Current versions are:

Software Version
Go 1.14.6 (any 1.14.x is likely to work)
Node.js 8.11.2 (any 8.x is likely to work)

Building Product Software

GNU make is used to build the software components. Useful targets:

$ make install
$ make client-web
$ make client-web-dev
$ make test
$ make coverage
$ make check-go   # runs vet-go, lint-go, fmt-go
$ make packages
$ make doc
$ make doc-check

$ make clean
$ make clobber

The build system expects Go to be installed in /opt/net.b10e/go-<version> on Linux, and in /usr/local/go on macOS. If Golang is not installed in the location corresponding to your build platform, you may need to set $GOROOT in your environment before running make.

Building on macOS is unsupported, and unlikely to work fully, if at all, at any given point in time. It is recommended to build on Linux, where Debian 9 (Stretch) is the only regularly tested distribution.

Go Dependencies

Go dependencies, recorded in go.mod and go.sum, are supposed to be relatively self-maintaining. The go executable will typically update the files with new modules when it needs to, and a run of go mod tidy will remove stale ones.

When adding a new dependency, the simplest thing to do is to make the requisite changes to your sources (import the new package, do whatever with it) and then override GO_MOD_FLAG to nothing in order to allow go to update go.mod and go.sum appropriately:

$ make GO_MOD_FLAG=

Without that override, you'll get the error message import lookup disabled by -mod=readonly.

To update a dependency, there's a convenience target using the DEPNAME variable:

$ make godeps-update DEPNAME=path/to/module@version

The version tag can be any commit hash, branch, or tag. If you specify no @version (or @latest), then you get the latest tagged version.

A more aggressive update target is godeps-update-all, which upgrades the dependency and all of its dependencies. Normally, the latter are specified by the direct dependency. The default is to update the indirect dependencies to the latest patch of the same minor. Specify UPDATE_MINOR=1 to upgrade further. Specify UPDATE_TEST=1 to update test dependencies as well.

To remove a dependency, remove the use of the package from the sources and run make godeps-tidy.

When using the make targets, there is no need to or unset any $GO... environment variables. But when running go commands independently, you must cd to golang/src/bg and make sure that $GO111MODULE is set to on (unless you have $GOPATH set, which is largely no longer useful). This includes go doc (for docs of dependencies) and go test.

There is much more information at go help modules, go help module-get, go help mod edit (and other mod subcommands), as well as at the Golang Module Wiki.

Building Debian packages

While not required (you may run from the proto area), you may wish to build installable packages for ARM:

$ make packages
...
dpkg-deb: building package 'bg-appliance' in 'bg-appliance_0.0.1803052236-1_armhf.deb'.
...

$ sudo dpkg -i bg-appliance_0.0.1803052236-1_armhf.deb (use name from above)

If you replace an existing bg-appliance package, some amount of restarting, up to and including rebooting will be needed.

Cross-building from x86 to ARM

You can build the ARM bits on a (Linux) x86 platform, including packaging. Simply put GOARCH=arm into the environment, or add it to the end of the make commandline:

$ make packages GOARCH=arm

See build/cross-compile/README.md for more details.

Connecting to Cloud Backend

Our appliances talk to the cloud using a mixture of methods, primarily gRPC. At a minimum, request that a cloud secret be provisioned for your appliance. Install that to $APSECRET/rpcd/cloud.secret.json in order for your cloud connectivity to work. See below for the definition of $APSECRET, and build/gcp-appliance-reg/README.md for more details.

Appliance paths

On Debian-based appliances, we assume we can use apt and LSB directory hierarchies to organize our files in an LSB-compatible fashion. On OpenWrt-based appliances, we use a shared partition (/data) so that we can use an "update the inactive partition" approach.

Debian OpenWrt Proto area
APROOT / / $GITROOT/proto.$ARCH/appliance
APDATA $APROOT/var/spool $APROOT/data $APROOT/var/spool
APSECRET $APROOT/var/spool/secret $APROOT/data/secret $APROOT/var/spool/secret

APPACKAGE is equal to $APROOT/opt/com.brightgate on all platforms.

Note that APSECRET is a placeholder for eventual use of a TPM or other secure storage.

Running Appliance Software

Running From the Proto Area

sudo is used to acquire privilege from the developer during testing.

The ap.relayd daemon forwards UDP broadcast requests between security rings. To allow mDNS forwarding to work correctly, the Linux mDNS responder (avahi-daemon) must be disabled before launching our daemons:

$ sudo systemctl disable avahi-daemon
$ sudo systemctl stop avahi-daemon

Components are installed in $(ROOT)/opt/com.brightgate/bin. ap.mcp in that directory is the 'master control process', and is responsible for launching and monitoring all of our other daemons. Unless you're running in http-dev mode, ap.mcp must run as root for full functionality:

$ sudo ./proto.armv7l/appliance/opt/com.brightgate/bin/ap.mcp
aproot not set - using '/home/pi/Product/proto.armv7l/appliance/opt/com.brightgate'
2018/06/08 21:17:36 mcp.go:763: ap.mcp (3711) coming online...
2018/06/08 21:17:36 mcp.go:544: MCP online

Then switch to another window (so the log messages don't clutter up a terminal you're actively using; preferably, use the -l flag to ap.mcpd to send the log messages to the file named by its argument) and launch the remaining daemons:

$ ./proto.armv7l/appliance/opt/com.brightgate/bin/ap-ctl start all
$ ./proto.armv7l/appliance/opt/com.brightgate/bin/ap-ctl status all
      DAEMON   PID     RSS   SWAP   TIME        STATE               SINCE NODE
      ap.mcp 14484   25 MB   0 MB     0s       online  Fri Jun 8 21:17:36 gateway
     brokerd 14564   26 MB   0 MB     0s       online  Fri Jun 8 21:17:51 gateway
     configd 14581   29 MB   0 MB     0s       online  Fri Jun 8 21:17:53 gateway
      dhcp4d 14706   27 MB   0 MB     0s       online  Fri Jun 8 21:17:59 gateway
       dns4d 14619   34 MB   0 MB     0s       online  Fri Jun 8 21:17:57 gateway
     dnsmasq 14703    3 MB   0 MB     0s       online  Fri Jun 8 21:17:56 gateway
       httpd 14701   34 MB   0 MB     0s       online  Fri Jun 8 21:18:00 gateway
 identifierd 14620   61 MB   0 MB     0s       online  Fri Jun 8 21:17:59 gateway
        iotd 14582   39 MB   0 MB     0s       online  Fri Jun 8 21:17:55 gateway
        logd 14583   25 MB   0 MB     0s       online  Fri Jun 8 21:17:53 gateway
    networkd 14618   29 MB   0 MB     0s       online  Fri Jun 8 21:17:56 gateway
      relayd 14702   28 MB   0 MB     0s       online  Fri Jun 8 21:17:59 gateway
     updated 14621   39 MB   0 MB     0s       online  Fri Jun 8 21:17:56 gateway
   userauthd 14622   28 MB   0 MB     0s       online  Fri Jun 8 21:17:56 gateway
      watchd 14704   46 MB   0 MB     0s       online  Fri Jun 8 21:17:59 gateway

It may take a little while for all of the services to come online; some will pause in the blocked state waiting for a dependency.

Running From Installed Packages

We deliver one new service on the appliance: ap.mcp, which starts the master control process, which then launches all the daemons.

On the Raspberry Pi development platform (running Raspbian), it is controlled by systemd; thus:

$ sudo systemctl start ap.mcp

and any other systemd subcommand.

The Brightgate Model 100 runs an OpenWrt-based distribution, which uses its own init.d system for managing system services. On it, use:

$ sudo /etc/init.d/ap.mcp start

or any other valid subcommand.

Note that the package postinstall scripts automatically start the services, as well as stop avahi-daemon, so you don't need to do any of that manually as you do when running from the proto area.

The services set up ap.mcp to log to $APDATA/mcp.log. It will be created read-only by root, so you'll either have to use sudo to read it, or use chmod to change its permissions once it's been created.

All the executables are installed in /opt/com.brightgate/bin, which can be appended to $PATH for convenience.

Appliance Configuration

Configuring the appliance is beyond the scope of this document.

External Assets

Similar Resources

Slack bot core/framework written in Go with support for reactions to message updates/deletes

Slack bot core/framework written in Go with support for reactions to message updates/deletes

Overview Requirements Features Demo The Name Concepts Create Your Own Slackscot Assembling the Parts and Bringing Your slackscot to Life Configuration

Oct 28, 2022

⟁ Tendermint Core (BFT Consensus) in Go

⟁ Tendermint Core (BFT Consensus) in Go

Tendermint Byzantine-Fault Tolerant State Machines. Or Blockchain, for short. Branch Tests Coverage Linting master Tendermint Core is Byzantine Fault

Dec 26, 2022

A Go client for Google IoT Core

IoT A simple framework for implementing a Google IoT device. This package makes use of the context package to handle request cancelation, timeouts, an

Sep 26, 2022

Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.

Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.

Flamingo Framework Flamingo is a web framework based on Go. It is designed to build pluggable and maintainable web projects. It is production ready, f

Jan 5, 2023

Eudore is the core of a golang lightweight web framework.

Eudore eudore是一个golang轻量级web框架核心,可以轻松扩展成一个技术栈专用框架,具有完整框架设计体系。 反馈和交流请加群组:QQ群373278915。 Features 易扩展:主要设计目标、核心全部解耦,接口即为逻辑。 简单:对象语义明确,框架代码量少复杂度低,无依赖库。 易用

Nov 7, 2022

EditorConfig Core written in Go

Editorconfig Core Go A Editorconfig file parser and manipulator for Go. Missing features escaping comments in values, probably in go-ini/ini adjacent

Dec 28, 2022

Package git provides an incomplete pure Go implementation of Git core methods.

git Package git provides an incomplete pure Go implementation of Git core methods. Example Code: store := git.TempStore() defer os.RemoveAll(string(st

Oct 6, 2022

⟁ Tendermint Core (BFT Consensus) in Go

⟁ Tendermint Core (BFT Consensus) in Go

Tendermint Byzantine-Fault Tolerant State Machines. Or Blockchain, for short. Branch Tests Coverage Linting master Tendermint Core is Byzantine Fault

Dec 31, 2022

Eudore is the core of a golang lightweight web framework.

Eudore eudore是一个golang轻量级web框架核心,可以轻松扩展成一个技术栈专用框架,具有完整框架设计体系。 反馈和交流请加群组:QQ群373278915。 Features 易扩展:主要设计目标、核心全部解耦,接口即为逻辑。 简单:对象语义明确,框架代码量少复杂度低,无依赖库。 易用

Nov 7, 2022

Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.

Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.

Flamingo Framework Flamingo is a web framework based on Go. It is designed to build pluggable and maintainable web projects. It is production ready, f

Jan 5, 2023

Yet another SIP003 plugin for shadowsocks, based on Xray-core

Yet another SIP003 plugin for shadowsocks, based on Xray-core Build go build Usage See command line args for advanced usages.

Jan 8, 2023

Package core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go.

Package core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go. Background The twelve-factor methodology has pro

Nov 3, 2022

Open source 5G core network base on 3GPP R15

Open source 5G core network base on 3GPP R15

What is free5GC The free5GC is an open-source project for 5th generation (5G) mobile core networks. The ultimate goal of this project is to implement

Jan 4, 2023

Backpulse's core. Backpulse is an API Based CMS. Build you own website without worrying about the content administration system.

Backpulse core Backpulse is an API Based / Headless CMS. Your site's content is accessible directly via our RESTful API, on any web framework and any

Sep 11, 2022

parody of some of the basic python core features (collections package)

collections import "github.com/marcsantiago/collections" Overview Index Subdirectories Overview Index func StringEncoder(encoder *bytes.Buffer, data D

Jan 14, 2022

A Go idiomatic binding to the C++ core of PyTorch

GoTorch GoTorch reimplements PyTorch high-level APIs, including modules and functionals, in idiomatic Go. Thus enables deep learning programming in Go

Dec 29, 2022

BitClout core node

BitClout core node

About BitClout BitClout is a blockchain built from the ground up to support a fully-featured social network. Its architecture is similar to Bitcoin, o

Dec 22, 2022

A Go implementation of the core algorithm in paper Indexing Boolean Expression

Boolean Expression Indexer Go library A Go implementation of the core algorithm in paper Indexing Boolean Expression, which already supports the fol

Dec 26, 2022

The jin is a simplified version of the gin web framework that can help you quickly understand the core principles of a web framework.

jin About The jin is a simplified version of the gin web framework that can help you quickly understand the core principles of a web framework. If thi

Jul 14, 2022
Stack-Overflow Tags Monitor
Stack-Overflow Tags Monitor

stack-overflow monitor Simple stackoverflow monitor (tags based) Install go install github.com/butuzov/stackoverflow@latest Usage stackoverflow -h=wo

Dec 24, 2021
customer.io full stack engineer take home project
customer.io full stack engineer take home project

customer.io full stack engineer take home project

Jan 21, 2022
Gec is a minimal stack-based programming language

Gec is a minimal stack-based programming language

Sep 18, 2022
F' - A flight software and embedded systems framework

F´ (F Prime) is a component-driven framework that enables rapid development and deployment of spaceflight and other embedded software applications.

Jan 4, 2023
Software of development with Golang
Software of development with Golang

Go-Simple-Rest-Api Description This repository is a Software of Development with Go,Mux,etc Installation Using Go 1.16.3 Server preferably. DataBase U

Dec 13, 2021
software keyboard for TinyGo
software keyboard for TinyGo

tinykb tinykb is a software keyboard for TinyGo. To use tinykb, it is necessary to implement the driver.Displayer interface. It is still an alpha vers

Jan 14, 2022
The Bhojpur BSS is a software-as-a-service product used as an Business Support System based on Bhojpur.NET Platform for application delivery.

Bhojpur BSS - Business Support System The Bhojpur BSS is a software-as-a-service product used as an Business Support System based on Bhojpur.NET Platf

Sep 26, 2022
Package gostackparse parses goroutines stack traces as produced by panic() or debug.Stack() at ~300 MiB/s.

gostackparse Package gostackparse parses goroutines stack traces as produced by panic() or debug.Stack() at ~300 MiB/s. Parsing this data can be usefu

Dec 1, 2022
Elastic Stack Docker + Sample Go AppElastic Stack Docker + Sample Go App
Elastic Stack Docker + Sample Go AppElastic Stack Docker + Sample Go App

?? Elastic Stack Docker + Sample Go App Test Elastic Stack which includes Elasticsearch, Kibana, Filebeat and Metricbeat. It comes with a very simple

Jan 14, 2022
Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core network solution.
Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core network solution.

Connecting the Next Billion People Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core

Dec 31, 2022