RSSAmplifier

Feed :: TheOrangeOne · Jun 27, 2024

Commenting with Comentario

0
Sign in to vote or save

TheOrangeOne

I've had a website for a while now, but it's only in the last few years that it's had comments. At the bottom of every post or project (and my guestbook), is a comments section. There, you can let me know what you think. Want to show your appreciation? Want to suggest an improvement? Want to tell me I'm completely wrong and there's something better (it happens)? Comments are a great way to do that! Rather than me posting content into the noiseless ether, comments allow some feedback from you, dear reader.

<warning

Commenting also attaches user-generated content to your website, which can be problematic if you're not keeping on-top of spam content. Requiring authentication is a good way to reduce it, but it's not perfect. Consider yourself warned.

</warning>

For numerous reasons, I wanted a comment system I could host myself. My website and analytics were already self-hosted, so it made sense for my comments to be, too. I could run it all on the same server with no increase in costs. For that reason, solutions like Disqus were out (and that's before it had ads).

Back in mid-2022, after a bunch of research into potential solutions, I settled on Commento. It was self-hosted, lightweight, and supported a number of different authentication mechanisms. Better yet, it sent me an email whenever someone commented. Unfortunately, even in 2022, the project was stagnating a bit, having not been actively maintained in over a year, and the open issues were piling up, including from paying users about the status of the project. Conveniently, around that time, A community member showed up to fork the project, and created Commento++. This fork fixed a few of the bigger outstanding bugs, and tried to keep the spirit of the project running.

Unfortunately, Commento++ too started to fall behind. Since deploying it nearly 2 years ago, it's also seen very little activity. A few months ago, I set about researching into a few alternatives.

#Looking for Alternatives

With both Commento and Commento++, I needed to find another solution. When I'm looking for new tool, awesome-selfhosted is a fairly good place to start, and it has a few suggestions under the poorly named "Communication - Social Networks and Forums" section.

#BYO

The first potential solution is to build something myself - I am a developer after all, and this site is powered by a CMS - why not just build something in? Simple: I don't want to. I could build a commenting platform, but I'd rather use someone else's. It'll look better, function better, and be much quicker and easier to implement.

#Discourse

One of the first solutions which stood out was Discourse. If a community has an online forum, chances are it's powered by Discourse. Discourse is a great forum platform, and is completely open-source. As it turns out, you can embed Discourse into another site and use it as a form of comment system. Discourse has so many useful features, but as a result it makes it absolutely overkill for a commenting system on a relatively small blog.

#Isso

Isso is trying to be as simple of a comment system as it can be, and it hits that mark great. Comments are written in markdown, stored in SQLite, and just needs an email address to comment.

Whilst it's simple, it's a little too simple to me. The interface is a little simple for my taste and there's no ability for users to login.

As a fan of both private and lightweight technologies, remark42 stood out to me. It's lightweight, easy to use, and is fairly well maintained. It also supports importing from Commento, which is a requirement for me. The website lists a bunch of features, all of which sounded great to me.

One of the biggest blockers with remark42 is its lack of moderation dashboard. Sure, I get notified when new comments come in, but being able to see all comments in a single screen is great for moderation and other management tasks. The development speed is also a little slower than I'd like - an import bug I filed in November wasn't released until March - but that's a nitpick at best.

#Giscus

An honourable mention goes to Giscus. Giscus looks great (if you like GitHub's aesthetic), is simple and easy to use, and you can self-host part of it. Unfortunately, it's very closely tied to GitHub, and requires a GitHub account to comment. Sure, the target audience of my website probably already has a GitHub account, but I didn't want to depend on 1 platform for authentication just to add a comment. If you want a simple no-nonsense comment system, I highly recommend giving Giscus a look!

#Cactus

Cactus was another system which caught my eye. It's a comment system, but delegates basically everything off to Matrix, so conversations can be continued in any other Matrix client. As interfaces go, that's quite powerful, but also could be quite annoying. To me, comments are a place to comment, not necessarily have a full conversation (like you might in a chatroom). The other obvious issue is that it requires Matrix, which is a fairly niche platform even in the tech community.

#Enter Comentario

It was around this time, after looking through some open issues on Commento, that I discovered Comentario - yet another fork of Commento. But this time, it seems to have an incredibly driven maintainer, who's done a lot of improvement work since forking.

Comentario's frontend has been completely rewritten, both the administration site and comment embed, with the aim of being easier to maintain and contribute, not to mention being written in Typescript now. The commenting experience doesn't seem much different, but the admin site is significantly nicer - I can't undersell how much nicer it is. It looks nicer, it has more features, and is much less clunky.

At the moment, Comentario seems to be maintained by just 1 person, but they're doing a heck of a job. Issues are resolved incredibly quickly, and it shouldn't take long before a community starts to form (raising awareness is a good way to help).

I looked at Comentario for a while. Studying the feature-set in the docs, playing around with their demo, looking at the feature throughput. Given the trap I'd fallen into with Commento++, I didn't want to be burned again bu yet another promising-looking Commento fork. After a while, I decided to switch, keeping Commento++ around for a quick switch-back.

#Deployment

Comentario is exactly as simple as you want from a self-hosted project. It's a single small Docker container, that uses an external database container (I used PostgreSQL, because it's what I'm familiar with.

The biggest surprise to me was how you configure the container. Commento (and Commento++) configured everything through environment variables, in true 12-factor style. Comentario configured some things using environment variables, and anything which could be deemed secret lived in a secrets.yml file mounted into the container.

Spitting out an extra YAML file from my Ansible configuration wasn't any additional trouble, it just seemed odd to need 2 separate ways of configuring. It's fine, but it'd be nice if everything was configured in 1 place (environment variables - they're the answer).

#Content migration

When migrating comment system, it was important for me to not lose any data. Sure, there's only just over 150 comments across my entire site, 40 of which are replies from me, but I'd much rather switch platform and keep the data - especially when just testing it out.

Commento++ has the ability to export comments to a JSON file, which Comentario can import. After bootstrapping the Comentario install, it was just a simple export and import before all my comments were in place. Or, so I thought.

Unfortunately, the user attribution on the comments was a little messed up - it had mostly tracked who created an issue, but assumed they were all system users, rather than having logged in with GitHub or GitLab. This doesn't sound like a big deal, but it would mean future comments of theirs would be as if they were a different person. After digging deeper, it turns out the Commento export doesn't contain all the information needed to reconstruct all the data in another system.

And then, Comentario came to the rescue once again. Being a fork of Commento (not Commento++), it's based off its database state, and has just a handful of new migrations. An issue raised just a few weeks ago uncovered the 3 migrations added by Commento++, and that it should be simple to basically ignore them and run the Comentario ones on top.

Everything I know about database migrations is screaming not to do it - database migrations out of sync can cause huge issues for the application. In these cases, it was just adding a few new columns and a stored procedure. The issue suggested removing their entries in the migrations table, and just running Comentario on the same database. Comentario would then run its new migrations, and I'd be left with all my comments complete with all their data, because it didn't move anywhere in the first place.

On my lunch break, I tried it. Of course, I backed up both the old Commento database and the new poorly-imported Comentario database. Once I started Comentario, I reset my password (it claimed my password had to be fewer than 8 characters), made myself a superuser, and logged in. And there, right where I left them, where all my comments, complete with correct attribution.

#Website integration

Happier that Comentario worked, and I had all my data, I looked at switching out the embed widget on my website. This was new code, so it required a few changes. The embed itself was still just 2 lines: A script tag and an element for it to target. It took no longer than 2 minutes to integrate. But then, I noticed a problem: dark mode, or lack thereof.

At the time I deployed it, Comentario had been designed only to work on light-themed sites, and it wasn't able to switch to better-integrate with a dark-mode site. My website can be either light or dark, depend on what you prefer (there's a switcher in the top-right), and whilst Comentario looked great in light mode, the same wasn't true for dark.

