What's the best way to achieve this?

Discussion in 'Programming' started by Remy2402, Feb 27, 2016.

  1. Heyo!

    So I want to use our already established staff panel on my network to control different actions related to the server themselves for devs and higher. I want to be able to restart the entire network (or specific servers) with the click of a button on our web panel. Now I already know how I would restart the servers and all this, but how would I go about actually sending a signal from the site, to the servers? Really stumped on how to do this so any help is appreciated.

    Thanks
     
  2. Do you already have a connection to the servers working and are able to run commands?
     
  3. What do you mean? From the website?
     
  4. A plugin or rcon?
     
  5. I know how to handle all the plugin side of things but what would I use to send the signal from the website to the plugin?
     
  6. You could take a look at how PufferPanel is doing it.
     
  7. You would need a program to start and stop the servers along with a way for it to have a connection which can control it. Using php or something else you would connect to the program and issue commands
     
  8. You should use sockets and listen on them for a connection from your webserver..
     
  9. Ok I will look into what you guys suggested. Would storing some data in a sql table be good? And then the server reads that table every 10 seconds or so and executes the actions?
     
  10. The best way to do this would be to use websockets.
    Checking for new data every 10 seconds is slow and using mysql for something like this should be your last option.
     
  11. You would want to have a daemon running on the servers that controls the servers and can read stdin/stdout. Then you just send a request to a HTTP endpoint on that daemon to control the servers.

    You can look through my daemon code, but be aware that is isn't designed to be used as a single service and leverages docker so it is a bit different than what you would be going for.