alice-lg

module
v0.0.0-...-4a05471 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2024 License: BSD-3-Clause

README

Alice-LG - Your friendly looking glass

"No, no! The adventures first, explanations take such a dreadful time."
Lewis Carroll, Alice's Adventures in Wonderland & Through the Looking-Glass

Take a look at Alice-LG production examples at:

And checkout the API at:

Breaking Changes

6.0.0

With the new functional react UI, the DOMContentLoaded event can no longer be used for injecting additional content. Please use Alice.onLayoutReady(function(main) { ... }); instead.

5.1.0

The spelling of "neighbors" is now harmonized. Please update your config and replace e.g. neighbour.asn with neighbor.asn (in case of java script errors).

Explanations

Alice-LG is a BGP looking glass which gets its data from external APIs.

Currently Alice-LG supports the following APIs:

Birdwatcher

Normally you would first install the birdwatcher API directly on the machine(s) where you run BIRD on and then install Alice-LG on a seperate public facing server and point her to the afore mentioned birdwatcher API.

This project was a direct result of the RIPE IXP Tools Hackathon just prior to RIPE73 in Madrid, Spain.

Major thanks to Barry O'Donovan who built the original INEX Bird's Eye BIRD API of which Alice-LG is a spinnoff

GoBGP

Alice-LG supports direct integration with GoBGP instances using gRPC. See the configuration section for more detail.

OpenBGPD

Alice-LG supports OpenBGP via bgplgd and openbgpd-state-server.

Building Alice-LG from scratch

These examples include setting up your Go environment, if you already have set that up then you can obviously skip that

CentOS:

First add the following lines at the end of your ~/.bash_profile:

GOPATH=$HOME/go
export GOPATH
PATH=$PATH:$GOPATH/bin
export PATH

Now run:

source ~/.bash_profile

# Install frontend build dependencies
sudo yum install golang npm
sudo npm install --global yarn

mkdir -p ~/go/bin ~/go/pkg ~/go/src/github.com/alice-lg/

cd ~/go/src/github.com/alice-lg
git clone https://github.com/alice-lg/alice-lg.git

cd alice-lg
make

Your Alice-LG source will now be located at ~/go/src/github.com/alice-lg/alice-lg and your alice-LG executable should be at ~/go/src/github.com/alice-lg/alice-lg/bin/alice-lg-linux-amd64

Configuration

An example configuration can be found at etc/alice-lg/alice.example.conf.

You can copy it to any of the following locations:

etc/alice-lg/alice.conf        # local
etc/alice-lg/alice.local.conf  # local
/etc/alice-lg/alice.conf       # global

You will have to edit the configuration file as you need to point Alice-LG to the correct backend source. Multiple sources can be configured.

Birdwatcher:

[source.rs1-example-v4]
name = rs1.example.com (IPv4)
[source.rs1-example-v4.birdwatcher]
api = http://rs1.example.com:29184/
neighbors_refresh_timeout = 2
# show_last_reboot = true
# timezone = UTC
# type = single_table / multi_table
type = multi_table
# not needed for single_table
peer_table_prefix = T
pipe_protocol_prefix = M

[source.rs1-example-v6]
name = rs1.example.com (IPv6)
[source.rs1-example-v6.birdwatcher]
api = http://rs1.example.com:29186/

GoBGP:

[source.rs2-example]
name = rs2.example.com
group = AMS

[source.rs2-example.gobgp]
# Host is the IP (or DNS name) and port for the remote GoBGP daemon
host = rs2.example.com:50051
# ProcessingTimeout is a timeout in seconds configured per gRPC call to a given GoBGP daemon
processing_timeout = 300

Configure TLS with:

tls_crt = /path/to/cert
tls_common_name = "common name"

You can disable TLS with insecure = true.

OpenBGPD via openbgpd-state-server:

[source.rs-example]
name = rs-example.openbgpd-state-server