Commento had the same issue, but someone (I can't find a link anymore) did the hard work of skinning it in dark mode as an external stylesheet, which I copied into my website to make it integrate better with the existing styles. Comentario, being newer and less well-known, hadn't received the same treatment. In fact, no one had mentioned dark mode in any of the issues. In the interest of time, I threw together a very quick and dirty stylesheet to override just the elements I noticed to match my website. You can see it for yourself, but I probably wouldn't copy it.

Like a good open-source citizen, I opened an issue, to track the work. Re-skinning a project to be dark-mode compatible isn't a simple task. Unless you design a project from the beginning to be modular or themable, you might need to rewrite large chunks of your styles.

To my absolute bewilderment, the very next day was a preliminary patch to add dark-mode, and just 2 days after that the issue was closed with a finished and documented dark mode! At the time of writing, it's not in a released version yet, but once it is I can remove my styling hacks!

#Conclusion

Comments help make this website more of a 2-way relationship, as opposed to me screaming into the void. Getting input and feedback from people helps keep me learning and my posts improving. Commento was a great tool when it existed, but the sole maintainer disappeared, and the project stagnated. I'm no Go developer, but I'm intending to help the Comentario project however I can to make sure it sticks around, and its maintainer doesn't go the same way.

Sure, it's been less than a week since I migrated to Comentario, but I have a feeling I'm going to really like it here.

Read the original on theorangeone.net

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.