Skip to content

Commit

Permalink
removed useless
Browse files Browse the repository at this point in the history
  • Loading branch information
Glydric committed Feb 6, 2024
1 parent a968fee commit bdafcfb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 72 deletions.
3 changes: 1 addition & 2 deletions Backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions Backend/src/cameraStream/cameraStream.gateway.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ 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', () => {
let gateway: CameraStreamGateway;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [CameraStreamGateway, CSSOpenVidu, DatabaseService],
providers: [CameraStreamGateway, DatabaseService],
imports: [
JwtModule.register({
global: true,
Expand Down
73 changes: 11 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: <br /> <br />
1. **Frontend**: It is the UI that enables the user to view and use the project in the browser. <br />
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. <br />
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. <br />
4. **Machine learning**: It is responsible for analyzing the camera streams and check if an object is
detected. <br />
5. **IPCameras**: These are the cameras that captures videos of the surrounding.<br />
5. **NVR & IPCameras**: These are the cameras that captures videos of the surrounding.<br />

In order to successfully run the full project components in your local machine, launch the components in the following order: <br /> <br />
1. Install your IP Cameras in the areas desired and connect it to the network. <br />
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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).

Expand Down
21 changes: 15 additions & 6 deletions system-design/Software Architecture Diagram.drawio
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<mxfile host="app.diagrams.net" modified="2023-11-29T07:45:12.564Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15" etag="QAOwW3cFHUZmFp2pdd4H" version="22.1.4" type="device">
<mxfile host="app.diagrams.net" modified="2024-02-06T09:31:10.406Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15" etag="ff41Zmwjp_plJYJGg38b" version="23.1.1" type="device">
<diagram name="Page-1" id="5f0bae14-7c28-e335-631c-24af17079c00">
<mxGraphModel dx="1080" dy="1884" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="850" background="none" math="0" shadow="0">
<mxGraphModel dx="1214" dy="2004" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="850" background="none" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
Expand Down Expand Up @@ -62,15 +62,18 @@
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="729.9999999999998" y="570" as="sourcePoint" />
<mxPoint x="760" y="370" as="targetPoint" />
<Array as="points">
<mxPoint x="730" y="630" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="CCcryx04_NlbNabwv35F-1" value="&lt;font style=&quot;font-size: 32px;&quot;&gt;Camera system&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="660" y="570" width="140" height="80" as="geometry" />
<mxCell id="CCcryx04_NlbNabwv35F-1" value="&lt;font style=&quot;font-size: 32px;&quot;&gt;Camera system&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="455" y="590" width="140" height="80" as="geometry" />
</mxCell>
<mxCell id="CCcryx04_NlbNabwv35F-2" value="&lt;font style=&quot;font-size: 32px;&quot;&gt;Telegram Bot&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxCell id="CCcryx04_NlbNabwv35F-2" value="&lt;font style=&quot;font-size: 32px;&quot;&gt;Telegram Bot&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="650" y="-390" width="160" height="80" as="geometry" />
</mxCell>
<mxCell id="CCcryx04_NlbNabwv35F-3" value="" style="endArrow=classic;html=1;rounded=0;strokeWidth=3;" edge="1" parent="1" source="39150e848f15840c-3" target="CCcryx04_NlbNabwv35F-2">
<mxCell id="CCcryx04_NlbNabwv35F-3" value="" style="endArrow=classic;html=1;rounded=0;strokeWidth=3;" parent="1" source="39150e848f15840c-3" target="CCcryx04_NlbNabwv35F-2" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="470" y="-40" as="sourcePoint" />
<mxPoint x="520" y="-90" as="targetPoint" />
Expand All @@ -79,6 +82,12 @@
</Array>
</mxGeometry>
</mxCell>
<mxCell id="WISknSA-FnQMQl5b_77A-1" value="" style="endArrow=classic;html=1;rounded=0;strokeWidth=3;" edge="1" parent="1" source="CCcryx04_NlbNabwv35F-1" target="39150e848f15840c-3">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="460" y="280" as="sourcePoint" />
<mxPoint x="510" y="230" as="targetPoint" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
Expand Down

0 comments on commit bdafcfb

Please sign in to comment.