this post was submitted on 12 Jun 2023
50 points (98.1% liked)

Programming.dev Meta

2478 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 2 years 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.

top 34 comments
sorted by: hot top controversial new old
[โ€“] Ategon 12 points 1 year ago* (last edited 1 year ago) (1 children)

In terms of chat community Matrix seems like the best option since there's mechanics built into Lemmy to interact with it nicely (for example you can add a matrix profile to your account and then people can click a send secure message button when they view your profile to message you on matrix)

Discord does have the most users though

The database knowledge required for the things relating to databases most likely extends way past what I know but I would be willing to help out as an instance admin to keep things running. Ive got some social medias linked in my Lemmy profile if you wanted to check my history

[โ€“] msage 7 points 1 year ago (1 children)

Is there any nice documentation about integrating Matrix with Lemmy?

I have my own Matrix instance, so that would be very cool to be able to utilize.

[โ€“] Ategon 6 points 1 year ago

They can't interact extremely well as Matrix is using its own protocol rather than ActivityPub but things like bridges should be able to be made. (For the Lemmy mechanics here it basically just opens up a link in matrix rather than interacting with Matrix from Lemmy). Don't really know any documentation as I'm relatively new to matrix but I found a bridge between Matrix and Mastodon when I tried to look that may help https://github.com/ma1uta/mxtoot

[โ€“] Sleeping 9 points 1 year ago (1 children)

I'm not really a fan of Discord, so something else would probably be preferable, but whatever it ends up being, I'd really appreciate it if, whatever it is, I could create an account without an email, or even better, if I could just read what's going on without having to sign into something.

[โ€“] msage 1 points 1 year ago

Yay for Matrix!

[โ€“] ruffsl 8 points 1 year ago (1 children)

May want to consult this selfhosted community about managing a lemmy server: https://lemmy.world/c/selfhosted

[โ€“] jmk1ng 3 points 1 year ago* (last edited 1 year ago)

Agreed. As Lemmy instances start getting slammed, there will be a community of instance hosters there developing best practices and so on. Definitely lean on the community there

Also I'd seriously advise against forking the code. You'll be signing up for a world of hurt keeping your customizations up. Contributing to the core project is a better investment if possible.

Finally, thanks OP for standing up this instance! Costs are likely to keep growing, so I hope there's a way we can contribute financially as well

[โ€“] Mustafaalbazy 6 points 1 year ago (1 children)

I used to work as a senior linux sysadmin for some webhosting/datacentre before i go back to education to do my engineering degree. So i may be able to give a hand in that direction.

[โ€“] snowe 1 points 1 year ago

Well that would be great. Can you join us in the discord? https://discord.gg/FXWnavvU

[โ€“] msage 6 points 1 year ago

I'm not a DBA, but I love Postgres, so let me know when I can help with anything.

[โ€“] treegardendev 6 points 1 year ago (1 children)

Nowhere near as experienced as some of the users here, but I use Rust and databases on a daily basis for work. Would be willing to learn if there is a need

[โ€“] snowe 1 points 1 year ago

Please join us in the discord! https://discord.gg/FXWnavvU

[โ€“] pwshguy 5 points 1 year ago

I'd be glad to help out where I can. I have plenty of infrastructure background, so I can help with emails, backends, some database stuff, and other admin needs. I'm not familiar with VPS, but have worked on enough platforms I'm sure I can be of service.

I added my profile here to my linktree, so that you can see I'm a real person. https://linktr.ee/mdowst

[โ€“] TwilightKiddy 5 points 1 year ago

Not familiar with most of tech needed to run a lemmy instance, but I'd be glad to help with simpler stuff like digging through email.

[โ€“] u_tamtam 5 points 1 year ago (1 children)

I would like to suggest XMPP for the community chat. Federated+standardized protocols that are practical to self-host should be priorities in a world were lemmy is viable and makes sense. In this area XMPP is much friendlier (in admin, in complexity, in resource-usage) than the alternatives.

I also happen to have experience running ejabberd clusters for a couple communities and can offer some amount of sysadmin help would it be wanted. Another interesting aspect of XMPP is that there are efforts underway to federate with the fediverse, so we could probably enable chatting over XMPP with lemmy accounts and vice-versa at some point.

