I’ve recently ‘completed’ a project, which is a twitch bot written in Golang.
Currently it is a CLI application that has a simple server frontend for changing some values.
What I really want to do is make a full web app where a user can sign up and get a bot working on their twitch stream, I would be hosting of course, so similar to Nightbot: https://beta.nightbot.tv/
How do I go about learning how to build this properly? Do I use something like docker to separate user sessions? That sort of thing I need help with.
This question is very open-ended, try to give some more details next time you ask a question.
I will try to be as on point as possible but can’t be sure this isthe info you are lookingg for.
What i guess you want to accomplish:
- Have a frontend that enables users to configure your cli-chatbot
- run multiple parallel instances of the chatbot [process] in parallel
As far as using docker for this, i think it will be overkill.
docker is simply an abstraction layer over the process namespacing addded in linux/unix [offcourse it also does alot of management over this e.g networking/alot of extra security stuff] And in your case there would be no need to use cross process comunication and as long as you keep a tight/secure interface for your cli that should not be a concern.
[my main concern when writing this was performance / resource management, i realize this is not the easiest sollution but if you want to be able to scale effeciently you should be trying to get as much productivity with as little resources as possible and having multiple bots within one process saves resources that would get wasted]
The way i would do it:
- since the program will be “”"“event driven”""" multiple bots can be used in a single process, find out how many clients can be run whithin a single process [actual active bots not just idle ones]
- Make the application refuse to instantiate more than that amount
- to identify bots give them a hash based id [process spits out id on creation and error on failure]
- all interaction with bot will be based on its hash id [so you can interact with individual bots in a process]
- if newest process refuses creation create new process
- keep track of which bots are running in what process [based on pid]
- keep track of process health/status, if a process fails [or server reboots,etc ] just restart it and reinstantiate all running bots [and update the pids,id]
Hope this was helpfull.