GameServerManagers / LinuxGSM

The command-line tool for quick, simple deployment and management of Linux dedicated game servers.
https://linuxgsm.com
MIT License
4.32k stars 821 forks source link

[GMOD] Command to update addons from github #602

Closed UltimateByte closed 8 years ago

UltimateByte commented 8 years ago

Many server admins use addons coming from github such as ACF, Advanced Duplicator 2, Wiremod...). Those are quite boring to keep updated. LGSM could provide a way to help updating them, either by using github API (i don't know how to use it), or by pasting their zip link to a new file called for example github_addons. Then a command (or a cron job) like ./gmodserver update-git-addons would update them. Two problems to face : those addons usually have caps characters while they have to be lower case to work with Linux, and ultimately, it will have to deal with older addons. So name greps and convert to lowercase commands will be required.

Do you feel like such a function has its place into LGSM ?

JimTR commented 8 years ago

why not just a workshop ? this would mean (perhaps) the server gets content that works rather than bleading edge code that could crash the server ?

UltimateByte commented 8 years ago

Workshop is already supported by LGSM for gmod. Github addons are updated more frequently because uploading and updating a workshop addon is very painful. Some devs chose not to use the workshop, others update the workshop addon only for major updates, just because it's long and boring to do.

JimTR commented 8 years ago

I understand that however code that is new should be ignored until it is deemed to be good so adding content via the workshop should be better than git ... I suppose it could be said from your comment there is no need for steam .... perhaps the end user needs stable rather than beta ... If steam makes this pain full perhaps another method needs to be employed

UltimateByte commented 8 years ago

Haha ! Nothing is ever stable with gmod ! I'm saying that because i started playing before it was even available on steam. I can guarantee you that it won't ever be stable. The game engine doesn't even support multi thread anymore (even if settings seems to allow it) because it breaks the lua engine synchronization and makes the game unstable ! I see your point, and it's very valid... Except not for gmod. Many admins are still using github addons, as some of them have more functionalities or correct some more bugs. Gmod server admins AND players usually prefer functionalities over stability. Everyone is used to a server crashing because of a coded by feet duplicator tool... Or because a guy welded the head of a ragdoll to a high enough skymap. I'm thinking about mainly 2 addons that are Adv Dupe 2, and ACF that are only found onto github. But it could also apply to ulx/ulib, utime, and uclip, which would be very cool, as they are serious developers that update their addons only when it's really required. And it could be a step forward to adding optional and very used and useful addons to gmod that would be managed by LGSM.

JimTR commented 8 years ago

I am supprised I don't know you then ... back in they day the guys from wolverhampton used to come down to mine for the odd house party

UltimateByte commented 8 years ago

That's just because i'm french. Otherwise i'd have come.

No seriously, you're just worried about admins having buggy addons in the end ?

EstevanTH commented 8 years ago

Hi, I have a more generic idea. Addons do not always use GitHub but many of them (including the ones hosted at GitHub) support Subversion (SVN). And I guess that it must be easy to do because command-line SVN clients already exist.

UltimateByte commented 8 years ago

@EstevanTH Clever. It's true that SVN has been used forever in gmod, and slowly disappeared. It shouldn't stop us from using it if possible. It would eliminate quite a few problems of managing old files. That would probably require a new packet for the server, that hopefully will be available for any distro, and some SVN knowledge to code it that i don't have already. Any good documentation to provide ?

jaredballou commented 8 years ago

My thinking here is that an external tool might be a better idea, especially given how much extra functionality this will need to work robustly. Otherwise, we need to consider a few big issues with this:

  1. All games will now not only need game data and scripts, but also a registry of mods and addons that we support. This will quickly become prohibitive and out of date.
  2. Not everyone will have the same addons, or want to get the latest versions of all pieces. Granularity for the server admins needs to be a big concern here, so we need to fully understand how the update and use of these repos works across the games we will support.
  3. Inventory and tracking of the repos (if we don't keep a centralized list) would need to be mapped out. So, will the script use a simple manifest file, or will it just $(find -type d -name .git) the directory and use all those repos?
  4. This will require a lot of new dependencies (Git primarily) that will need to be taken care of in the setup phase. A lot of projects are still in SVN, Mercurial, or (shudder) CVS as well. Will we need to support them all?
  5. How will we handle authentication, i.e. GitHub SSH requires a key. This is a big problem I ignored in my Insurgency server sync script that does something like this, it caused me quite a headache.

My suggestion here would be to clearly state what you want, so we can define a specification for the script. That way, we know what we want to do, and then can build the tool to the desired actions, not just go in blind. Something like this:

I want to be able to create a list of Git repos with the local paths they should be installed in. I want to be able to add repos to the file and have the tool clone them. I want to be able to update and pull all repos, or just individual ones. I want to be able to push changes back upstream as well, or branch my own versions.

Once we have a clear idea exactly what you're looking to do, we can look at creating a tool. I have a simple script for my Insurgency servers that clones out a bunch of repos, rsyncs some maps, and does some other cleanup afterwards, all driven by a config manifest. I'm sure that a lot of what you're looking to do could be done with this script, I'd be happy to take a crack at helping you add the features you need to it and sharing it.

UltimateByte commented 8 years ago

@jaredballou Well, thanks for your attention.

I guess you have some misconceptions about my idea. 1) We don't affect addons in any way 2) It's for gmod only 3) User chose addons that they wanna use, we have no control over that, no need to support specific addons.

  1. What do you mean ? We can make it for gmod only. And as it didn't change for years that you put standalone addons into the addons folder , there's no obvious reason for it to change soon. Even if it had to change and that we had to remove that function, the gain of time that such a function would provide me overwhelms the time it would cost to develop it. I guess it would be problematic supporting addons for addons... I mean like addons for sourcemod, that would be extremely hard to maintain.
  2. Ofc not everyone would have the same addons. But at least if we support addons from any github, that would require the user an initial configuration, that'd be a good start. We can make 2 commands : git-download-addons and git-update-addons. That way if you only wanna download addons that you put in the list once, you download, and if you're not worried about updates, you use git-update-addons as a cronjob.
  3. No need to keep it centralized, users chose what addons they want.
  4. Not sure it needs dependencies, as LGSM is already able to download from github without any so... Are you sure ?
  5. You don't need authentication to download, especially if using the .zip. I'm usually downloading them directly to my server to add or update them. Then you extract this into your addons folder, remove any caps characters, and it's done !

