This repo implements the Plant Tracer web application. The top-level planttracer.com website is currently a static HTML site. This repo runs in a sub-domain https://app.planttracer.com/ and provides the app that runs in a browser on a mobile phone or desktop.
The application consists of two parts, both of which are contained in this repo:
-
A web client written in JavaScript using the JQuery framework. Most of the app is located in (deploy/app/static/)[deploy/app/static/], although these JavaScript files require some variables set on the HTML pages served out of (deploy/app/templates/)[deploy/app/templates/] to function.
-
A back-end application written in Python using the Flask framework. This application can be served using an Apache webserver with the
gunicorn
application server, or using Amazon Lambda or another serverless framework.
Movies, individual movie frames, and zip files containing movie frames are stored in Amazon S3.
Course data, account data, and movie frame annotations are stored in Amazon DynamoDB.
Authentication tokens are stored in a client cookie called api_key
.
The user's current course is currently stored in the database, but should be moved to a cookie in the client.
Movies, movie frames, and ZIP files are downloaded from AWS S3 directly to the client using signed HTTP GET requests generated by the Python code running on the server.
Uploads of movies and movie frames are from the JavaScript client directly to S3 using signed HTTP POST commands.
The remaining static and dynamic content is downloaded from the server to the client using HTTP GET commands.
This design makes it easy to move from the server-based architecture to the AWS Lambda-based architecture, as Lambda limits HTTP GET and POST responses to 6MB and uploads to around 256KB. In a pure Lambda deployment, static content should probably be moved to a CDN.
This repo is designed to be checked out to $HOME/webapp
in the service account of the user that is running the application. On a typical Amazon EC2 VM this will be /home/ec2-user/webapp
.
For testing, this repo can be checked out and run anywhere, e.g. $HOME/gits/webapp
.
This code should run out-of-the-box on most Linux and macOS systems.
- Python 3.11 or above
- pip (please run in a virtual environment)
- OpenCV (use opencv-python-headless)
To install prerequisites:
venv/bin/pip install -r requirements.txt
colima start docker ps -a