What exactly do Gongo packages do?

I am looking to adapt kiri art for my own project, but I am unsure how to swap Gongo for some other backend/DB. But it looks like there is also MongoDB references in the code.

  • Anyone can share how Gongo works with external MongoDB?
  • Any quick steps on how to swap out Gongo and Mongo for something like Postgres/Supabase? Do I need to swap out Gongo?

I have manged to setup depth2img for diffusers-api and added it as a model, but am not sure how to manage user and credits. (gaddic if you see this, I’m the noob that ask about transformers for docker, thanks for the help there!)

Hey @DaveG2!

Great to see you again and my pleasure.

Ok, so, a little history is required here. Originally the main part of this entire project was the open source webui. It was hard to promote without a live demo, and since GPU costs, had to create a credit system from that. That site ended up becoming the most popular part of the whole project, and grew very quickly, with a lot of development coming at the expense of ensuring the webui could still be run easily outside of kiri.art.

I actually plan to spend some time separating out all the kiri-specific parts from the webui, and to release it as an independent project called diffusers-webui. Since it will still be used by the kiri site, it will have a number of hooks that kiri and other projects will be able to tap into to customize it. That’s the good news. The bad news is that this is months away, I won’t even be able to start this work until a large number of more important and urgent tasks are completed (around docker-diffusers-api and kiri.art devops).

So in the meantime, let me answer you about Gongo.

GongoJS is client-side database that runs inside the browser, and is offline-first, reactive, and comes with react hooks. There is also code to synchronize the client-side databases from server “publications” - that currently runs against mongo only but a lot of the logic is already there to support other database backends. Having said all that, this was just something I worked on in my spare time over the last few years. It’s all open source but I can’t really in good conscious recommend for anyone else to use it, as there are a lot of gotchas that require fairly deep understanding of the code :sweat_smile:

So:

  • The quickest way to get up and running is to continue using Gongo with a MongoDB backend. Since all the code is there already, it shouldn’t be hard to adapt; but there may be some long-term maintainability issues :sweat_smile:

    1. Set MONGO_URL to the mongo URI (mongodb.com offers a generous free plan).
    2. For local development, set env var REQUIRE_REGISTRATION=1
    3. See the examples for google/twitter/github authentication. Big undocumented gotcha, after any change to this info (GOOGLE_CLIENT_ID, etc, env vars), you must call http://mysite.com/api/gongoAuth?type=setup to update the database with these values.

    That should be enough to get up and running, but unfortunately, I won’t really be able to offer any support with the Gongo stuff… although I think it’s a great project which in theory I’d love to get to production state for everyone, I just don’t have any time to dedicate to it :confused:

  1. The most sustainable option is to wait for the kiri / webui refactor and put in your own logic, but this is a few months away at least.

So, help this somewhat verbose answer sheds some light to the situation, and sorry I don’t have a quick easy answer for something immediate.

Hey @gadicc , thanks for the great and detailed answer, I really appreciate the time you spend on these and for the reply! Do focus on what you want to do, I will figure something out :slight_smile:

1 Like