02-11-2015, 09:23 PM
We can add an interface for the current version - at least for the Jenkins builds. There is already a scaffolding for that in place (MCSERVER_BUILD_ID et al.) Also the OS platform and version should be made available to plugins, so that the plugin knows what kind of executable to download.
Then, the plugin would be able to tell if there is an update or not, and it could also download the update.
One problematic thing is replacing the actual executable - on some OSes it is impossible to replace a program executable file while it is running. And re-starting the server afterwards will need some thinking, too - if none of your code is running, how do you start it automagically? Perhaps a per-OS-specific shell script could be made.
Also, in order for the updates to be at least reasonably safe from hackers, you'd need to use SSL for the download protection, some form of certificates to verify executable authenticity, otherwise hackers could fool your server into updating to their own hacked executable, doing whatever mischief. And on the lower level we need at least a client-side HTTP protocol implementation in Lua; the one provided in LuaSocket doesn't seem too usable for us, it's not event-driven.
I'd postpone such a plugin for now; I'm currently working on bringing SSL to Lua API and then perhaps HTTP client and server as well - the objects that the WebAdmin uses should be reusable enough here. Until then we could think about the problems above - replacing and rerunning the executable and certificate verification.
Another question to answer: should this plugin also do plugin updates? If so, we need the plugin repository and proper versioning, as well as querying the versions from the running plugins.
Then, the plugin would be able to tell if there is an update or not, and it could also download the update.
One problematic thing is replacing the actual executable - on some OSes it is impossible to replace a program executable file while it is running. And re-starting the server afterwards will need some thinking, too - if none of your code is running, how do you start it automagically? Perhaps a per-OS-specific shell script could be made.
Also, in order for the updates to be at least reasonably safe from hackers, you'd need to use SSL for the download protection, some form of certificates to verify executable authenticity, otherwise hackers could fool your server into updating to their own hacked executable, doing whatever mischief. And on the lower level we need at least a client-side HTTP protocol implementation in Lua; the one provided in LuaSocket doesn't seem too usable for us, it's not event-driven.
I'd postpone such a plugin for now; I'm currently working on bringing SSL to Lua API and then perhaps HTTP client and server as well - the objects that the WebAdmin uses should be reusable enough here. Until then we could think about the problems above - replacing and rerunning the executable and certificate verification.
Another question to answer: should this plugin also do plugin updates? If so, we need the plugin repository and proper versioning, as well as querying the versions from the running plugins.