Skip to content

Getting Started

Marc Billow edited this page Feb 25, 2021 · 7 revisions

Before we get started on the nitty gritty of setting up your first instance, let's make sure we all understand how this system works at a high level. It will help immensely if you need to do any troubleshooting down the road.

The Parts of the Puzzle

There are 4 major parts of this system:

  1. You: This includes your phones and computers.
  2. Your Feeder(s): That hunk of plastic with the red ring.
  3. This Service: This is where the heavy listing of actually communicating with the feeder happens.
  4. HTTPS Proxy: Something needs to handle making you-to-service and feeder-to-service communication secure, this is the HTTPS proxy.

How the Puzzle Comes Together

Your phones and computers will only ever communicate directly with the HTTPS proxy to ensure your data is always secure. The feeder will communicate with both the proxy and the project directly. The proxy will provide the same HTTPS security it does for your devices and will talk to the project over an encrypted messaging protocol called MQTTS.

Setting Up Your First Instance

This project can be deployed in a variety of ways and is configurable to fit your existing infrastructure. We are going to cover a basic setup situation to keep it simple, but check out the configuration variables in feeder/config.py if you want to get more advanced.

Note: These instructions are written with Raspberry Pis in mind.

  1. If you don't already have Docker installed, follow the instructions here.
  2. Install docker-compose:
    1. sudo apt install libffi-dev libssl-dev python3-dev python3 python3-pip
    2. sudo pip3 install docker-compose
  3. Create a folder in your home directory and move to it.
    1. mkdir petnet-feeder-service
    2. cd petnet-feeder-service
  4. Copy the example compose file into a new file docker-compose.yaml in this folder.
    1. curl -fsSL https://raw.githubusercontent.com/feedernet/petnet-feeder-service/master/sample/docker-compose.yaml -o docker-compose.yaml
    2. You will need to choose an image based on your device.
    3. Also, you may need to change some of the variables in the "environment" section to fit your setup.
  5. Create a data directory and copy the sample Nginx configuration to data/nginx.conf.
    1. curl -fsSL https://raw.githubusercontent.com/feedernet/petnet-feeder-service/master/sample/nginx.conf -o data/nginx.conf
  6. Start just the project container: docker-compose up -d petnet-feeder-service
    1. This will allow the application to generate the necessary certificates for the SSL proxy to use.
    2. Check the logs to ensure there are no errors: docker-compose logs petnet-feeder-service
  7. Bring the rest of the compose file up: docker-compose up -d
    1. The frontend should be available at https://<your_ip>

Getting Your Feeder to Communicate

You are going to need to setup some form of configurable DNS server on your network if you don't already have one and configure your DHCP server (likely integrated into your Modem/WiFi router) to use this server. In the future, we are planning on shipping some form of Raspberry Pi image to remove this requirement. For now though, it is the only way to make this work.

Note: We know this is a huge hurdle for most people. If you want to help us make this process easier or need help getting started, join our Slack. Instructions are in the README.

You will need to configure your DNS server to respond with the IP of your FeederNet instance on the following records:

  • api.arrowconnect.io
  • mqtt-a01.arrowconnect.io

Once you have confirmed your DNS setup is correct, your feeder should eventually show up in the application.

Example Configurations

These are just two examples of verified working configurations that the maintainers of this application are using. They may not fit perfectly into your network.

dnsmasq

  • Install and enable dnsmasq:
sudo apt install dnsmasq dnsutils
sudo systemctl enable dnsmasq
sudo systemctl start dnsmasq
  • Create a hosts file for dnsmasq in /etc/dnsmasq.hosts:
{IP of Device}   api.arrowconnect.io
{IP of Device}   mqtt-a01.arrowconnect.io
  • Add this line to your /etc/dnsmasq.conf:
addn-hosts=/etc/dnsmasq.hosts
  • Restart dnsmasq and verify your config.
sudo systemctl restart dnsmasq

dig @localhost api.arrowconnect.io +short
10.0.0.112  # This should be the IP you provided above.

This isn't working!

Double check your DNS, DHCP, and network configuration. Ensure that ports 8883 (MQTTS) and 443 (HTTPS) on the FeederNet server are reachable from the network your feeder is on.