airbnb / knowledge-repo

A next-generation curated knowledge sharing platform for data scientists and other technical professions.
Apache License 2.0
5.47k stars 688 forks source link

Multiple repositories on server #492

Open abhirathb opened 5 years ago

abhirathb commented 5 years ago

Auto-reviewers: @NiharikaRay @matthewwardrop @earthmancash @danfrankj Hi I have been able to up multiple repositories on a server. What i'm interested in doing is that whenever someone creates another repository, they are able to "register it" in a way that the existing server picks up a newer one to serve. What would be a good way to do this? Would instantiating a MetaRepository object and setting the app's repository variabe to this new object to the job?

Thanks!

Algebrazebra commented 5 years ago

Based on what you wrote, it sounds to me that simply updating the path provided for the --repo argument upon registering a new Knowledge Repo is sufficient.

abhirathb commented 5 years ago

Oh! I'd have to try that to see if that initiates a cascade to update all objects downstream.

I was able to achieve that by adding a function to "append" to the Metarepository object and then forcing a db_update_index when a new Repo is added.

Algebrazebra commented 5 years ago

Ok, I think I did not entirely understand what you were going for. Am I correct in assuming that you want to have multiple knowledge repositories with one flask instance able to serve all of them? If so, I don't think my suggestion of updating the --repo argument will work, but I guess one would have to try to find out.

abhirathb commented 5 years ago

That's right. I want to be able to serve multiple instances from the same Flask server. Plus, if I want to "upload" a new repo to the existing server, I should be able to supply the path (say on the front end) and the server should now serve all the repositories from before and the new one as well.

Since I was able to figure this out, I should mark this as closed. But before that, I was wondering if this is a useful feature for others and if I should raise a PR?

matthewwardrop commented 5 years ago

Hi @abhirathb ! Sorry for the tardiness. I've not had much opportunity to maintain the knowledge repo lately. Sharing multiple instances from the same Flask server is, as you know, possible using the MetaKnowledgeRepository. Live modification of this repository via the UI has the potential to open up new classes of security issues, and so it would have to be hidden behind an option and/or vetted pretty carefully. I see you've started work on just such a PR, so when it is ready for review, let me know... and I'll try to take a look.