Devasy23 / FaceRec

An advanced facial recognition system designed for real-time identification using deep learning models and optimized vector search. Features include face detection, embedding generation, and scalable deployment options.
Apache License 2.0
12 stars 1 forks source link

Feature Request: Implement MongoDB Atlas Locally Using Docker [Backlog - Least Priority] #10

Open Devasy23 opened 6 months ago

Devasy23 commented 6 months ago

Feature Request: Implement MongoDB Atlas Locally Using Docker [Backlog - Least Priority]

Description

In the future, we may want to consider implementing MongoDB Atlas locally using Docker. MongoDB Atlas offers two options: cloud and Linux. By using Docker, we can create a Linux environment to run MongoDB Atlas locally. This would also pave the way for a potential use case where we want to deploy the application on the cloud and test it online.

Expected Behavior

We should be able to run MongoDB Atlas locally using Docker and switch between the local and cloud versions of MongoDB Atlas based on our needs.

Benefits

This feature would provide us with more flexibility in our development and testing processes. It would also make it easier to test the application in an environment that closely mirrors the production environment.

Tasks

Checklist - [X] Create `Dockerfile` ✓ https://github.com/devansh-shah-11/FaceRec/commit/cd4c92e13cef77334a7e4b3064e682c5fa861b51 [Edit](https://github.com/devansh-shah-11/FaceRec/edit/sweep/feature_request_implement_mongodb_atlas_7eff6/Dockerfile) - [X] Running GitHub Actions for `Dockerfile` ✓ [Edit](https://github.com/devansh-shah-11/FaceRec/edit/sweep/feature_request_implement_mongodb_atlas_7eff6/Dockerfile) - [X] Create `docker-compose.yml` ✓ https://github.com/devansh-shah-11/FaceRec/commit/2184c604bd36153703ae998e8675dfe24a0751b4 [Edit](https://github.com/devansh-shah-11/FaceRec/edit/sweep/feature_request_implement_mongodb_atlas_7eff6/docker-compose.yml) - [X] Running GitHub Actions for `docker-compose.yml` ✓ [Edit](https://github.com/devansh-shah-11/FaceRec/edit/sweep/feature_request_implement_mongodb_atlas_7eff6/docker-compose.yml) - [X] Modify `API/database.py` ✓ https://github.com/devansh-shah-11/FaceRec/commit/bcf4f8bf4fc53eae3140dcd22b202a4d8bf78cc4 [Edit](https://github.com/devansh-shah-11/FaceRec/edit/sweep/feature_request_implement_mongodb_atlas_7eff6/API/database.py#L6-L8) - [X] Running GitHub Actions for `API/database.py` ✓ [Edit](https://github.com/devansh-shah-11/FaceRec/edit/sweep/feature_request_implement_mongodb_atlas_7eff6/API/database.py#L6-L8) - [X] Modify `README.md` ✓ https://github.com/devansh-shah-11/FaceRec/commit/83c38eb83771a4c9d61571faf1d2c85cb99598d3 [Edit](https://github.com/devansh-shah-11/FaceRec/edit/sweep/feature_request_implement_mongodb_atlas_7eff6/README.md#L32-L37) - [X] Running GitHub Actions for `README.md` ✓ [Edit](https://github.com/devansh-shah-11/FaceRec/edit/sweep/feature_request_implement_mongodb_atlas_7eff6/README.md#L32-L37)
sweep-ai[bot] commented 6 months ago

🚀 Here's the PR! #17

See Sweep's progress at the progress dashboard!
Sweep Basic Tier: I'm using GPT-4. You have 4 GPT-4 tickets left for the month and 2 for the day. (tracking ID: 2f20c0d3a4)

For more GPT-4 tickets, visit our payment portal. For a one week free trial, try Sweep Pro (unlimited GPT-4 tickets).
Install Sweep Configs: Pull Request

[!TIP] I can email you next time I complete a pull request if you set up your email here!


Actions (click)

GitHub Actions✓

Here are the GitHub Actions logs prior to making any changes:

Sandbox logs for 91e83d1
Checking API/database.py for syntax errors... ✅ API/database.py has no syntax errors! 1/1 ✓
Checking API/database.py for syntax errors...
✅ API/database.py has no syntax errors!

Sandbox passed on the latest main, so sandbox checks will be enabled for this issue.


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/devansh-shah-11/FaceRec/blob/91e83d1e0629dfb50ad9baecd37d3e4982a29f76/README.md#L1-L66 https://github.com/devansh-shah-11/FaceRec/blob/91e83d1e0629dfb50ad9baecd37d3e4982a29f76/API/database.py#L1-L23 https://github.com/devansh-shah-11/FaceRec/blob/91e83d1e0629dfb50ad9baecd37d3e4982a29f76/LICENSE#L180-L195 https://github.com/devansh-shah-11/FaceRec/blob/91e83d1e0629dfb50ad9baecd37d3e4982a29f76/Archive.md#L1-L29 https://github.com/devansh-shah-11/FaceRec/blob/91e83d1e0629dfb50ad9baecd37d3e4982a29f76/CHANGELOG.md#L1-L50

Step 2: ⌨️ Coding

Ran GitHub Actions for cd4c92e13cef77334a7e4b3064e682c5fa861b51:

Ran GitHub Actions for 2184c604bd36153703ae998e8675dfe24a0751b4:

--- 
+++ 
@@ -1,10 +1,16 @@
+import os
 from datetime import datetime

 from pymongo import MongoClient

 class Database:
-    def __init__(self, uri="mongodb://localhost:27017/", db_name="ImageDB"):
+    def __init__(self, db_name="ImageDB"):
+        use_docker_db = os.environ.get('USE_DOCKER_DB', 'False') == 'True'
+        if use_docker_db:
+            uri = "mongodb://admin:password@localhost:27017/"
+        else:
+            uri = "mongodb://localhost:27017/"
         self.client = MongoClient(uri)
         self.db = self.client[db_name]

Ran GitHub Actions for bcf4f8bf4fc53eae3140dcd22b202a4d8bf78cc4:

--- 
+++ 
@@ -32,7 +32,25 @@

 ### Running the Server
-To start FLask and FastAPI, run the given command:
+To run the application and MongoDB Atlas locally using Docker, follow these steps:
+
+1. Build and run the Docker container:
+    ```bash
+    docker-compose up --build
+    ```
+    This command builds the MongoDB container and runs it alongside your application.
+
+2. To switch between the local Docker-based MongoDB Atlas and the cloud version, set the `USE_DOCKER_DB` environment variable in your application's environment:
+    - For using the Docker-based MongoDB Atlas, set `USE_DOCKER_DB=True`.
+    - For using the cloud version of MongoDB Atlas, set `USE_DOCKER_DB=False`.
+
+3. To stop the Docker container, use the following command:
+    ```bash
+    docker-compose down
+    ```
+    This command stops and removes the containers, networks, and volumes created by `docker-compose up`.
+
+To start Flask and FastAPI without Docker, run the given command:
 ```bash
 python main.py
 ```

Ran GitHub Actions for 83c38eb83771a4c9d61571faf1d2c85cb99598d3:


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/feature_request_implement_mongodb_atlas_7eff6.


🎉 Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.Something wrong? Let us know.

This is an automated message generated by Sweep AI.