assetto-corsa-web / acweb

Assetto Corsa Server Management Tool via Web Interface.
MIT License
58 stars 9 forks source link

hook to start acserver #67

Open sgohl opened 4 years ago

sgohl commented 4 years ago

Hi,

I am writing a discord bot with the possibility to list configurations and start a server from discord, but I want to use the starting mechanism from your fine acweb app.

The bot should run as a separate process in another docker container, hence there should be some kind of hook to call the procedure to start a server instance, best with predefined ServerName and after-start-hook-script. I could install docker-cli and exec into the running acweb container via docker.sock to execute acserver manually, but I rather want an integration.

a http route which can read json, accessable via internal network would be very good. Or do you see already an alternative easier method to realize that?

any plans ? :-)

sgohl commented 4 years ago

I found out, while acweb maintaining a running acServer pid, killing the pid, acweb recognizes it and will not be shown in the instances panel anymore. But when I manually start an acServer, the webinterface does not list it.

How do you find out running acServer instances? I hoped, starting an acServer, the webinterface will see it ...

Kugelschieber commented 4 years ago

acweb starts and monitors processes. If you start an instance outside, it won't know about it. Adding an endpoint might be the best solution to add this feature but I don't have time or interest in doing that. You can create a pull request or fork the project if you would like to do that.

What language do you build that bot in? Maybe you can integrate acweb into your bot or the other way around?

sgohl commented 4 years ago

I build the bot via nodejs/discord.js (https://github.com/port22/acbot)

I feared you'd have no time. unfortunately I'm a dumbass in programming, most of the time I don't know what I'm doing and if I change enough, suddenly things work :-D so .. bad but works style :-D

would that endpoint be within the go app or the web/frontend thing?

Kugelschieber commented 4 years ago

Within the Go app. You would add an endpoint and call it using a user token which you also need to request via the REST API.