Skip to content

feat: Azure CosmosDB as a fallback from repos #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 8, 2025

Conversation

danieldanielecki
Copy link
Member

Fixes #23

Pull Request Type

  • Bug fix (please link related issues if applicable)
  • New feature
  • Question update
  • Other

Summary

Initially, we had questions coming from Azure Cosmos DB, but those have been replaced by fetching directly from GitHub. However, it would be good to have data in Azure Cosmos DB and use it as a fallback, or simply as a backup. The old code has been mostly reused, and modified to have the fallback functionality.

@danieldanielecki
Copy link
Member Author

@eduardconstantin, would you mind reviewing/giving feedback on that? It was implemented in the past by you, and I'd better get your feedback on whether, after these modifications, it's still a valid logic.

Also, I took a look at all the commented out code, and there should be no more. Could you also check if there's still some logic commented out in this one? I think it was mostly the Azure Cosmos DB-related one.

@danieldanielecki
Copy link
Member Author

no worries about the errors in the PR check, it's about metadata, will be easily fixed

Screenshot 2025-05-29 at 13 12 14

@danieldanielecki
Copy link
Member Author

Fixed in 4e50430 + quickly tested locally and the app is still working. Haven't integrated Azure though, still needs to be tested, but waiting for @eduardconstantin a couple of more days! That might be something you might have in your repo as well.

Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://kind-plant-0e80e5803-60.westeurope.5.azurestaticapps.net

@eduardconstantin
Copy link

@danieldanielecki hey, sorry for late response, if you uncomment the code then you should be able to use cosmosdb as a database to query the q&a
unfortunately I don't remember how the q&a was formatted in the db.

@danieldanielecki
Copy link
Member Author

@danieldanielecki hey, sorry for late response, if you uncomment the code then you should be able to use cosmosdb as a database to query the q&a unfortunately I don't remember how the q&a was formatted in the db.

thanks for the feedback, will be debugging next week from localhost if it works :)

@danieldanielecki
Copy link
Member Author

@eduardconstantin, and how about pushing to Azure CosmosDB all the datasets?

@eduardconstantin
Copy link

the dataset has to be formatted, I don't have the database anymore so I can't tell you exactly what was the format but I believe I had an object with the question and the answers and which answer was the right one.

@danieldanielecki
Copy link
Member Author

the dataset has to be formatted, I don't have the database anymore so I can't tell you exactly what was the format but I believe I had an object with the question and the answers and which answer was the right one.

Have you uploaded the dataset manually to Azure Cosmos DB or did you have some kind of script for that?

@eduardconstantin
Copy link

I believe a had a script, but I deleted it after I uploaded the dataset

@danieldanielecki
Copy link
Member Author

I believe a had a script, but I deleted it after I uploaded the dataset

oki, let me try with Cursor Pro to recreate it ;-)

Copy link

github-actions bot commented Jun 3, 2025

Azure Static Web Apps: Your stage site is ready! Visit it here: https://kind-plant-0e80e5803-60.westeurope.5.azurestaticapps.net

Copy link

github-actions bot commented Jul 1, 2025

Azure Static Web Apps: Your stage site is ready! Visit it here: https://kind-plant-0e80e5803-60.westeurope.5.azurestaticapps.net

@danieldanielecki
Copy link
Member Author

@eduardconstantin, I think the PR is ready now. I've been off last 3 weeks, and haven't been working on that, sorry for coming back on that topic...

Would you mind to try it by yourself? What wonders me, is only Cost Management in this solution, but only during first writes to the CosmosDB. I have to first fill the database by going to Practice Mode, once it's there, it's fine. However, during the first writes, I have to increase RU/s in Cost Management for every 2 tests, which wonders me a little bit.

Copy link

github-actions bot commented Jul 7, 2025

Azure Static Web Apps: Your stage site is ready! Visit it here: https://kind-plant-0e80e5803-60.westeurope.5.azurestaticapps.net

@danieldanielecki
Copy link
Member Author

The previous solution was not economically affordable, to have a separate container for every single question set. Azure is charging for every single container. Every single container takes 400 RU/s, and free tier is only until 1000 RU/s. That's why in 79ee998 I made the change, it wasn't feasible economically.

@eduardconstantin
Copy link

When I implemented this I was using only one list of questions for Azure Fundamentals and it fit in their free tier plan.

@danieldanielecki danieldanielecki merged commit e7665ce into main Jul 8, 2025
2 checks passed
@danieldanielecki danieldanielecki deleted the feature/AzureCosmosDB branch July 8, 2025 17:15
@danieldanielecki
Copy link
Member Author

When I implemented this I was using only one list of questions for Azure Fundamentals and it fit in their free tier plan.

Thanks for input! Decided to give it a shoot, after reinventing a more economic solution! :)

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.

[Feature] Use Azure Cosmos DB as a Backup Database
2 participants