What's new in asciinema - part III: the server Published on 12 Oct 2023 by Marcin Kulik
Let’s begin with OPS stuff.
asciinema.org uses email-based login flow, where you get short lived login link (some call it “magic link”). Over last 10 years that email was delivered via several email providers. From the top of my head, roughly in order: Mailgun, Gmail, Sendgrid, Fastmail. I won’t go into details of why I’ve been switching from X to Y, as the reason was different in each case, but overall there was always something (and when it wasn’t a tech issue then it was a price issue). The last switch happened a few months ago to AWS SES. It’s been reliable (so far) and ridiculously cheap. asciinema server uses Bamboo library for email delivery, and thanks to Bamboo’s pluggable adapters it was trivial to switch. If you want to use SES for email delivery with your own instance of the server then follow the instructions here.
Next, the recent integration of libcluster will ensure live features of Phoenix framework, such as LiveView and PubSub, work seamlessly in multi-node setups (like the one on asciinema.org). This will come in handy for live streaming feature which should come soon (more on that in a future post).
Concluding the admin/OPS side, I’ll mention that I moved the official docker
image of the asciinema server from
ghcr.io/asciinema/asciinema-server. Docker Inc.’s recent hostility towards
open-source (without which it
wouldn’t have existed in the first place) didn’t feel right. While they later
apologized for “doing a terrible
job” it was too
little too late. Damage was done, I’m not going back there. They’re gonna pull
off something similar in the future. GitHub’s ghcr.io is
owned by another corporation, sure, but they seem to understand the value of
open-source communities better than current Docker Inc. management, therefore
until they prove me wrong I’m willing to keep the container images there. It’s
not that hard to migrate away if they do.
Shifting under the hood of the server, there’s been a lot of maintenance and
code refactoring. In addition to preparation for more real-time features
mentioned earlier, Elixir, Erlang and Phoenix, upon which the server is built,
were updated to newer versions (Elixir 1.14, Erlang/OTP 25.2, Phoenix 1.7). I
started converting view templates to new
.heex format, which elegantly solves
view component reusability and composability, while ensuring HTML syntax
validity at compile-time. Super neat stuff, and I’m excited about this, even
though the conversion from
.heex requires extra work.
Furthermore, the server got basic WebFinger endpoint (my asciinema.org user in WebFinger lookup service). Even though it’s not very useful right now, it will become instrumental in future developments ;)
SVG previews, which are available by appending
.svg to a recording URL, got
support for “true color” (24-bit SGR variant):
Finally, on the UI side, you might have noticed addition of Nord theme in theme selector (both in user settings and individual recording settings), as well as new font selector, which allows using one of Nerd Fonts variants with your recordings (useful if you have fancy shell prompt with symbols/icons). Additionally, recording metadata, i.e. icons for terminal environment (OS, term type, shell) and views count, received a bit of polish. Recording index pages were updated to use an appropriate number of thumbnail columns on various screen sizes.
Lastly, markers feature of the player has been exposed on recording settings page - you can configure a list of markers by simply listing their times and labels like this:
5.0 - Intro 11.3 - Installation 32.0 - Configuration 66.5 - Tips & Tricks
This concludes the server-related improvements, and the “what’s new in asciinema” series. I hope you enjoyed it. Don’t hesitate to reach out with feedback, I’m all ears (not as much as this little guy though).