Skip to content

Latest commit

 

History

History
93 lines (74 loc) · 3.02 KB

README.md

File metadata and controls

93 lines (74 loc) · 3.02 KB

serverless-security-system

Client

A "Client" is more-or-less a camera + computer that has the purpose of recording footage and periodically sending it to the cloud storage.
Very minimal video processing is done at the client-side to allow less powerful computers (such as a raspberry pi) to act as the client.

Client software

Linux: Run the client software using docker. MacOS/Windows: Run the client software using a python virtual environment.

Note: This software is intended to be run on linux (i.e., Raspberry Pi). Using docker to run the program becomes quite challenging on MacOS and Windows machines.

Using docker

Requirements

$ cd client

# Run the lastest version (docker image)
$ ./start.sh
# Or
$ ./start.sh latest .env

# Run a specific version (e.g., 0.0.1) and specific env file (e.g., local.env)
$ ./start.sh 0.0.1 local.env

View all available docker images on the Docker Hub repository.

Using Python virtualenv

Requirements

Install dependencies in virtualenv

$ cd client
$ python -m venv ./venv

# Activate the virtual environment
$ source ./venv/bin/activate
$ pip install -r requirements.txt

# Run the script
$ python main.py

Environment variables

The following environment variables are used by the client. It is recommended that these values are placed within a .env file.

Variable Default Purpose Required
REGION - The AWS region in which your AWS resources are located. An example is us-east-1
S3_BUCKET - The name of the unique S3 bucket to which clips should be synced.
AWS_ACCESS_KEY_ID - The ID of the access key that is to be used for authenticating requests to AWS services (S3).
AWS_SECRET_ACCESS_KEY - The secret access key that is to be used for authenticating requests to AWS services (S3).

To make things simpler, you may copy this base .env file and fill out the environment variables as needed.

# Required
REGION=
S3_BUCKET=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=

Pass the environment variables via the command line:

Docker
$ cd client

$ ./start.sh 

# With parameters
# specific tag version (default environment variable file)
$ ./start.sh 0.0.1
# latest tag + specific environment variable file
$ ./start.sh latest local.env
# specific tag + specific environment variable file
$ ./start.sh 0.0.1 local.env

Argument 1 is the specific image tag version. Default value of latest.
Argument 2 is the path to the environment variable file. Default value of .env.

Python command line

The .env file will be automatically picked up by the python program given it is located in the base (client) directory.

$ cd client
$ python main.py