SE 101 Project
For a demo, see https://cm.harrynull.tech.
.
├── backend
│ ├── app/: source code of the app
│ ├── config/: configurations
│ ├── migrations/
│ ├── requirements.txt:`pip install -r requirements.txt`
│ ├── var/ database for testing/developing purpose. you need to create one for yourself.
│ │ └── test.db
│ └── venv `venv/Scripts/activate`
├── embedded/
│ ├── .env: put your environment variables here
│ ├── bootstrap.sh: this will be put in crontab to run after system boots
│ ├── log: log generated by the program
│ ├── read_packet.py: module that reads packet generated by tshark
│ ├── report.py: report data to the backend server
│ ├── run.sh: this will be put in crontab to run every five minutes
│ ├── setup.sh: this should be run once only
├── frontend/
└── README.md
sudo apt update && sudo apt install vim tshark # select allow non-superuser to use wireshark
sudo usermod -a -G wireshark pi
Add the following line to sudo visudo
:
pi ALL= NOPASSWD: /home/pi/crowdedness-monitor/embedded/bootstrap.sh
Add the following line to crontab -e
:
*/5 * * * * cd /home/pi/crowdedness-monitor/embedded/ && ./run.sh
@reboot sleep 30 && cd /home/pi/crowdedness-monitor/embedded/ && sudo ./bootstrap.sh
Lastly, edit embedded/.env
.
bootstrap.sh
will be run every time the system boots.run.sh
will be run every 5 minutes (a fixed interval)..env
stores relevant variables.log
stores logs.
apt update && apt install libmysqlclient-dev
cd backend
python3 -m venv venv
venv/Scripts/activate
pip3 install -r requirements.txt
touch var/test.db
flask db upgrade
flask run
Recommended IDE: PyCharm Professional