Skip to content

Backend upgrade: Stability & Firestore, Pinecone, Silero VAD & Docs#1981

Closed
skywinder wants to merge 26 commits intoBasedHardware:mainfrom
skywinder:backend-improments
Closed

Backend upgrade: Stability & Firestore, Pinecone, Silero VAD & Docs#1981
skywinder wants to merge 26 commits intoBasedHardware:mainfrom
skywinder:backend-improments

Conversation

@skywinder
Copy link
Collaborator

@skywinder skywinder commented Mar 12, 2025

🚀 Backend Bootstrap Fixes & Improvements

This PR includes multiple fixes for backend initialization and configuration.
Each fix is in a separate commit for easier review.

🔧 Fixes & Enhancements

  • Fix Firestore client initialization with explicit project ID
    4b30d81

  • Improve Pinecone vector database initialization with proper configuration handling
    763c7bc

  • Add project ID handling for Google Cloud Storage client initialization
    cbe4a95

  • Enhance GitHub API token handling and update documentation
    715e091

  • Improve Silero VAD model loading with error handling and fallback
    dd659bc

  • docs: Add troubleshooting section for Opus library issues
    b8a5a3b

  • feat: Add Typesense mock client for development & improve configuration handling
    5cdbd46

📖 Documentation Updates

  • docs: Enhance Typesense configuration guide in README
    dc0ee8c

🎤 Audio Processing Improvements

  • feat: Fix Silero VAD model download & loading mechanism
    34650a8

  • fix: Update Silero VAD model download URL & simplify file retrieval
    3ab94bd

  • feat: Add PyOgg error handling & fallback mechanism for Opus codec
    ffd5e69


🐳 Docker Setup Now Works Out of the Box!

CleanShot 2025-03-12 at 19 47 58


🚀 How to Run

Local

uvicorn main:app --reload --env-file .env

Docker

docker compose up -d

- Update README.md with detailed instructions for setting up GitHub token
- Improve GitHub API request handling in firmware and plugins utils
- Add warning messages for missing GitHub token
- Handle rate limit scenarios
- Provide clearer guidance on optional GitHub token configuration
…hanism

- Add SSL certificate verification bypass
- Implement try-except block for model loading
- Create mock VAD functions for graceful degradation
- Handle potential model loading failures
- Include detailed steps for resolving Opus library installation issues

- Add verification step to confirm successful library import
…dling

- Implement conditional Typesense client initialization
- Create mock Typesense client for development when configuration is missing
- Update README.md with Typesense configuration instructions
- Add warning message for unconfigured Typesense setup
- Provide setup instructions for Typesense Cloud and self-hosted environments
- Clarify host, port, and API key configuration steps
- Implement direct model file download from GitHub repository
- Add fallback mechanism for Silero VAD model loading
- Handle potential download and loading errors
- Update model file download URL to latest repository location
- Remove redundant file downloads for utils and example files
- Streamline model file retrieval process
- handling of PyOgg import errors
- Create mock OpusDecoder class for limited functionality
- Update README with troubleshooting steps for PyOgg library
@skywinder
Copy link
Collaborator Author

Hooray! I did it! 🎉 Finally, it’s up and running! 🙌
CleanShot 2025-03-12 at 03 57 33@2x

Hope this helps many others!

@mdmohsin7 @thinhx I’d really appreciate a quick review. It has passed all the tests and checks. I managed to overcome 20+ errors, and it’s at least running for now. However, this is my first launch, so please take a look. Thanks! 🙏

@skywinder skywinder marked this pull request as ready for review March 12, 2025 03:00
@neooriginal
Copy link
Collaborator

Reviewing right now...

@skywinder skywinder force-pushed the backend-improments branch from ce5684e to c36bdb7 Compare March 12, 2025 03:22
@neooriginal
Copy link
Collaborator

lgtm, starts without issues, but ran into a windows-specific problem.
needs further review from someone else.

@skywinder
Copy link
Collaborator Author

lgtm, starts without issues, but ran into a windows-specific problem. needs further review from someone else.

I didn’t test it on Windows, to be honest—only on Mac. I just added the obvious path from the manuals, just in case. Better this than nothing!

@skywinder skywinder changed the title Backend-improments Backend upgrade: Stability & Firestore, Pinecone, Silero VAD & Docs Mar 12, 2025
- Removed Google Cloud credentials configuration from docker-compose.yml
- Updated README and Backend_Setup.mdx to reflect changes in credentials handling and installation instructions
@skywinder
Copy link
Collaborator Author

Hooray! Docker and Docker Compose are now working! Added files and the dock! Enjoy! 😉

2d7942c
da4dbbb

CleanShot 2025-03-12 at 19 47 58

Changed exposed port from 8080 to 8000 in Dockerfile and docker-compose.yml

COPY --from=builder /opt/venv /opt/venv
COPY backend/ .
COPY . .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will break the gcp deployment workflow (not really sure). @skywinder can you pls once cross check the dockerfile.datadog file and also the gcp_backend.yml file in .github/workflows (if you haven't already)

Copy link
Collaborator Author

@skywinder skywinder Mar 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GCP deployment workflow specifically uses Dockerfile.datadog, not the Dockerfile.
so the immediate changes to your regular Dockerfile won't directly break the GCP workflow.

So, gcp_backend.yml refer to dockerfile.datadog, which is not affected.

file: ./backend/Dockerfile.datadog
push: true

It has 2 differences

  1. Path: in Dockerfile vs Dockerfile.datadog: - since we are running it from /backend folder directly
    Otherwise, we’ll have to move this Dockerfile to ../ to make it work, but I think the proper location is in the backend folder.

  2. Port: I set 8000 from backend readme and docs.

    omi/backend/README.md

    Lines 86 to 87 in 43508d6

    ngrok http --domain=example.ngrok-free.app 8000
    ```

    I see that in Dockerfile.datadog it's 8080. Should I set it to 8080 in dev setup as well?

@skywinder
Copy link
Collaborator Author

TL;DR:
• Silero VAD: Fixed broken distribution, updated download link, specified versions, and added error handling for model loading.
• Docker: Corrected invalid paths.
• Typesense: Added mock client to enable running without a configured service.
• Logging & Error Handling: Implemented logs and error reporting for all services (Firestore, GCS, Silero VAD, PyOgg); the system now reports issues clearly instead of failing silently.

@beastoin
Copy link
Collaborator

guys, feel free to discuss this one btw my tips are:
1/ run the back-end yourself with the current configs and requirements successfully.
2/ simplify setup steps by separating the required envs(should be minimal) and the optional vars. then make the optional vars truly optional, meaning if developers don't add theses optional vars, the back-end should still run and core features work well.
3/ automate back-end setup with docker(or any containerization) and scripting
4/ update the document regarding the changes.

keep the PR minimal and focused on single responsibility.

getting this repo up and running is not that hard, but if it took too long for you, dm me discord / @thinh

@skywinder @mdmohsin7

@beastoin
Copy link
Collaborator

ping me after 2 weeks (or when you are ready for changes)

/ draft

@skywinder

@beastoin beastoin marked this pull request as draft March 17, 2025 04:52
@beastoin
Copy link
Collaborator

/ closed

feel free to reopen it any time man.

@beastoin beastoin closed this Mar 24, 2025
@skywinder skywinder reopened this Apr 10, 2025
@beastoin
Copy link
Collaborator

hey man, it's cleaning time.

/ closed

3 days with no updates
feel free to reopen it anytime

@beastoin beastoin closed this Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants