this post was submitted on 12 Jun 2023
47 points (100.0% liked)

Programming.dev Meta

59 readers
1 users here now

Welcome to the Programming.Dev meta community!

This is a community for discussing things about programming.dev itself. Things like announcements, site help posts, site questions, etc. are all welcome here.

Links

Credits

founded 1 year ago
MODERATORS
 

Hi all,

Thank you for joining me here! It's great to see that we have a community that wants to grow in such a new and exciting manner.

As it is, I thought it would be a lot easier to do this by myself than it has been. So I'm asking for some help!

I have several things I need assistance with:

  • setting up and moderating a chat community, for those times when users are having issues with the website. I think it's up to the community what software we use, but I would probably prefer Discord. Since this is all federation though I completely understand if others want to use something like Zulip or Matrix! So let's just use what everyone wants. If you have an opinion please post below.
  • database stuff. I'm absolutely terrible at database stuff, and that is not an exaggeration. If anyone is willing to help it would be much appreciated. Currently I have a need to set up pgbouncer, or we should modify the lemmy source to allow for setting up a bouncer. I also want to set up read replicas so that we can distribute the load a bit more evenly. As it currently is, the site was simply set up with the lemmy-ansible script, so everything is running on a single box ๐Ÿ˜ฌ. If you know Rust and want to help modify the Lemmy source code for this, or you are a Database Admin and want to help, I'd very much appreciate it.
  • instance admins. I cannot be online constantly and I do have a day job. I'm getting messages and applications to join the instance along with needing to set up new communities, create and update rules, moderate, etc. I cannot handle this all alone.
  • I also need some general help.
    • email admin
    • migration of server to larger VPS (will have to bring the entire site down for this, unless someone wants to help set up a load balancer, a brand new box, and have some sort of migration strategy.)

If you want to help out on the server side of things I will want to know your real life persona, but for instance admins, chat mods, etc. I would just like to see some sort of comment history from you elsewhere.

And thank you once again, for helping create an inclusive community.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] ChimpScanner@programming.dev 2 points 1 year ago* (last edited 1 year ago) (1 children)

I shortly looked through the source code for Lemmy, and it's using a Rust ORM named Diesel. I don't know Rust at all, but it seems like in order to add the ability for pgbouncer, two things would need to be done.

  1. There would have to be separate environment variables for a direct connection to the database, to run migrations. Prisma (an ORM for Node.js, which I am more familiar with) does something similar: https://www.prisma.io/docs/data-platform/data-proxy/prisma-cli-with-data-proxy#set-a-direct-database-connection-url-in-your-prisma-schema. From my understanding, pgbouncer is essentially a queue for the database. So if you have a bunch of things in the queue, it will delay your migrations from running.
  2. Once step 1 is completed, the regular database environment variables can point to the pgbouncer connection pool. Based on the pgbouncer documentation: PgBouncer acts as a Postgres server, so simply point your client to the PgBouncer port.

Like I said, I don't know Rust but I would be interested in learning it if I have time. Or maybe someone else in the open-source community could work on this. There's no specific issue for adding pgbouncer support, but there's an issue about slow SQL queries that mentions it: https://github.com/LemmyNet/lemmy/issues/2877

[โ€“] msage@programming.dev 4 points 1 year ago* (last edited 1 year ago)

PgBouncer is a connection pooler, it works as a cache for the PostgreSQL database handles. I'm not aware of any queueing outside of that.

Migrations just need read-write handle, which PgB can provide, there is no need to move around it. Edit: also a user with alter privileges :)

Alters need various levels of schema locks, which are a separate domain of problems. If the migrations only add new relations and empty columns, migrations will only lock for a milisecond, but will still wait for the lock in the queue. 'Destructive alters' where you can lose data by dropping columns or 'productive alters' adding lots of values will lock for the entire table rewrite, but I would expect the devs to know this and not write alters like that without warning in the changelog.