alice-lg/README.md

264 lines
7.6 KiB
Markdown
Raw Permalink Normal View History

# Alice-LG - Your friendly looking glass
2017-06-15 11:14:04 +02:00
__"No, no! The adventures first, explanations take such a dreadful time."__
2017-06-15 11:12:59 +02:00
_Lewis Carroll, Alice's Adventures in Wonderland & Through the Looking-Glass_
2017-05-29 11:06:19 +02:00
Take a look at Alice-LG production examples at:
- https://lg.de-cix.net/
- https://lg.ams-ix.net
- https://lg.bcix.de/
- https://lg.megaport.com/
- https://lg.netnod.se/
- https://alice-rs.linx.net/
- https://lg.ix.br/
2024-09-25 11:08:54 +10:00
- https://lg.ix.asn.au/
- https://lg.ix.nz/
2018-09-10 12:39:44 +02:00
And checkout the API at:
2020-03-12 00:32:39 +01:00
- https://lg.de-cix.net/api/v1/config
- https://lg.de-cix.net/api/v1/routeservers
- https://lg.de-cix.net/api/v1/routeservers/rs1_fra_ipv4/status
- https://lg.de-cix.net/api/v1/routeservers/rs1_fra_ipv4/neighbors
- https://lg.de-cix.net/api/v1/routeservers/rs1_fra_ipv4/neighbors/R194_106/routes
2020-03-12 00:32:39 +01:00
- https://lg.de-cix.net/api/v1/lookup/prefix?q=217.115.0.0
2017-05-29 11:06:19 +02:00
2022-01-10 17:00:30 +01:00
## 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.
2022-01-10 17:00:30 +01:00
### 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).
2018-09-10 09:56:58 +02:00
## Explanations
Alice-LG is a BGP looking glass which gets its data from external APIs.
Currently Alice-LG supports the following APIs:
- [birdwatcher API](https://github.com/alice-lg/birdwatcher) for [BIRD](http://bird.network.cz/)
- [GoBGP](https://osrg.github.io/gobgp/)
- [bgplgd](https://man.openbsd.org/bgplgd) or [`openbgpd-state-server`](https://github.com/alice-lg/openbgpd-state-server) for [OpenBGP](https://www.openbgpd.org/)
2017-05-29 11:06:19 +02:00
### Birdwatcher
Normally you would first install the [birdwatcher API](https://github.com/alice-lg/birdwatcher) directly on the machine(s) where you run [BIRD](http://bird.network.cz/) on
and then install Alice-LG on a seperate public facing server and point her to the afore mentioned [birdwatcher API](https://github.com/alice-lg/birdwatcher).
2017-06-15 11:21:33 +02:00
This project was a direct result of the [RIPE IXP Tools Hackathon](https://atlas.ripe.net/hackathon/ixp-tools/)
2017-05-29 11:06:19 +02:00
just prior to [RIPE73](https://ripe73.ripe.net/) in Madrid, Spain.
2017-06-15 13:09:14 +02:00
Major thanks to Barry O'Donovan who built the original [INEX Bird's Eye](https://github.com/inex/birdseye) BIRD API of which Alice-LG is a spinnoff
### GoBGP
2022-11-17 14:33:52 +01:00
Alice-LG supports direct integration with GoBGP instances using gRPC.
See the configuration section for more detail.
2021-07-05 19:43:19 +02:00
### OpenBGPD
Alice-LG supports OpenBGP via [`bgplgd`](https://man.openbsd.org/bgplgd)
2021-07-05 19:43:19 +02:00
and [`openbgpd-state-server`](https://github.com/alice-lg/openbgpd-state-server).
2017-06-15 14:46:12 +02:00
## 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__
2021-10-09 16:54:13 +02:00
### CentOS:
2018-01-25 11:08:04 +01:00
First add the following lines at the end of your `~/.bash_profile`:
```bash
2017-06-15 13:09:14 +02:00
GOPATH=$HOME/go
export GOPATH
PATH=$PATH:$GOPATH/bin
export PATH
```
2017-06-15 13:13:55 +02:00
Now run:
2018-01-25 11:08:04 +01:00
```bash
2017-06-15 13:09:14 +02:00
source ~/.bash_profile
2018-01-25 11:08:04 +01:00
# Install frontend build dependencies
2017-06-15 13:09:14 +02:00
sudo yum install golang npm
sudo npm install --global yarn
2018-01-25 11:08:04 +01:00
2018-09-10 11:21:32 +02:00
mkdir -p ~/go/bin ~/go/pkg ~/go/src/github.com/alice-lg/
2018-01-25 11:08:04 +01:00
2018-09-10 11:21:32 +02:00
cd ~/go/src/github.com/alice-lg
git clone https://github.com/alice-lg/alice-lg.git
2018-01-25 11:08:04 +01:00
cd alice-lg
2017-06-15 13:09:14 +02:00
make
```
2018-09-10 12:43:21 +02:00
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`
2017-05-29 11:06:19 +02:00
## Configuration
An example configuration can be found at
[etc/alice-lg/alice.example.conf](https://github.com/alice-lg/alice-lg/blob/master/etc/alice-lg/alice.example.conf).
2017-05-29 11:06:19 +02:00
You can copy it to any of the following locations:
2017-06-26 16:46:41 +02:00
etc/alice-lg/alice.conf # local
etc/alice-lg/alice.local.conf # local
/etc/alice-lg/alice.conf # global
2017-06-26 16:46:41 +02:00
2017-05-29 11:06:19 +02:00
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.
2017-06-26 16:46:41 +02:00
[Birdwatcher](https://github.com/alice-lg/birdwatcher):
2018-09-10 11:22:49 +02:00
```ini
[source.rs1-example-v4]
2018-09-10 11:22:49 +02:00
name = rs1.example.com (IPv4)
[source.rs1-example-v4.birdwatcher]
2018-09-10 11:22:49 +02:00
api = http://rs1.example.com:29184/
neighbors_refresh_timeout = 2
2018-09-10 11:22:49 +02:00
# 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
2018-09-10 11:22:49 +02:00
[source.rs1-example-v6]
2018-09-10 11:22:49 +02:00
name = rs1.example.com (IPv6)
[source.rs1-example-v6.birdwatcher]
2018-09-10 11:22:49 +02:00
api = http://rs1.example.com:29186/
```
2017-05-29 11:06:19 +02:00
[GoBGP](https://osrg.github.io/gobgp/):
```ini
[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
```
2022-11-17 14:33:52 +01:00
Configure TLS with:
```ini
tls_crt = /path/to/cert
tls_common_name = "common name"
```
You can disable TLS with `insecure = true`.
2021-07-05 19:43:19 +02:00
[OpenBGPD](https://www.openbgpd.org/) via `openbgpd-state-server`:
```ini
[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](https://www.openbgpd.org/) via `bgplgd`:
```ini
[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
```
2017-05-29 11:06:19 +02:00
## Running
Launch the server by running
./bin/alice-lg-linux-amd64
2018-06-26 18:43:32 +02:00
## 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
2018-06-26 18:43:32 +02:00
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
2018-06-26 18:43:32 +02:00
only used to modify the content of the welcome screen,
by providing a javascript in your theme containing:
```javascript
Alice.updateContent({
welcome: {
title: "My Awesome Looking Glass",
tagline: "powered by Alice"
}
});
2018-06-26 18:43:32 +02:00
```
2022-08-02 09:34:43 +02:00
A callback for running custom javascript after the base application
was initialized can be installed using:
```javascript
Alice.onLayoutReady(function(page) {
// page is the layout HTML root element
});
```
2018-06-26 18:43:32 +02:00
For an example check out: https://github.com/alice-lg/alice-theme-example
2017-05-29 11:06:19 +02:00
## Hacking
The client is a Single Page React Application.
2022-08-02 09:34:43 +02:00
All sources are available in `ui/`.
2017-05-29 11:06:19 +02:00
2022-08-02 09:34:43 +02:00
`Yarn` is required for building the UI.
2017-05-29 11:06:19 +02:00
Create a fresh UI build with
2018-09-10 11:21:32 +02:00
```bash
2022-08-02 09:34:43 +02:00
cd ui/
make
2018-09-10 11:21:32 +02:00
```
2017-05-29 11:06:19 +02:00
2022-08-02 09:34:43 +02:00
This will install all dependencies with `yarn install` and run `yarn build`.
2017-05-29 11:06:19 +02:00
2022-08-02 09:34:43 +02:00
As this is a `create-react-app` application, react-scripts are present
and you can just run a development server using `yarn start`.
2017-05-16 13:37:51 +02:00
2022-08-02 09:34:43 +02:00
All this available as a containerized environment:
2018-09-10 11:21:32 +02:00
2022-08-02 09:34:43 +02:00
Running `docker-compose up` in the `./dev` will build and start the
backend and run a webpack dev server for the UI.
2018-09-10 11:21:32 +02:00
2022-08-02 09:34:43 +02:00
The UI is then available on http://localhost:3000/ and on http://localhost:7340/
the backend will serve the API.
2018-09-10 11:21:32 +02:00
2017-05-16 13:37:51 +02:00
2018-09-10 12:01:43 +02:00
## Sponsors
2018-09-10 12:24:42 +02:00
The development of Alice is now sponsored by
2018-09-10 12:16:38 +02:00
<p align="center">
2018-09-10 12:18:26 +02:00
<a href="https://www.de-cix.net" target="_blank">
2018-09-10 12:17:47 +02:00
<img src="doc/images/DE-CIX_Logo_2016_small.png?raw=true" alt="DE-CIX Logo" title="DE-CIX" />
</a>
2018-09-10 12:16:38 +02:00
</p>
2018-09-10 12:01:43 +02:00
2018-09-10 12:24:42 +02:00
Many thanks go out to [ECIX](https://www.ecix.net), where this project originated and was backed over the last two years.
2021-10-09 16:32:20 +02:00
2021-10-09 17:12:26 +02:00
Support for **OpenBGPD** was sponsored by the [Route Server Support Foundation](https://www.rssf.nl/).
2021-10-09 16:32:20 +02:00