callofduty4x / CoD4x_Server

Extended Call of Duty 4 server
https://cod4x.ovh
GNU Affero General Public License v3.0
325 stars 121 forks source link

[Request] Ability to mount gamefiles from different path #322

Closed grimsi closed 3 years ago

grimsi commented 3 years ago

Currently the game files have to be copied into the server directory. I am working on creating a Pterodactyl egg for CoD 4X (which basically allows a fully automated installation of the server in the end). The only requirement I have is that the user has to supply the game files in the form of a mount. Due to the design of the installation and deployment process in Pterodactyl the mounts are only available after the server has been started which means that the game files cannot be copied in the installation process. A solution to this would be if the game files could be mounted from an external directory outside of the server folder. I saw that there are some more or less documented parameters that seem to have a connection to this. The only mention I have seen was this issue: https://github.com/callofduty4x/CoD4x_Server/issues/64 Does this mean that it's already possible to mount an external folder?

If you need help developing this feature I can support you.

D4edalus commented 3 years ago

afaik pterodactyl uses docker containers to isolate applications. even if there was a away to supply a path with game data to the cod4x server, the cod4x server is still running in an isolated container having no access to data outside which means it can only access data that's either mounted (from host to container) or copied. therefore i don't really understand what you're asking for.

while i don't fully understand your actual issue, i feel like it should be solvable with symlinks. if not, please elaborate why.

D4edalus commented 3 years ago

I saw that there are some more or less documented parameters that seem to have a connection to this. The only mention I have seen was this issue: #64

take a look at this, maybe makes symlinking obsolete https://github.com/callofduty4x/CoD4x_Server/blob/master/scriptdocumentation/MULTIPLE_SERVERS_TUTORIAL.md

grimsi commented 3 years ago

You can create mounts in Pterodactyl so the game files will be mounted in the containers. However the mount is active for all game servers on a node. I already considered symlinks but I think that they cannot be used to solve my problem since they all would link to the same files on the host. Since the server writes into the /main and /zone folder I can't share it between multiple instances. So my idea was to tell the server that the gamefiles are mounted inside the container in read-only under "/mnt/cod4_vanilla_files" for example so the server can read them from there and write all the custom files in "{server_path}/main".

What I want to achieve is basically having the vanilla game files mounted as read-only so I can share them between multiple instances without them overwriting each others changes. And having all the custom CoD4X files in the server folder which is not shared between instances.

I already read the multiple servers tutorial but as far as I can see the server binary is shared in this case. It's almost what I need, but I want everything specific to CoD4X in one folder (inside of the container, not shared) and everything related to vanilla CoD 4 in a shared mount.

I hope that this all makes sense and I didn't overlook something

grimsi commented 3 years ago

Thinking about it, maybe it can work with symlink (since the vanilla files are not updated afaik) but I would have to symlink every file seperately into the /main and /zone folder. Cumbersome but I will try it.

D4edalus commented 3 years ago

I already read the multiple servers tutorial but as far as I can see the server binary is shared in this case.

you can use a separate executable for each server, it doesnt have to be shared. try something like ./cod4x18_dedrun +set fs_basepath /path/to/mount +set fs_homepath .

Thinking about it, maybe it can work with symlink (since the vanilla files are not updated afaik) but I would have to symlink every file seperately into the /main and /zone folder. Cumbersome but I will try it.

it's not pretty, but should do the job

grimsi commented 3 years ago

Sorry for responding so late, the cod4x.me domain was down for a day and I couldn't test my scripts.

you can use a separate executable for each server, it doesnt have to be shared. try something like ./cod4x18_dedrun +set fs_basepath /path/to/mount +set fs_homepath .

That did the trick! Thanks a lot, works like a charm now!

D4edalus commented 3 years ago

Sorry for responding so late, the cod4x.me domain was down for a day and I couldn't test my scripts.

you can use a separate executable for each server, it doesnt have to be shared. try something like ./cod4x18_dedrun +set fs_basepath /path/to/mount +set fs_homepath .

That did the trick! Thanks a lot, works like a charm now!

awesome, i'm glad you could solve it! is your code avaliable somewhere or will it be available?

grimsi commented 3 years ago

I am still working on optimizing the docker image, but the code will be available on GitHub. Either in the official egg repository or in my own. If you want I can give you a preview version