Skip to content

Commit 35f60e3

Browse files
authored
webapp: update to current scionlab (#179)
Update to netsec-ethz/scion:v2020.12 / netsec-ethz/scion-apps:v0.3.0. Adapt to various changes in SCION and SCIONLab, in particular to changed directory structures (update how configuration files are found etc.). Update parameters for invocation of tools and apps. Remove unnecessary helper "config" files `client_user.json` and `server_ias.json` and instead pass the relevant information about the currently selected AS explicitly to the page handlers. As a consequence, the selected AS is no longer persistent accross restart of the webapp. Streamline the discovery of the relevant AS configuration files (find relevant files and addresses once and remember them, instead of finding them again and again). Simplify invocation of the webapp by removing various command line parameters * remove -sbin and -sabin, instead find binaries for `scion` tool and other "apps" on PATH * remove -slogs, file log not always available and no longer needed as health checks were changed to inspect metrics instead of logs * remove -sroot Update health checks * simplify scripts by explicitly passing path to topology file * update keys for parsing topology.json file * inspect metrics instead of log files to determine if beacons are arriving Misc: * replace BurntSushi/toml with pelletier/go-toml, allows extracting information from toml files without clunky helper structs. * increase linter timeout
1 parent e194557 commit 35f60e3

File tree

15 files changed

+213
-377
lines changed

15 files changed

+213
-377
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ build: scion-bat \
2121
scion-sensorfetcher scion-sensorserver \
2222
scion-skip \
2323
scion-ssh scion-sshd \
24+
scion-webapp \
2425
example-helloworld \
2526
example-hellodrkey \
2627
example-shttp-client example-shttp-server example-shttp-fileserver example-shttp-proxy
@@ -38,7 +39,7 @@ setup_lint:
3839

3940
lint:
4041
@type golangci-lint > /dev/null || ( echo "golangci-lint not found. Install it manually or by running 'make setup_lint'."; exit 1 )
41-
golangci-lint run --build-tags=$(TAGS)
42+
golangci-lint run --build-tags=$(TAGS) --timeout=2m0s -v
4243

4344
install: all
4445
# Note: install everything but the examples

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ require (
1414
github.com/mattn/go-sqlite3 v1.9.1-0.20180719091609-b3511bfdd742
1515
github.com/msteinert/pam v0.0.0-20190215180659-f29b9f28d6f9
1616
github.com/netsec-ethz/rains v0.2.0
17+
github.com/pelletier/go-toml v1.8.1-0.20200708110244-34de94e6a887
1718
github.com/scionproto/scion v0.6.0
1819
github.com/smartystreets/goconvey v1.6.4
1920
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a

webapp/README.md

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -61,42 +61,34 @@ Install all [SCIONLab apps](https://github.com/netsec-ethz/scion-apps) and depen
6161
```shell
6262
cd scion-apps
6363
./deps.sh
64-
make install
64+
make build
6565
```
6666

67-
Development Run on Local Topology:
67+
Development Run on ScionLab Topology:
6868
You can alter the defaults on the command line, all of which are listed below:
6969
```shell
70-
webapp \
70+
./bin/scion-webapp \
7171
-a 127.0.0.1 \
72-
-p 8081 \
73-
-r . \
72+
-p 8000 \
73+
-r $GOPATH/src/github.com/netsec-ethz/scion-apps/webapp/web/data \
7474
-srvroot $GOPATH/src/github.com/netsec-ethz/scion-apps/webapp/web \
75-
-sabin $GOPATH/bin \
76-
-sroot $GOPATH/src/github.com/scionproto/scion \
77-
-sbin $GOPATH/src/github.com/scionproto/scion/bin \
78-
-sgen $GOPATH/src/github.com/scionproto/scion/gen \
79-
-sgenc $GOPATH/src/github.com/scionproto/scion/gen-cache \
80-
-slogs $GOPATH/src/github.com/scionproto/scion/logs
75+
-sgen /etc/scion \
76+
-sgenc /var/lib/scion
8177
```
8278
or can you run `webapp` like this, which will use the defaults above:
8379
```shell
84-
webapp
80+
./bin/scion-webapp
8581
```
8682

87-
Development Run on SCIONLab Topology:
83+
Development Run on Local Topology:
8884
```shell
89-
webapp \
90-
-a 0.0.0.0 \
85+
./bin/scion-webapp \
86+
-a 127.0.0.1 \
9187
-p 8080 \
92-
-r ~/go/src/github.com/netsec-ethz/scion-apps/webapp/web/data \
93-
-srvroot ~/go/src/github.com/netsec-ethz/scion-apps/webapp/web \
94-
-sabin $GOPATH/bin \
95-
-sroot /etc/scion \
96-
-sbin /usr/bin \
97-
-sgen /etc/scion/gen \
98-
-sgenc /var/lib/scion \
99-
-slogs /var/log/scion
88+
-r $GOPATH/src/github.com/netsec-ethz/scion-apps/webapp/web/data \
89+
-srvroot $GOPATH/src/github.com/netsec-ethz/scion-apps/webapp/web \
90+
-sgen $HOME/scion/gen \
91+
-sgenc $HOME/scion/gen-cache
10092
```
10193

10294
## Dependencies
@@ -110,21 +102,13 @@ Usage of webapp:
110102
-p int
111103
Port of server host. (default 8000)
112104
-r string
113-
Root path to read/browse from, CAUTION: read-access granted from -a and -p. (default ".")
114-
-sabin string
115-
Path to execute the installed scionlab apps binaries (default "/home/ubuntu/go/bin")
116-
-sbin string
117-
Path to execute SCION bin directory of infrastructure tools (default "/home/ubuntu/go/src/github.com/scionproto/scion/bin")
105+
Root path to read/browse from, CAUTION: read-access granted from -a and -p. (default "$GOPATH/src/github.com/netsec-ethz/scion-apps/webapp /web/data")
118106
-sgen string
119-
Path to read SCION gen directory of infrastructure config (default "/home/ubuntu/go/src/github.com/scionproto/scion/gen")
107+
Path to read SCION gen directory of infrastructure config (default "/etc/scion")
120108
-sgenc string
121-
Path to read SCION gen-cache directory of infrastructure run-time config (default "/home/ubuntu/go/src/github.com/scionproto/scion/gen-cache")
122-
-slogs string
123-
Path to read SCION logs directory of infrastructure logging (default "/home/ubuntu/go/src/github.com/scionproto/scion/logs")
124-
-sroot string
125-
Path to read SCION root directory of infrastructure (default "/home/ubuntu/go/src/github.com/scionproto/scion")
109+
Path to read SCION gen-cache directory of infrastructure run-time config (default "/var/lib/scion")
126110
-srvroot string
127-
Path to read/write web server files. (default "/home/ubuntu/go/src/github.com/netsec-ethz/scion-apps/webapp/web")
111+
Path to read/write web server files. (default "$GOPATH/src/github.com/netsec-ethz/scion-apps/webapp/web")
128112
```
129113

130114
## Related Links

webapp/dependencies.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,21 @@ webapp -h
2727
- cat
2828
- systemctl
2929

30-
## SCION Binaries Used/Checked
31-
- $sbin/scmp
32-
- $sabin/bwtestclient
33-
- $sabin/imagefetcher
34-
- $sabin/sensorfetcher
30+
## SCION Binaries Used/Checked (should be somewhere on $PATH)
31+
- scion (for scion ping and scion traceroute)
32+
- scion-bwtestclient
33+
- scion-imagefetcher
34+
- scion-sensorfetcher
3535

3636
## Scripts/Directories Used/Checked
37-
- $sroot/scion.sh (deprecated)
38-
- $slogs/bs[IA]-1.log
39-
- $sgen/ISD*/AS* (scanning for local IAs)
40-
- $sgen/ISD[ISD]/AS[AS]/endhost/topology.json
37+
- $SCION_ROOT/scion.sh (only for local topologies (ISD < 16))
38+
- $sgen/.*topology.json (checking all subdirectories of $sgen for topology.json)
39+
- $sgen/.*(sciond|sd).toml (for reading sciond address)
40+
- $sgen/*cs*.toml (for reading prometheus server address)
4141
- $sgenc/*.crt
4242
- $sgenc/*.trc
4343
- $sgenc/ps[IA]-1.path.db
4444
- /run/shm/dispatcher/default.sock
45-
- /run/shm/sciond/default.sock
4645

4746
## Static Webserver Required
4847
- $srvroot/favico.ico
@@ -59,7 +58,3 @@ webapp -h
5958
- $srvroot/data/
6059
- $srvroot/data/images/
6160
- $srvroot/logs/
62-
63-
64-
65-

webapp/development.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Add alternate test forwarding port line in `Vagrantfile`:
7474
Update Go Paths:
7575
```shell
7676
echo 'export GOPATH="$HOME/go"' >> ~/.profile
77+
echo 'export GOBIN="$GOPATH/bin"' >> ~/.profile
7778
echo 'export PATH="$HOME/.local/bin:$GOPATH/bin:/usr/local/go/bin:$PATH"' >> ~/.profile
7879
source ~/.profile
7980
mkdir -p "$GOPATH"
@@ -91,35 +92,25 @@ Build and install `scion-apps`:
9192
```shell
9293
sudo apt install make gcc libpam0g-dev
9394
cd ~
94-
git clone -b scionlab https://github.com/netsec-ethz/scion-apps
95+
git clone -b master https://github.com/netsec-ethz/scion-apps
9596
cd scion-apps
97+
make setup_lint
9698
make install
9799
```
98100

99-
Download scionlab's fork of scion and build and install `sig`:
100-
```shell
101-
cd ~
102-
git clone -b scionlab https://github.com/netsec-ethz/scion
103-
go build -o $GOPATH/bin/sig ~/scion/go/sig/main.go
104-
```
105-
106-
Install Go Watcher:
101+
(Optional) Install Go Watcher:
107102
```shell
108103
go get -u github.com/mitranim/gow
109104
```
110105

111-
Development Run:
106+
Development Run (check dependencies.md for the meaning of the flags):
112107
```shell
113108
cd ~/scion-apps/webapp
114109
gow run . \
115110
-a 0.0.0.0 \
116111
-p 8080 \
117112
-r ./web/data \
118113
-srvroot ./web \
119-
-sabin /usr/bin/scion \
120-
-sroot /etc/scion \
121-
-sbin /usr/bin \
122114
-sgen /etc/scion/gen \
123115
-sgenc /var/lib/scion \
124-
-slogs /var/log/scion
125116
```

0 commit comments

Comments
 (0)