diff --git a/README.md b/README.md index 2836c57..42eafee 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,76 @@ -# 303COM Personal Project - -> :lock: A modern home security system capable of real time threat detection +
+ +

303COM Personal Project

+

:lock: A modern home security system capable of real-time threat detection

+
+ +

## Research Question -Are Home CCTV Security Systems able to provide useful real-time Threat Alerts by combing Motion Detection and Facial Recognition? + Are Home CCTV Security Systems able to provide useful real-time Threat Alerts by combing Motion Detection and Facial Recognition? + +## Install -## Getting Started +### Prerequisite To run this project you must have the required prerequisites: -- [docker](https://www.docker.com/) -- [node.js](https://nodejs.org/en/) +- [Docker](https://www.docker.com/) +- [Node.js](https://nodejs.org/en/) -### Install Dependencies +### Close Source Code -This may take some time, it installs [OpenCV](https://opencv.org/) via [opencv4nodejs](https://github.com/justadudewhohacks/opencv4nodejs) and [TensorFlow](https://www.tensorflow.org/), these take a while to download and install. +``` shell +git clone https://github.coventry.ac.uk/eggintod/303COM.git +``` + +### Install Dependencies ``` shell npm i ``` -### Managing the Development Environment +Sit back and have a cuppa :coffee: this may take some time, **OpenCV** will take some time to build in your `node_modules` folder. + +### Starting the System -To simply start the server in the development environment run the npm script: ``` shell -npm run start:dev +npm run start ``` -Enabling the webcam attached the the development machine is done via the `DEV_WEBCAM=true/false` environment variable, however a easy to use npm script has been created: +The [Docker](https://www.docker.com/) docker demon should be running so **MongoDB** instances can be created. + +### Viewing Logs + ``` shell -npm run start:dev:webcam +npm run logs:view ``` -To clean the docker volumes and containers from your machines docker engine use the npm script: + +Logs are written to `/logs/events.log`, + +### Clearing Logs + ``` shell -npm run clean:dev +npm run logs:clear +``` + +### Development Environment + +This project is released under the [MIT](https://github.coventry.ac.uk/eggintod/303COM/blob/master/LICENSE) license. Feel free to do ask you wish. You may fine some of the following tips useful while hacking around inside this source code: + +#### Monitor Source Changes + +```shell +npn run start:dev ``` + +Starts the system using [nodemon](https://github.com/remy/nodemon/), a helping hand that watched for changes to `*.js` files and restarts your node for you. + +#### Development Webcam + +```shell +npm run start:dev:webcam +``` + +Attach your bult-in webcam to the system. diff --git a/assets/demo.png b/assets/demo.png new file mode 100644 index 0000000..d3f650e Binary files /dev/null and b/assets/demo.png differ diff --git a/package.json b/package.json index 978b8e3..08833da 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "303com", - "version": "0.0.2", + "version": "0.1.0", "description": "A smart home security system 🔒🎥", "main": "index.js", "scripts": { - "start": "node index.js", + "start": "./scripts/env_start", "start:dev": "./scripts/dev_env_start", "start:dev:webcam": "DEV_WEBCAM=true npm run start:dev", "clean:dev": "./scripts/dev_env_clean", diff --git a/scripts/env_start b/scripts/env_start new file mode 100755 index 0000000..0f8f777 --- /dev/null +++ b/scripts/env_start @@ -0,0 +1,24 @@ +#!/bin/sh + +NODE_ENV=production + +trap remove_dev_env_db INT + +function remove_dev_env_db() { + echo `` + echo '> Removing Database 303COM_dev_env_db_mongo' + docker stop 303COM_dev_env_db_mongo + docker rm 303COM_dev_env_db_mongo + + exit +} + +echo '> Creating Database volume 303COM_dev_env_db' +docker volume create 303COM_dev_env_db + + +echo '> Starting Database 303COM_dev_env_db_mongo' +docker run --name 303COM_dev_env_db_mongo -v 303COM_dev_env_db:/data/db -p 27017:27017/tcp -d mongo:latest + +echo '> Starting Development Node.js Server with nodemon' +node index.js \ No newline at end of file