[source.rs-example.openbgpd-state-server]
api = http://rs23.example.net:29111/api

# Optional response cache time in seconds
# Default: disabled (0)
cache_ttl = 100

OpenBGPD via bgplgd:

[source.rs-example]
name = rs-example.openbgpd-bgplgd

[source.rs-example.openbgpd-bgplgd]
api = http://rs23.example.net/bgplgd

# Optional response cache time in seconds
# Default: disabled (0)
cache_ttl = 100

Running

Launch the server by running

./bin/alice-lg-linux-amd64

Customization

Alice now supports custom themes! In your alice.conf, you now can specify a theme by setting:

[theme]
path = /path/to/my/alice-theme

with the optional parameter (the "mountpoint" of the theme) url_base = /theme

You can put assets (images, fonts, javscript, css) in this folder.

Stylesheets and Javascripts are automatically included in the client's html and are served from the backend.

Alice provides early stages of an extension API, which is for now only used to modify the content of the welcome screen, by providing a javascript in your theme containing:

Alice.updateContent({
    welcome: {
        title: "My Awesome Looking Glass",
        tagline: "powered by Alice"
    }
});

A callback for running custom javascript after the base application was initialized can be installed using:

Alice.onLayoutReady(function(page) {
    // page is the layout HTML root element
});

For an example check out: https://github.com/alice-lg/alice-theme-example

Hacking

The client is a Single Page React Application. All sources are available in ui/.

Yarn is required for building the UI.

Create a fresh UI build with

cd ui/
make

This will install all dependencies with yarn install and run yarn build.

As this is a create-react-app application, react-scripts are present and you can just run a development server using yarn start.

All this available as a containerized environment:

Running docker-compose up in the ./dev will build and start the backend and run a webpack dev server for the UI.

The UI is then available on http://localhost:3000/ and on http://localhost:7340/ the backend will serve the API.

Sponsors

The development of Alice is now sponsored by

DE-CIX Logo

Many thanks go out to ECIX, where this project originated and was backed over the last two years.

Support for OpenBGPD was sponsored by the Route Server Support Foundation.

Directories

Path Synopsis
cmd
db
pkg
api
Package api contains the datastructures for the Alice API.
Package api contains the datastructures for the Alice API.
caches
Package caches provides various implementation of all sorts of caches.
Package caches provides various implementation of all sorts of caches.
config
Package config provides runtime configuration for the Alice Looking Glass.
Package config provides runtime configuration for the Alice Looking Glass.
decoders
Package decoders contains functions for decoding backend responses into internal datastrucures.
Package decoders contains functions for decoding backend responses into internal datastrucures.
http
Package http provides the server and API implementation for the webclient.
Package http provides the server and API implementation for the webclient.
pools
Package pools provides deduplication pools for strings and lists of ints and strings.
Package pools provides deduplication pools for strings and lists of ints and strings.
sources
Package sources provides the base interface for all route server data source implementations.
Package sources provides the base interface for all route server data source implementations.
sources/birdwatcher
Package birdwatcher implements the birdwatcher source for the Alice Looking Glass.
Package birdwatcher implements the birdwatcher source for the Alice Looking Glass.
sources/gobgp
Package gobgp provides a source implementation for GoBGP.
Package gobgp provides a source implementation for GoBGP.
sources/openbgpd
Package openbgpd provides two source implementations for querying OpenBGPD.
Package openbgpd provides two source implementations for querying OpenBGPD.
store
Package store provides an interface for keeping routes and neighbor information without querying a route server.
Package store provides an interface for keeping routes and neighbor information without querying a route server.
store/backends/memory
Package memory provides in-memory backends for neighbor and route stores.
Package memory provides in-memory backends for neighbor and route stores.
store/backends/postgres
Package postgres is an implementation of a routes and neighbors store using the postgres database.
Package postgres is an implementation of a routes and neighbors store using the postgres database.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL