Skip to content

Commit 3529bab

Browse files
authored
Merge pull request #2019 from gizmoguy/make-vm-use-deb-packages
Make vm use deb packages
2 parents 3b7bc5d + bb17393 commit 3529bab

File tree

12 files changed

+71
-111
lines changed

12 files changed

+71
-111
lines changed

debian/gauge.postinst

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ case "$1" in
2828
${USER}
2929
fi
3030

31-
mkdir -p /var/log/gauge
31+
mkdir -p /var/log/faucet
3232
mkdir -p /etc/faucet
3333

3434
if id -u $USER > /dev/null 2>&1; then
35-
chown ${USER}:${GROUP} /var/log/gauge
35+
chown ${USER}:${GROUP} /var/log/faucet
3636
chown ${USER}:${GROUP} /etc/faucet
3737
fi
3838
;;

docs/installation.rst

+21-6
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,6 @@ The VM comes pre-installed with FAUCET, GAUGE, prometheus and grafana.
241241
Openstack's `diskimage-builder <https://docs.openstack.org/diskimage-builder/latest/>`_
242242
(DIB) is used to build the VM images in many formats (qcow2,tgz,squashfs,vhd,raw).
243243

244-
We provide `DIB elements <elements>`_ for configuring each component installed in the VM.
245-
246244
Pre-built images are available on our build host `<https://builder.faucet.nz>`_.
247245

248246
Building the images
@@ -272,7 +270,7 @@ SSH 22
272270
Faucet OpenFlow Channel 6653
273271
Gauge OpenFlow Channel 6654
274272
Grafana Web Interface 3000
275-
Prometheus Web Interface 3000
273+
Prometheus Web Interface 9090
276274
======================== ====
277275

278276
**Default Credentials**
@@ -292,9 +290,26 @@ Grafana comes installed but unconfigured, you will need to login to the grafana
292290
web interface at ``http://VM_IP:3000`` and configure a data source and some dashboards.
293291

294292
After logging in with the default credentials shown above, the first step is to add a `prometheus data source <https://prometheus.io/docs/visualization/grafana/#creating-a-prometheus-data-source>`_,
295-
please add ``http://localhost:9090`` as your data source.
296-
Next step is to configure some dashboards, you can add some we have `prepared earlier <https://monitoring.redcables.wand.nz/grafana-dashboards/>`_
297-
or `create your own <http://docs.grafana.org/features/datasources/prometheus/>`_.
293+
use the following settings then click ``Save & Test``:
294+
295+
::
296+
297+
Name: Prometheus
298+
Type: Prometheus
299+
URL: http://localhost:9090
300+
301+
Next we want to add some dashboards so that we can later view the metrics
302+
from faucet.
303+
304+
Hover over the ``+`` button on the left sidebar in the web interface
305+
and click ``Import``.
306+
307+
We will import the following dashboards, just download the following
308+
links and upload them through the grafana dashboard import screen:
309+
310+
* `Instrumentation <_static/grafana-dashboards/faucet_instrumentation.json>`_
311+
* `Inventory <_static/grafana-dashboards/faucet_inventory.json>`_
312+
* `Port Statistics <_static/grafana-dashboards/faucet_port_statistics.json>`_
298313

299314
You will need to supply your own faucet.yaml and gauge.yaml configuration in the VM.
300315
There are samples provided at /etc/faucet/faucet.yaml and /etc/faucet/gauge.yaml.

docs/testing.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Running the tests
151151
-ti faucet/tests
152152
153153
Running a single test including pytype, linting, and documentation
154-
~~~~~~~~~~~~~~~~~~~~~
154+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
155155

156156
.. code:: console
157157

etc/faucet/acls.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ acls:
5151
output:
5252
set_fields:
5353
- eth_dst: "72:b8:3c:4c:dc:4d"
54-
port: 5 # s1 container
54+
port: "s1" # s1 container
5555
# Force DNS to our DNS server
5656
- rule:
5757
dl_type: 0x800 # ipv4
@@ -61,7 +61,7 @@ acls:
6161
output:
6262
set_fields:
6363
- eth_dst: "72:b8:3c:4c:dc:4d"
64-
port: 5 # s1 container
64+
port: "s1" # s1 container
6565
- rule:
6666
actions:
6767
allow: 1 # allow

