Server Auto-Updater/Checker
#1
I was talking to Xoft and he said that it would be possible to make an auto-updater for MC-Server, so is there anyone that wanna tackle this?

Either a plugin that tells you that there's an update and you can get it yourself or that it gets the update automatically, maybe that it places the downloaded .zip file or extracted files in a separate folder so that we can replace the files ourselves when we want to update.

So here the idea what the plugin could do:
1. It tells you that there's a new update.
2. You can use a console command to get it like: update get.
3. It checks what files you already have and only downloads the files nessesary for the update.
4. It checks which files that you yourself have changed and adds those changes to the new files.
5. you can choose between 3 settings: "Auto-Upddate: 0(doesn't notify you and doesn't download anything)/1(only notifies you)/2(notifies you and automatically downloads)".

Those are just suggestions, you can ofcourse do the plugin the way you want to.
Reply
Thanks given by:
#2
@xoft. Do you really think it's possible? As far as I know there is no way for a plugin to see the current version of the server it's running on.
Reply
Thanks given by:
#3
xoft Wrote:The server doesn't auto-update, you need to download a new exe when you want to update it.
Now that we've made networking available for the plugins, it might be possible to write a plugin that would auto-update the server for you.
it would seem like I missread that message, I thought I read "it would be possible"
Reply
Thanks given by:
#4
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.
Reply
Thanks given by:
#5
(02-11-2015, 09:23 PM)xoft Wrote: 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.

Or the plugin could just check for updates and tell you if there's a newer version in the server launcher window so that you know that there's a newer version and then you can get it yourself if you want to, something that basic should be possible right?
Reply
Thanks given by:
#6
Under Linux, I have a script that does a git pull and if there are no changes, it exits. If there are changes, it kills MCServer, runs the build script, runs the install script, and then starts up MCServer.

I could make this generic for people if they wanted. I run it under cron at 1am daily.
Reply
Thanks given by:
#7
How will the update plugin know that it's running under such script? If it isn't and the plugin kills the server, then no-one is restarting the server, the admin has to do it manually.
Reply
Thanks given by:
#8
(02-13-2015, 07:05 AM)xoft Wrote: How will the update plugin know that it's running under such script? If it isn't and the plugin kills the server, then no-one is restarting the server, the admin has to do it manually.

My script is not really for a plugin, but just a bit of maintenance.
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)