[โ€“] [email protected] 2 points 1 year ago (2 children)

Any of the xmpp communities open? I've tried matrix for chat and it's kinda janky, I wouldn't mind trying an xmpp server.

[โ€“] msage 3 points 1 year ago (2 children)

What issues did you have with Matrix? I've been using my own instance for almost 6 years, mostly chat, and it's working great.

[โ€“] u_tamtam 3 points 1 year ago (1 children)

Not OP, but parent poster. I did embrace Matrix in the early days (early 2015), with open arms, when I was looking for a self-hostable instant messaging solution for family & friends, and when it advertised to be "learning from previous protocols' mistakes" and "being modern, with web stuff, unlike XMPP" (a large part of the Matrix communication back then was dismissive of the alternatives, sometimes using flawed arguments like this one. You can check archive.org for the details and how it backfired with the incendiary or plain ignorant points being retracted over time).

Either way, one thing to note about Matrix is that it came out in a crowded world with well-established (open and commercial) players, but with the ambition to be the next venture capital-infused unicorn. In this position you must demonstrate some truly unique ability, so Matrix' reason to exist became to tackle a very difficult problem that nobody had: that of distributing chatrooms across many homeservers (instead of adding redundancy at the server level, like every major protocol had done before, resting on decades of computer-science know-how in the area of distributed systems). This led the Matrix protocol and its implementations to be truly insane, and a wild roller-coaster of inefficient and buggy implementations hasty deployed, fuelled by bold promises and hyperbolic claims to keep the funding going on.

To this day, the Matrix protocol has seen countless reboots, the canonical server implementation is in fact 3 distinct projects each trying to shove into a faster programming language more of the inefficiencies of the computing model, and if it hadn't broken backwards compatibility so many times, you could perhaps still find discussions in the open between myself and Matthew along the lines of: (in 2015)

  • Me: this is insane
  • Matthew: we can make it work. We are very close. I found a new way to fan-out the data and it will be ready in couple months. It will solve everything!
  • Me: but you don't need this. Nobody needs this. Just focus on the front-end/UX and build it on top of something that works and is lightweight. Revisit that later if you must.
  • Matthew: we can make it work. Couple months!

Fast forward in 2023. You would think that few times "couple months" have elapsed, and that Matrix is stable by now. But here he is, you guessed it, Matthew, telling to a crowded audience at fosdem how he's super very close to make it work for real this time: https://www.youtube.com/watch?v=eUPJ9zFV5IE If you read between the lines, Matrix 2 is a proxy/bouncer for Matrix, to get your client running server-side, which is an admission that the flaws and inefficiencies of the protocol that have been crippling clients won't ever be resolved, and if you happen to be on the hosting side, good luck with your hosting bills.

Don't get me wrong, I'm not against Matrix per-se. It's an open project and they do legit cool stuff there. We should just not encourage people get burnt so much by it. Admins should expect synapse to be hell, scale like crap in any real-world usage, and cost them a lot of time, effort, money and stress. Users should expect things to be slow, awkward and subtly broken for a while, and should be made aware of the heavy toll they incur to whoever is hosting them.

I'm also saying that better alternatives and better designed/more resilient/more privacy-respecting protocols do exist. Being myself a happy XMPP user and admin, I got to read many horror stories from admins of medium/large Matrix instances who just couldn't keep-up, had to close, and re-opened on this side. Their experience is day and night.

[โ€“] msage 1 points 1 year ago (1 children)

Thank you for the extensive write up, really appreciated.

I'll be honest - I didn't study the inner workings of Matrix. I had my own webchat, with like 6 users, wanted a mobile app, and found then Riot.

I still have less than 10 active users, so it keeps chugging along without issues.

There are other issues I noticed, like completely dead Patreon. Dendrite still in beta. Jitsi integration breakdown.

Which makes me sad, XMPP is very old, so I wanted to root for a newcomer. I still do, but my hope is much smaller.

[โ€“] u_tamtam 2 points 1 year ago (1 children)

Wanting to root for a newcomer is what had my enthusiasm for Matrix in the first place, giving XMPP a second look/chance is what made me realize we don't need something new, as in "if it ain't broken, don't fix it!".