etc/faucet/faucet.yaml

+8-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dps:
4545
acls_in: [access-port-protect]
4646
4:
4747
name: "s1"
48-
description: "services1 container"
48+
description: "services container"
4949
native_vlan: office
5050
acls_in: [service-port-protect]
5151
5:
@@ -59,12 +59,17 @@ dps:
5959
interfaces:
6060
1:
6161
name: "pi"
62-
description: "Raspberry Pi"
62+
description: "raspberry pi"
6363
native_vlan: office
6464
acls_in: [access-port-protect]
6565
2:
6666
name: "laptop"
67-
description: "Guest Laptop"
67+
description: "guest laptop"
68+
native_vlan: guest
69+
acls_in: [access-port-protect]
70+
3:
71+
name: "s1"
72+
description: "services Laptop"
6873
native_vlan: guest
6974
acls_in: [access-port-protect]
7075
24:

vm/build-faucet-vm.sh

+1-6
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@
33
export DIB_RELEASE=xenial
44
export ELEMENTS_PATH=elements
55

6-
# Copy faucet source code into build environment
7-
rm -rf elements/faucet/install.d/faucet-src/
8-
rsync -a --exclude 'vm/' ../ elements/faucet/install.d/faucet-src/
9-
106
GIT_ID=$(git describe --tags)
117

128
disk-image-create --checksum -a amd64 -o faucet-amd64-$GIT_ID \
139
-t qcow2,tgz,squashfs,vhd,raw \
1410
vm ubuntu-minimal cloud-init-nocloud \
1511
stable-interface-names dhcp-all-interfaces \
1612
openssh-server runtime-ssh-host-keys \
17-
faucet gauge \
18-
prometheus grafana
13+
faucet-all-in-one
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
4+
set -x
5+
fi
6+
set -eu
7+
set -o pipefail
8+
9+
SCRIPTDIR=$(dirname $0)
10+
11+
# Add a `faucet' user
12+
adduser --disabled-password --gecos "faucet user" faucet
13+
echo faucet:faucet | chpasswd
14+
gpasswd -a faucet sudo
15+
16+
# Add faucet repo
17+
echo "deb https://packagecloud.io/faucetsdn/faucet/$(lsb_release -si | awk '{print tolower($0)}')/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/faucet.list
18+
curl -L https://packagecloud.io/faucetsdn/faucet/gpgkey | apt-key add -
19+
apt-get update
20+
21+
# Install faucet/gauge/prometheus/grafana
22+
apt-get install -y faucet-all-in-one
23+
24+
# Configure prometheus
25+
cat << EOF > /etc/default/prometheus
26+
# Set the command-line arguments to pass to the server.
27+
ARGS="--config.file=/etc/faucet/prometheus/prometheus.yml"
28+
EOF
29+
sudo systemctl restart prometheus
30+
31+
# Configure grafana
32+
systemctl daemon-reload
33+
systemctl enable grafana-server
34+
systemctl start grafana-server

vm/elements/faucet/package-installs.yaml renamed to vm/elements/faucet-all-in-one/package-installs.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ apt-transport-https:
55
logrotate:
66
tcpdump:
77
less:
8+
lsb-release:
89
curl:
910
wget:
1011
git:
12+
gnupg:
1113
python3-dev:
1214
dib_python_version: 3
1315
python3-setuptools:

vm/elements/faucet/install.d/02-install-faucet

-24
This file was deleted.

vm/elements/gauge/install.d/02-install-gauge

-15
This file was deleted.

vm/elements/grafana/install.d/02-install-grafana

-17
This file was deleted.

vm/elements/prometheus/install.d/02-install-prometheus

-35
This file was deleted.

0 commit comments

Comments
 (0)