asciinema / asciinema-server

Platform for hosting and sharing terminal session recordings
https://docs.asciinema.org/manual/server/
Apache License 2.0
2.29k stars 263 forks source link

live-streaming feature referenced in asciinema/tst but not (yet) functional? #427

Closed miojonka closed 4 months ago

miojonka commented 9 months ago

Hi,

I was trying to test the live-streaming feature of asciinema-server with tst (https://github.com/asciinema/tst) and the documentation at tst references of a "stream-producer-token" and code for this seems to be present in asciinema-server, but I cannot find a way to obtain such a token. My self-hosted instance does show log entries like "stream not found for producer token " when I try to stream via tst, so it seems the code is active, but not completely?

How can I test it?

miojonka commented 9 months ago

Okay, I found the streaming token for my test user by raw database query, and once I got the right URL streaming worked nicely and the webUI even allowed me to toggle it private/public as well as alter some other settings.

SELECT * from live_streams; showed me a token is created for each new user except the asciinema user. (id=1)

I just can't seem to find a way for an authenticated user to obtain knowledge of their streaming token or create another one for multiple streams.

ku1ik commented 8 months ago

Well done figuring it out :)

Indeed the code is active, but it's not exposed in the UI yet. The reason for that is, the streaming protocol is not fully tested yet, so I didn't want to open the flood gate of users reporting issues. My plan is to first announce the availability, and enable the discoverability of the producer token in the UI for users who are willing to help testing, and reach out. I'm also considering integrating tst into the main asciinema CLI, for the 3.0 or 3.1 version.

Awesome that you started playing with it. How it's been for you so far? Any problems, ideas?

miojonka commented 8 months ago

It works like charm, we tested it for multiple hours. It would be nice to have GUI for obtaining the streaming token (and maybe resetting it or even creating multiple ones). I did write a PKGBUILD for Archlinux for asciinema-server to install it natively as a package, made deployment a bit easier.

ku1ik commented 8 months ago

It works like charm, we tested it for multiple hours.

Awesome! Thanks for the feedback.

It would be nice to have GUI for obtaining the streaming token

Yup, this will be added soon. I just need to wrap 3.0 beta of the CLI, then will focus on this.

and maybe resetting it or even creating multiple ones

Exactly. Resetting/rotating is something I was also planning.

I think, on asciinema.org I'll initially limit the number of available streams to 1 per user by default, and increase the limit upon user's request (I don't know what impact on the server load this feature will have so I want to start gently).

With self-hosted server you would be able to configure the per-user limit or disable the limit (have unlimited live streams).

I did write a PKGBUILD for Archlinux for asciinema-server to install it natively as a package, made deployment a bit easier.

Cool, have you pushed it to AUR, or it's just for your own use?

miojonka commented 8 months ago

Looking forward to the updates then!

And yes, unlimited streams might not be the best for the public instance.

I do not have time to properly maintain an AUR package currently, but you can use/publish it: asciinema-server-pkgbuild.tgz

I had to bump rustler and disable tzdata since it was throwing errors constantly. Sentry was disabled because the test instance does not need tracking. The beam.smp service seems to grow memory-wise over time, not sure if it converges or keeps growing. Once the package is installed a local postgres installation configured like in the Archlinux wiki does the job.

ku1ik commented 5 months ago

@miojonka the latest version of the server (20240428) exposes the streaming feature in the UI - there's new "Stream" option in user dropdown menu (top right, in navbar), and when a stream is made public its preview card is shown on user's profile when it's live.

I have now integrated tst into the main CLI, and archived the tst repo.

You can now use asciinema CLI 3.0 RC1 to stream: https://github.com/asciinema/asciinema/releases/tag/v3.0.0-rc.1