From 8a8608536c1671bde94b4db007da2e685ce92f9c Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Thu, 20 Feb 2020 04:35:27 +0000 Subject: [PATCH] Add README --- README.md | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..04e1259 --- /dev/null +++ b/README.md @@ -0,0 +1,81 @@ +# Airlock + +Door controller for scanning Protospace member cards on the front and back doors. + +## Setup + +Ensure Pi user has read permissions to /dev/ttyACM0. + +Install dependencies: + +```text +$ sudo apt update +$ sudo apt install python3 python3-pip python-virtualenv python3-virtualenv +``` + +Clone this repo: + +```text +$ git clone https://github.com/Protospace/airlock.git +$ cd airlock +``` + +### Watchdog + +For the watchdog to work, we need write access to `/dev/watchdog/`. + +Configure `/etc/udev/rules.d/60-watchdog.rules`: + +```text +KERNEL=="watchdog", MODE="0666" +``` + +### Main Script + +Create a venv, activate it, and install: + +```text +$ virtualenv -p python3 env +$ source env/bin/activate +(env) $ pip install -r requirements.txt +``` + +Start an empty card-data.json: + +```text +(env) $ echo "{}" > card-data.json +``` + +Now you can run the script to test: + +```text +(env) $ python main.py +``` + +## Process management + +The script is kept alive with [supervisor](https://pypi.org/project/supervisor/). + +Configure `/etc/supervisor/conf.d/airlock.conf`: + +```text +[program:airlock] +user=pi +directory=/opt/airlock +command=/opt/airlock/env/bin/python -u main.py +stopsignal=INT +autostart=true +autorestart=true +stderr_logfile=/var/log/airlock.log +stderr_logfile_maxbytes=10MB +stdout_logfile=/var/log/airlock.log +stdout_logfile_maxbytes=10MB +``` + +Script logs to /var/log/airlock.log. Remove `-u` from the above command when you're done testing. + +## License + +This program is free and open-source software licensed under the MIT License. Please see the `LICENSE` file for details. + +That means you have the right to study, change, and distribute the software and source code to anyone and for any purpose. You deserve these rights.