foundryvtt-docker icon indicating copy to clipboard operation
foundryvtt-docker copied to clipboard

Include support for setting the Docker container's hostname via an environment variable

Open ddrinka opened this issue 3 years ago • 1 comments

🚀 Feature Proposal

Rather than only supporting providing a custom hostname via docker-compose or the docker command line, support should also be included to set the hostname from an environment variable.

Motivation

I'm running foundryvtt-docker on Fargate at AWS. Supplying a hostname via a task definition is not supported there. The Fargate task is set to automatically start and terminate and so new containers are being launched regularly. This leads to the issue others have noted that the EULA must be clicked through every time.

Pitch

It is understandable that you do not wish to circumvent the EULA signature process (though many projects support an explicit command line argument that accomplishes the same "click-through license"). That said, you are already documenting the workaround for the host ID check Foundry is performing, i.e. setting a static hostname in the docker-compose file. Would it not be appropriate to include support for setting the container's hostname as a first-class citizen of the configuration?

ddrinka avatar Aug 05 '22 04:08 ddrinka

After some tinkering, it appears doing what I proposed is a non-trivial task. Setting a new hostname in Alpine requires the SYS_ADMIN capability which Fargate does not grant. Setting /etc/hostname does not impact the return value of uname -n which is what os.hostname() -> gethostname() uses to retrieve the current hostname.

The solution is to attach between Node.js and glibc using LD_PRELOAD, as this project does: https://github.com/joeblackwaslike/overridehostname

However I don't anticipate a high level of comfort either distributing a binary blob of that library or building it from source within your existing build process for this niche use case.

If I'm wrong and you'd accept a PR for this path let me know. Otherwise feel free to close this card.

ddrinka avatar Aug 05 '22 05:08 ddrinka