Posts: 18
Threads: 5
Joined: Feb 2015
Thanks: 0
Given 1 thank(s) in 1 post(s)
02-11-2015, 08:53 PM
(This post was last modified: 02-12-2015, 04:52 AM by FrozdY.)
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.
Posts: 4,633
Threads: 115
Joined: Dec 2011
Thanks: 694
Given 494 thank(s) in 423 post(s)
02-11-2015, 09:01 PM
(This post was last modified: 02-11-2015, 09:13 PM by NiLSPACE.)
@ 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.
Posts: 18
Threads: 5
Joined: Feb 2015
Thanks: 0
Given 1 thank(s) in 1 post(s)
02-11-2015, 09:13 PM
(This post was last modified: 02-11-2015, 09:17 PM by FrozdY.)
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"
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
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.
Posts: 18
Threads: 5
Joined: Feb 2015
Thanks: 0
Given 1 thank(s) in 1 post(s)
(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?
Posts: 95
Threads: 11
Joined: Nov 2014
Thanks: 7
Given 8 thank(s) in 7 post(s)
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.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
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.
Posts: 95
Threads: 11
Joined: Nov 2014
Thanks: 7
Given 8 thank(s) in 7 post(s)
(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.
|