Is that clear enough ?

jaredballou commented 8 years ago

So I'm not clear on how the current manual process works. Any chance you can link me to a document that shows me how it's done? I bet if I saw what you're trying to do I'd be able to pick it up. And I am usually reluctant to put new stuff in if it's just for one game, but if it's common with other games we can certainly give it a shot.

UltimateByte commented 8 years ago

I don't have a doc, but i can give you an example of how i'm doing it manually. It's actually the same process for a server than for the user. I made a video for the user, just mute the sound if you don't speak french :p https://www.youtube.com/watch?v=F6pDOAbm6-Q

Get your zip containing the addon. Ensure that you get a folder containing at least a "lua" folder. Copy that whole folder to your "addons" folder. Done.

So if for example i wanna add that https://github.com/nrlulz/ACF addon to my server, i'll get the zip link (right click on "Download ZIP" then copy url) https://github.com/nrlulz/ACF/archive/master.zip Then on the server : cd serverfiles/garrysmod/addons wget https://github.com/nrlulz/ACF/archive/master.zip tar -zxvf ACF-master.zip rm ACF-master.zip mv ACF-master acf-master //gmod for linux dosn't support uppercase Done ! Repeat that for all addons.

The idea would be that users could do that, by simply pasting github links into text document.

For example, at $serverdir, there would be a githubaddons.txt containing

Paste here addons from github you wish to install or update line by line

Then use the command ./gmodserver git-update-addons

Then user pastes links such as : https://github.com/nrlulz/ACF https://github.com/wiremod/advdupe2 https://github.com/wiremod/wire [...]

UltimateByte commented 8 years ago

Sorry i'm not uzing tar -zxvf on .zip files, but ofc unzip command !

BTW i'll start working on a standalone script supporting .zip only first here : https://github.com/UltimateByte/zip-updater

UltimateByte commented 8 years ago

My standalone function is pretty much working ! It's even working quite well, i'm already using it onto my ProBuild Gmod server, i'll make a crontab soon ! :) For now it's enough, any suggestion is very very welcome. I'm gonna wait until we can make modules for lgsm (which seems likely to happen) to think about implementing it as an optional function :)

JimTR commented 8 years ago

I still think workshop covers this ... if it's not in workshop the code is not at release standard ... you guys may want 'bleeding edge' but the users of this script may have no clue on how to add this to their server .... are you trying to over complicate ?

UltimateByte commented 8 years ago

Workshop is not a "standard" in any way. Especially for server based addons. Do you know about scriptfodder ? Sadly this script doesn't apply to it but still, it's light years away from the Workshop. You most likely know ULX, the most famous admin plugin for gmod. Is this and its dependency Ulib on gmod workshop ? No. Such as utime, Uclip, ACF and extentions, advdupe2 and other wiremod extentions... I use all of that on several servers, and it's a damn pain to keep updated. So i don't think i overcomplicate, it's event the opposite, i give a way to make boring tasks automatic with a bit of configuration instead of a lot of scripting. A guy i host a server for just told me "Finally ! It finally exists ! I won't be so bored doing this anymore", and that's exactly for that same thought that i made this script ! If it's useful to us, it most likely is for others.

jaredballou commented 8 years ago

Let me take a crack at this tonight, I have some free time and might be able to draft up at least some pseudocode to make sure I have it.

jaredballou commented 8 years ago

Damn, wish I'd seen you already built this. Mine is fancy in a different way, mine takes an array of GitHub user,repo,branch,method and allows native Git cloning, Tarball downloads, or Zip downloads. For archives, it keeps tabs on what update it's on by querying the GitHub downloader for headers and divining the filename. The archive is then unpacked into the directory named the same thing as the archive, and the short name of the mod is symlinked. This obviously isn't production ready as it has multiple copies of the same mod, but it was more about me getting the logic working. For native Git, it uses the GitHub API and finds the latest commit, then makes sure the repo exists locally and is configured/updated properly, Let me know what you think, feel free to steal it and do whatever you want with it, I really don't have time to maintain it. I just wanted to poke at it a bit. https://github.com/jaredballou/linuxgsm/blob/master/GarrysMod/addons.sh

UltimateByte commented 8 years ago

That rocks mate ! I had no idea how to use GitHub API, so i did it with rough zipfiles. Both can be complementary BTW, that's something to develop ! ^^

UltimateByte commented 8 years ago

Will be able to do it through this : https://github.com/GameServerManagers/LinuxGSM/issues/631

./gameserver install-mods
CU | Custom Mods List

First time launching :

"No custom mod list, generating config file"
"Config file created in /home/user/lgsm/custom_mods.cfg"
cat custom_mods.cfg
# Add mods using this syntax : 
(Remains to define)
UltimateByte commented 8 years ago

Obsoleted by https://github.com/GameServerManagers/LinuxGSM/issues/631

lock[bot] commented 6 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.