Hi there,

I want to develop a Django site where users have the possibility to 
interact with systemd services in realtime and to see the log output in 
realtime.

I sketched up a quick draft on my idea how this could work: 
https://i.imgur.com/pd5uLtl.jpg


One simplified use-case would be:

  1. User visits Django website.
  2. User chooses one of many systemd services. each service would be 
represented by a single webpage, eg. /services/id/1, /services/id/2...
  3. User gets presented a realtime log, the source being either journald 
or lastlog-file on the file system.
  4. User clicks on Stop button.
  5. Service gets stopped.
  6. User receives exit codes, etc. in a readable format.
  7. User clicks on start button
  8. User receives exit codes (started successfully/failed/etc) in a 
readable format.
  9. User leaves Django website.

I wrote a simple Controller (MyController.py) that connects to the systemd 
interface of the dbus, to controllthe systemd services and listen for 
property changes, but also to read logfiles from the file system. I inteded 
MyController to run as root and sit between Django and dbus/systemd.

I would think WebSockets are the best solution to deal with the realtime 
log display in 3) and with the live interaction in 4) 5) 6) 7) and 8).
I recently read about Django Channels and I believe this would be the 
solution to Django<----(WebSocket)----->User.

But somehow Django needs to talk to my MyController.py daemon for starting 
and stopping, as well as getting the systemd exit codes across to the User 
in realtime.
I believe I cannot use xmlrpc, because that is a pure Request<->Response 
principle. But a live log is continuous, and if you start a service, that 
could take ten seconds and I really want to have quick response times. I 
also thought about background job management, but I prefer WebSockets over 
this, so I don't have to implement multiple technologies.

My question would be this: Could I somehow use Channels to connect 
MyController with Django and vice versa, similar to xmlrpc but so that both 
sides can send?

I am open for all ideas at this point, but I prefer to implement only one 
kind of technology if that would be possible.

Thanks in advance!

psaodwhatevermynameis.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4224be09-059f-42e5-8352-b3aad34bf5b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to