![ServerSync](https://media.forgecdn.net/avatars/thumbnails/254/696/256/256/637199290945083080.png)
Help with serversync-server.json rules
vico93 opened this issue ยท 6 comments
Serversync Version: v4.0.0
Minecraft Version: 1.12.2 (Forge 14.23.5.2855)
Issue:
I'm trying to (re)learn how the new serversync works, previously i was using a GIT repository to sync my modpack, and this .gitignore to filter out all files exclusive to both dedicated server and client. From what i've understand i needed to transfer my ignore list (with minor syntax changes) to rules\files
section of serversync-server.json
to filter out the files i didnt want to transfer from server to client AND to keep out in clients if already there. Then i tested setting up a server with all mods, configs and such (FYI Mohist - a Forge/Bukkit hybrid for 1.12) and making a copy of my profile (client) folder and running the server and the client to make a test sync. But the "sync" proved out it only deleted all files on the client except serversync jar/exe, logs and and its config, keeping only empty mod folders and the files at the root of the folder.
Logs (serverysync & minecraft)
Gist with all logs (both client & server AND the rules JSON)
I'll look into writing an upgrader for the old format -> new.
It should just be a case of copy pasting the rules you have in file_ignore_list
into the files: { ignore: [] }
array, there might be some minor tweaking required to suit the JSON format (quotes and commas).
There is an additional step required currently when setting up a directory, if you want to sync mods
then you will need this setup:
serversync-server.json
{
"directories": [
{ "path": "mods", "mode": "mirror" } <-- this is just setting up how the directory is managed at the moment
],
"files": {
"include" ["mods/**"], <-- this is what determines the files that are included in the sync process
"ignore": []
}
}
I am not really happy with the disconnect between setting up directory management and file inclusion, it needs some work to make it more user friendly.
Note in the above config the directory entry is telling the client that the mods
folder is set to be managed by the server and the mirror
mode means that the directory should mirror the server i.e. remove files that don't exist server-side.
There is also a push
mode where the server will only send/update files, however, this would very easily leave the client in a state where it can not connect due to conflicting mods so use at your own risk I guess ๐.
If we assume a scenario where the server wants to send the contents of the mods
folder and the client wants to use OptifineHD(someversion)
, then the configuration would be as follows.
serversync-server.json
{
"rules": {
"directories": [
{
"path": "mods",
"mode": "mirror"
}
],
"files": {
"include": [
"mods/**"
],
"ignore": [
"mods/some-server-specific-mod.jar"
],
}
},
}
serversync-client.json
(note this is the client that would configure this not the server host, you could send clients a pre-configured client json though if desired)
{
"rules": {
"files": {
"ignore": [
"mods/Optifine*"
]
}
},
}
If you would like to send client specific (optional) mods there are two ways to do so.
Recommended
Use the clientmods
feature:
- create a folder next to
serversync.jar
calledclientmods
- put the client side only mods in the
clientmods
folder - set
push_client_mods: true
inserversync-server.json
This will put the power in the client's hands to refuse these mod suggestions if they don't want them (e.g. they want to use their own version or a different client mod like a different minimap mod e.t.c.)
Not recommended
Use a file redirect to put files from a custom directory into the mods folder.
{
"rules": {
"files": {
"include": [
"my-cool-client-stuff/**"
],
"redirect": [
{
"pattern": "my-cool-client-stuff/**",
"redirectTo": "mods"
}
]
}
},
}
From the client's perspective, this acts like any other file in the mods
folder, if they wanted to refuse it they would have to write an ignore pattern that matches it.
I do a similar thing of the clientmods
folder you mentioned. Only difference my client-only folder is called mods_client
instead. I just sync that and let the client to symlink the folder to mods\1.12.2
(i also let serversync ignore this path to prefent conflict).
I think my error was not adding the correspondent entry on files/include
key. Will test now.
Closing this in favor of some docs thrown together here:
https://github.com/superzanti/ServerSync/wiki/Server-setup