XMPP supports billions of devices, every day, in all kind of applications and use-cases. Every android device get their push notifications from GCM/firebase, which uses XMPP under the hood, just like every nintendo switch. Facebook Messenger, Google Chat and WhatsApp all started off from ejabberd. Many large games have their chat system rely on XMPP/ejabberd and support millions of simultaneous users. XMPP isn't old, it keeps getting better, more versatile and used in unsuspected places :)

[โ€“] msage 1 points 1 year ago

So I guess eventually I will end up on XMPP. Good to know, thanks.

[โ€“] [email protected] 2 points 1 year ago (1 children)

It was super slow to join a chat. Also, scroll back history was always buggy, it would tell me I wasn't allowed to see chats from the day before when I've been logged in for days. Room search is slow. I didn't like having to do security keys when I logged in to clients on different computers. The encryption stuff never seemed worth it when 99% of the time in in a public room. Death by a thousand cuts is how it felt.

I did find it more responsive when I used the main matrix network, but I wanted to be on am offshoot and federate on, it always felt slow and painful.

[โ€“] msage 2 points 1 year ago

Wait, did you join some super big rooms from your instance?

I rememember when I first tried Synapse I joined the Welcome room on matrix.org and my server was unresponsive for 2 days until it synced all the events (6 years ago).

I do almost all conversations on my homeserver now and have no issues, apart from the E2E hassle.

[โ€“] u_tamtam 2 points 1 year ago

You can have a look here: https://providers.xmpp.net/

...to pick a provider from the A or B bucket.

Then, client-side, my recommendation would be to go with gajim as a power user, conversations/cheogram on Android (both listed on froid), siskin/beagle on iOS/mac, and have a look at movim.eu for something web based.

[โ€“] RoundSparrow 4 points 1 year ago* (last edited 1 year ago) (1 children)

I suggestion that someone create a shell client stress-test app for the server API. Do a login, do a listing of postings, do a listing of communities, access a user profile, access a posting with 10 comments and another with 150 comments, etc.. Measure the response time and output it in a simple format that different admins can share and identify slow areas within the lemmy_server code.

The problem seems to be rooted in the lack of generating enough dummy test data for the lemmy-server app... it was only incrementally tested with low activity that was on the Lenny network before May 2023... now it is 100x or more data in the comments, upvotes, users, etc.

Each new comment and posting is making servers slower, the SQL is jut not scaling with the current table structures and JOIN usage.

[โ€“] terebat 4 points 1 year ago

+1.

This thing needs to be profiled and optimized. It should not be running into the ground with this low activity. Worse yet is federation reduces the speed by a ton too, but without it, instances have low activity.

I can help out here and try to do it in spare time, but no commitments/promises as I'm currently oncall at $dayjob.

[โ€“] twwilliams 4 points 1 year ago

I would be happy to help out with instance admin stuff, if you still need help. Some examples:

[โ€“] nibblebit 3 points 1 year ago* (last edited 1 year ago) (1 children)

Let's try a discord first so that we can at least connect and figure the rest out -> https://discord.gg/T4PjRWSa

[โ€“] ruffsl 6 points 1 year ago (1 children)

I'm biased to matrix, as the integration opportunity would be too cool to pass up. But from a pragmatic standpoint, it's good to have multiple communication channels as a fail over, especially when self-hosting matrix servers. So just as status pages are hosted separately, having discord as a backup chat channel could be wise if we had domain or server issues. Plus, as you said, it may take a while to figure matrix out.

[โ€“] nibblebit 5 points 1 year ago* (last edited 1 year ago)

I agree, but let's just connect now the most effect way so we can figure out the whos and whats of hosting and so we can help @snowe a bit. I agree that we can then take the time to setup Matrix and mailing and all the other stuff. We can migrate from there :)

[โ€“] jnovinger 2 points 1 year ago

Happy to help however I can! No experience with Rust, but have been doing backend web stuff for quite a while. I'm comfortable with friend stuff as needed as well as Postgres. Also just happy to help with admin things as needed.

[โ€“] ndotb 2 points 1 year ago

I'm willing to help out in any way I can to make this happen.

[โ€“] ChimpScanner 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 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.