ba6c91ddfbf19d3d8075ef043d0adbb7559d3e7f
services/Distributed-Wiki.md
... | ... | @@ -1,12 +1,12 @@ |
1 | 1 | The idea is to deploy the mirrors across dn42 using [anycast](https://en.wikipedia.org/wiki/Anycast) addressing (BGP), thus providing redundancy, load-balancing and improved access times for the site. |
2 | 2 | The local webserver is monitored with a simple [[shell script|Distributed-Wiki#exabgp_watchdog-script]] working [[in conjunction|Distributed-Wiki#exabgp]] with [ExaBGP](https://github.com/Exa-Networks/exabgp), announcing/withdrawing the assigned route if the service is up/down. |
3 | 3 | |
4 | -### Network |
|
4 | +## Network |
|
5 | 5 | |
6 | 6 | - Install wiki anycast address `172.23.0.80/32` on the system |
7 | 7 | - Setup tunnel(s) to the dn42 network (routing daemon not required) |
8 | 8 | |
9 | -### Setup gollum |
|
9 | +## Setup gollum |
|
10 | 10 | |
11 | 11 | - Install [gollum](https://github.com/gollum/gollum) |
12 | 12 | - Clone the dn42 wiki repo: |
... | ... | @@ -27,16 +27,16 @@ gollum --css <path>/custom.css --gollum-path <path> --host 127.0.0.1 --port 456 |
27 | 27 | gollum --css <path>/custom.css --gollum-path <path> --host 127.0.0.1 --port 4567 --no-edit |
28 | 28 | ``` |
29 | 29 | |
30 | -### Nginx proxy |
|
30 | +## Nginx proxy |
|
31 | 31 | |
32 | -##### Header |
|
32 | +#### Header |
|
33 | 33 | |
34 | 34 | A custom header `X-SiteID` identifies the site you're connecting to: |
35 | 35 | |
36 | 36 | + X-SiteID: `AS number`-`ISO country code` |
37 | 37 | |
38 | 38 | |
39 | -##### Config example |
|
39 | +#### Config example |
|
40 | 40 | |
41 | 41 | ``` |
42 | 42 | ssl_protocols TLSv1.2 TLSv1.1 TLSv1; |
... | ... | @@ -84,13 +84,13 @@ server { |
84 | 84 | |
85 | 85 | ``` |
86 | 86 | |
87 | -### [ExaBGP](https://github.com/Exa-Networks/exabgp) |
|
87 | +## [ExaBGP](https://github.com/Exa-Networks/exabgp) |
|
88 | 88 | |
89 | -##### Announcing |
|
89 | +#### Announcing |
|
90 | 90 | |
91 | 91 | The prefix AS-PATH should show the announcement is originating from your AS. After peering ExaBGP to the nearest speaker(s), check if the prefix is routing properly inside your network. Try not to blackhole the passing traffic (e.g. no static routes to `172.23.0.80/28`). Test the whole thing by shutting down nginx/gollum and watch what happens. |
92 | 92 | |
93 | -##### Configuration |
|
93 | +#### Configuration |
|
94 | 94 | |
95 | 95 | ``` |
96 | 96 | # exabgp.conf |
... | ... | @@ -120,7 +120,7 @@ group gollum-watchdog { |
120 | 120 | |
121 | 121 | ``` |
122 | 122 | |
123 | -##### Watchdog script |
|
123 | +#### Watchdog script |
|
124 | 124 | |
125 | 125 | Watchdog runs in an infinite loop, sending the appropriate commands to stdout. [ExaBGP](https://github.com/Exa-Networks/exabgp) attaches to the process' stdout and listens for instructions. Watchdog sends either a route announce or widthdraw. |
126 | 126 | |
... | ... | @@ -187,7 +187,7 @@ exit 0 |
187 | 187 | |
188 | 188 | ``` |
189 | 189 | |
190 | -##### Run |
|
190 | +#### Run |
|
191 | 191 | |
192 | 192 | Normally SIGUSR1 to the exabgp process triggers a configuration update, but at occasion the process might need to be restarted - since its gracefull shutdown can be glitchy , this might be a bit difficult. Sending SIGKILL to the child(ren) and immediately after, the parent, does the job (quick-and-dirty). |
193 | 193 |