Raspberry Pi Initial Setup

This guide assumes that you have already setup network and users

  1. Update the Pi
    sudo apt update -y && sudo apt upgrade -y
  2. Configure the Pi
    1. Run raspi-config
      sudo raspi-config
    2. Enable the camera module
      go to Interfacing Options and enable the camera module.
    3. Expand the file system
      go to Advanced options and Expand file system.
    4. Reboot
      sudo reboot now
  3. Update the firmware
    sudo rpi-update
  4. Reboot
    sudo reboot now

Install Dependancies

  1. Install screen
    Screen is used for running multiple shells at once, this is required if you intend on running multiple components of Iris on the same machine.
    sudo apt install screen -y
  2. (Optional) Install bindfs
    While not required, bindfs allows you to mount a directory and access it as if it was your own, this is especially useful for Nginx webroots for example.
    sudo apt install bindfs -y
  3. Install git
    sudo apt install git -y
  4. Install pip3
    sudo apt install python-pip3 -y

Compile OpenCV

To compile OpenCV, please follow the instructions on the web page linked below:
Compile OpenCV on Raspberry Pi
Please note that you need to compile it for Python 3 and not Python 2.


Configure Web Server

Nginx (Preferred)

  1. Install Nginx
    sudo apt install nginx -y
  2. Add your own user to the www-data group
    sudo usermod -a -G www-data dylan
  3. Modify the default configuration file
    sudo nano /etc/nginx/sites-available/default
    using the Iris nginx configuration file as a guideline.
    Don't forget to Make changes to the directories and URL as needed.
  4. (Optional) Setup Nginx error pages
    Nginx is already configured to look for error pages in /var/www/iris/error/, all you need to do is put the required files in there.
    400.html | Error 400 - Bad Request
    403.html | Error 403 - Permission Denied
    404.html | Error 404 - Not Found
    You may use the examples above or replace them with your own.

Apache

Coming Soon.


Setup Iris

  1. Change to your home directory
    cd ~
  2. Clone the Iris repo from GitHub
    git clone --recurse-submodules https://github.com/DylanGore/Iris.git "iris"
    and cd into it
    cd iris/
  3. Setup Django
    Change into the correct directory
    cd src/web/
    Install Python dependancies via pip
    sudo pip3 install -r requirements.txt
  4. Configure Django for a live environment
    Edit the django settings file
    nano irisPrime/settings.py
    and modify the following settings:
    • Change SECRET_KEY = 'PUT_SECRET_KEY_HERE' - Generate a new secret key and replace PUT_SECRET_KEY_HERE with it.
    • Change DEBUG = True to DEBUG = False
    • Change ALLOWED_HOSTS = [] to ALLOWED_HOSTS = ['BASE_URL']
    • Add STATIC_ROOT = '/var/www/iris/static/' under STATIC_URL = '/static/' (this is the web accessible directory where the static files go)
  5. Collect the static files and move them to the STATIC_ROOT directory
    python3 manage.py collectstatic
  6. Create the database
    python3 manage.py migrate --run-syncdb
  7. Create a superuser
    python3 manage.py createsuperuser
    and follow the prompts to set the username, e-mail address and password.
  8. Run the server
    python3 manage.py runserver