Skip to content

Commit

Permalink
Merge pull request #2019 from gizmoguy/make-vm-use-deb-packages
Browse files Browse the repository at this point in the history
Make vm use deb packages
  • Loading branch information
gizmoguy authored May 28, 2018
2 parents 3b7bc5d + bb17393 commit 3529bab
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 111 deletions.
4 changes: 2 additions & 2 deletions debian/gauge.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ case "$1" in
${USER}
fi

mkdir -p /var/log/gauge
mkdir -p /var/log/faucet
mkdir -p /etc/faucet

if id -u $USER > /dev/null 2>&1; then
chown ${USER}:${GROUP} /var/log/gauge
chown ${USER}:${GROUP} /var/log/faucet
chown ${USER}:${GROUP} /etc/faucet
fi
;;
Expand Down
27 changes: 21 additions & 6 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ The VM comes pre-installed with FAUCET, GAUGE, prometheus and grafana.
Openstack's `diskimage-builder <https://docs.openstack.org/diskimage-builder/latest/>`_
(DIB) is used to build the VM images in many formats (qcow2,tgz,squashfs,vhd,raw).

We provide `DIB elements <elements>`_ for configuring each component installed in the VM.

Pre-built images are available on our build host `<https://builder.faucet.nz>`_.

Building the images
Expand Down Expand Up @@ -272,7 +270,7 @@ SSH 22
Faucet OpenFlow Channel 6653
Gauge OpenFlow Channel 6654
Grafana Web Interface 3000
Prometheus Web Interface 3000
Prometheus Web Interface 9090
======================== ====

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

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>`_,
please add ``http://localhost:9090`` as your data source.
Next step is to configure some dashboards, you can add some we have `prepared earlier <https://monitoring.redcables.wand.nz/grafana-dashboards/>`_
or `create your own <http://docs.grafana.org/features/datasources/prometheus/>`_.
use the following settings then click ``Save & Test``:

::

Name: Prometheus
Type: Prometheus
URL: http://localhost:9090

Next we want to add some dashboards so that we can later view the metrics
from faucet.

Hover over the ``+`` button on the left sidebar in the web interface
and click ``Import``.

We will import the following dashboards, just download the following
links and upload them through the grafana dashboard import screen:

* `Instrumentation <_static/grafana-dashboards/faucet_instrumentation.json>`_
* `Inventory <_static/grafana-dashboards/faucet_inventory.json>`_
* `Port Statistics <_static/grafana-dashboards/faucet_port_statistics.json>`_

You will need to supply your own faucet.yaml and gauge.yaml configuration in the VM.
There are samples provided at /etc/faucet/faucet.yaml and /etc/faucet/gauge.yaml.
Expand Down
2 changes: 1 addition & 1 deletion docs/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Running the tests
-ti faucet/tests
Running a single test including pytype, linting, and documentation
~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: console
Expand Down
4 changes: 2 additions & 2 deletions etc/faucet/acls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ acls:
output:
set_fields:
- eth_dst: "72:b8:3c:4c:dc:4d"
port: 5 # s1 container
port: "s1" # s1 container
# Force DNS to our DNS server
- rule:
dl_type: 0x800 # ipv4
Expand All @@ -61,7 +61,7 @@ acls:
output:
set_fields:
- eth_dst: "72:b8:3c:4c:dc:4d"
port: 5 # s1 container
port: "s1" # s1 container
- rule:
actions:
allow: 1 # allow
Expand Down
11 changes: 8 additions & 3 deletions etc/faucet/faucet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dps:
acls_in: [access-port-protect]
4:
name: "s1"
description: "services1 container"
description: "services container"
native_vlan: office
acls_in: [service-port-protect]
5:
Expand All @@ -59,12 +59,17 @@ dps:
interfaces:
1:
name: "pi"
description: "Raspberry Pi"
description: "raspberry pi"
native_vlan: office
acls_in: [access-port-protect]
2:
name: "laptop"
description: "Guest Laptop"
description: "guest laptop"
native_vlan: guest
acls_in: [access-port-protect]
3:
name: "s1"
description: "services Laptop"
native_vlan: guest
acls_in: [access-port-protect]
24:
Expand Down
7 changes: 1 addition & 6 deletions vm/build-faucet-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@
export DIB_RELEASE=xenial
export ELEMENTS_PATH=elements

# Copy faucet source code into build environment
rm -rf elements/faucet/install.d/faucet-src/
rsync -a --exclude 'vm/' ../ elements/faucet/install.d/faucet-src/

GIT_ID=$(git describe --tags)

disk-image-create --checksum -a amd64 -o faucet-amd64-$GIT_ID \
-t qcow2,tgz,squashfs,vhd,raw \
vm ubuntu-minimal cloud-init-nocloud \
stable-interface-names dhcp-all-interfaces \
openssh-server runtime-ssh-host-keys \
faucet gauge \
prometheus grafana
faucet-all-in-one
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail

SCRIPTDIR=$(dirname $0)

# Add a `faucet' user
adduser --disabled-password --gecos "faucet user" faucet
echo faucet:faucet | chpasswd
gpasswd -a faucet sudo

# Add faucet repo
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
curl -L https://packagecloud.io/faucetsdn/faucet/gpgkey | apt-key add -
apt-get update

# Install faucet/gauge/prometheus/grafana
apt-get install -y faucet-all-in-one

# Configure prometheus
cat << EOF > /etc/default/prometheus
# Set the command-line arguments to pass to the server.
ARGS="--config.file=/etc/faucet/prometheus/prometheus.yml"
EOF
sudo systemctl restart prometheus

# Configure grafana
systemctl daemon-reload
systemctl enable grafana-server
systemctl start grafana-server
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ apt-transport-https:
logrotate:
tcpdump:
less:
lsb-release:
curl:
wget:
git:
gnupg:
python3-dev:
dib_python_version: 3
python3-setuptools:
Expand Down
24 changes: 0 additions & 24 deletions vm/elements/faucet/install.d/02-install-faucet

This file was deleted.

15 changes: 0 additions & 15 deletions vm/elements/gauge/install.d/02-install-gauge

This file was deleted.

17 changes: 0 additions & 17 deletions vm/elements/grafana/install.d/02-install-grafana

This file was deleted.

35 changes: 0 additions & 35 deletions vm/elements/prometheus/install.d/02-install-prometheus

This file was deleted.

0 comments on commit 3529bab

Please sign in to comment.