From bdafcfb08a9c9cf5295882ccfe48ed5344699cfd Mon Sep 17 00:00:00 2001 From: Glydric Date: Tue, 6 Feb 2024 20:47:01 +0100 Subject: [PATCH] removed useless --- Backend/package.json | 3 +- .../cameraStream/cameraStream.gateway.spec.ts | 3 +- README.md | 73 +++---------------- .../Software Architecture Diagram.drawio | 21 ++++-- 4 files changed, 28 insertions(+), 72 deletions(-) diff --git a/Backend/package.json b/Backend/package.json index 0aba0f1..d776e96 100644 --- a/Backend/package.json +++ b/Backend/package.json @@ -6,7 +6,7 @@ "private": true, "license": "GPL", "scripts": { - "docker:start": "chmod +x cleaner.sh && ./cleaner.sh && npm ci && nest start", + "css:start": "chmod +x cleaner.sh && ./cleaner.sh && npm ci && nest start", "docker:dev": "npm run docker:start -- --watch", "docker:test": "npm ci && jest", "build": "nest build", @@ -40,7 +40,6 @@ "dotenv": "^16.3.1", "mongodb": "^6.3.0", "node-telegram-bot-api": "^0.64.0", - "openvidu-node-client": "^2.29.0", "reflect-metadata": "^0.1.13", "rxjs": "^7.8.1", "ws": "^8.14.2" diff --git a/Backend/src/cameraStream/cameraStream.gateway.spec.ts b/Backend/src/cameraStream/cameraStream.gateway.spec.ts index cc32db8..5644419 100644 --- a/Backend/src/cameraStream/cameraStream.gateway.spec.ts +++ b/Backend/src/cameraStream/cameraStream.gateway.spec.ts @@ -2,7 +2,6 @@ import { Test, TestingModule } from '@nestjs/testing'; import { CameraStreamGateway } from './cameraStream.gateway'; import { JwtModule } from '@nestjs/jwt'; -import { CSSOpenVidu } from './open-vidu.service'; import { DatabaseService } from '../database/database.service'; describe('WebStreamGateway', () => { @@ -10,7 +9,7 @@ describe('WebStreamGateway', () => { beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ - providers: [CameraStreamGateway, CSSOpenVidu, DatabaseService], + providers: [CameraStreamGateway, DatabaseService], imports: [ JwtModule.register({ global: true, diff --git a/README.md b/README.md index e5b5e89..672389a 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,9 @@ The repository contains the sources code for the Camera Security System project( The CSS is mainly composed of three 5 components:

1. **Frontend**: It is the UI that enables the user to view and use the project in the browser.
2. **Backend**: It is responsible for authentication, logging detection events, and establish communication between the frontend and the media server to access the IP Cameras.
- 3. **Media Server**: It is responsible for delivering the camera streams from the IP Cameras to the frontend. We have used [OpenVidu](openvidu.io/) for implementing the media server.
4. **Machine learning**: It is responsible for analyzing the camera streams and check if an object is detected.
- 5. **IPCameras**: These are the cameras that captures videos of the surrounding.
+ 5. **NVR & IPCameras**: These are the cameras that captures videos of the surrounding.
In order to successfully run the full project components in your local machine, launch the components in the following order:

1. Install your IP Cameras in the areas desired and connect it to the network.
@@ -19,41 +18,19 @@ In order to successfully run the full project components in your local machine, Below, you will get full details on how to run each component. -# Media Server +# Prerequisites -### 0- Prerequisite -You should first install docker in your machine. -You can get more information [here](https://docs.docker.com/engine/) -### 1- Open terminal - -First open the terminal and move to the backend directory. - -If you are currently in root directory of this repo. Type the following in the terminal to change directory: -```yaml -cd ./Backend/ -``` - -### 2- Define environment variables(Configuration) -In order to run the application you will need to define the environment variable by creating -by specifying environment variable file in the root Backend directory. - -You can use the .env-openvidu file found in the Backend root directory. You can modify some variables according to your need. - -### 3- Run the component - -Install the required packages by running: -```yaml -docker run -p 4443:4443 --rm --env-file .env-openvidu openvidu/openvidu-dev:2.29.0 -``` +You should first install node.js in your machine. +You can get more information [here](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs) +You should also have docker installed in your machine. # Backend ## Just Run -If you prefer running the backend using docker do the following: +To run the backend you need to have the following environment variables defined in a .env file in the root directory of the backend. You can use the following example -Firstly add .secrets.yml file to root directory using the following template ```yaml # mongodb+srv is the protocol when connecting to cloud mongodb MONGO_PROTOCOL=mongodb @@ -73,35 +50,13 @@ CSD_PASSWORD=Password TELEGRAM_TOKEN=api_token # Should be of the format of BCrypt hash BCRYPT_SALT=... -# Put the openvidu URL of the component that you have launched earlier -OPENVIDU_URL= http://localhost:4443/ -# Put the OPENVIDU_SECRET of the component that you have launched earlier -OPENVIDU_SECRET=MY_SECRET # Put the IP address of the NVR NVR_IP_ADDRESS= ## Frontend NEXT_PUBLIC_BACKEND_URL=http://localhost:8080/ ``` Then you can run -```bash -$ docker compose up -d -``` - -If you prefer running the backend directly using the terminal do the following: - -### 0- Prerequisite - -You should first install node.js in your machine. -You can get more information [here](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs) - -### 1- Open terminal - -First open the terminal and move to the backend directory. -If you are currently in root directory of this repo. Type the following in the terminal to change directory: -```yaml -cd ./Backend/ -``` ### 2- Define environment variables In order to run the application you will need to define the environment variable by creating @@ -110,19 +65,13 @@ In order to run the application you will need to define the environment variable Copy the content of .env_example found in the Backend root directory and change the variable values accordingly. You can also run the backend by just adding the telegram token and leave the rest of the config as it is. -### 3- Install packages - -Install the required packages by running: -```yaml -npm install -``` +### 3- Install packages and Run the application -### 4- Run the application +Run the application using the following commands: -Run the application using this command: - -```yaml -npm run start +```shell +cd Backend +npm run css:start ``` Note: If you are running the backend locally make sure that you followed the steps in the [Media Server Section](#media-server). diff --git a/system-design/Software Architecture Diagram.drawio b/system-design/Software Architecture Diagram.drawio index 0f4aca5..a42c816 100644 --- a/system-design/Software Architecture Diagram.drawio +++ b/system-design/Software Architecture Diagram.drawio @@ -1,6 +1,6 @@ - + - + @@ -62,15 +62,18 @@ + + + - - + + - + - + @@ -79,6 +82,12 @@ + + + + + +