Closed tadi1 closed 8 months ago
I am also encountering this error after following the setup from this guide: https://benprice.dev/posts/fvtt-docker-tutorial/
So I created a locally modified image to poke around with this. I wanted to monitor the contents of /opt/foundryvtt while potentially making other changes and for some reason the container started working once I applied the new image. Before this unexpectedly started to work, I was hoping to modify run-server.sh to unzip the file, setting the owner on newly created folders to the current user, fvtt (I'm not currently sure why this wasn't already the case - the resources folder was owned by root).
#!/bin/sh
# look for a file name foundryvtt-.....zip or FoundryVTT...zip, copy it to
# /opt/foundryvtt, unzip and remove it. Then start the foundry app
whoami
cd /opt/foundryvtt
find /host -type f -name [f,F]oundry[vtt,VTT]*.zip -exec cp '{}' . ';'
ls -al /opt/foundryvtt
unzip -o *.zip && rm *.zip
node resources/app/main.js --dataPath=/data/foundryvtt
FROM node:16-alpine
RUN deluser node && \
mkdir /opt/foundryvtt && \
mkdir /data && \
mkdir /data/foundryvtt && \
adduser --disabled-password fvtt && \
chown fvtt:fvtt /opt/foundryvtt && \
chown fvtt:fvtt /data/foundryvtt && \
chmod g+s /opt/foundryvtt && \
chmod g+s /data/foundryvtt
USER fvtt
COPY --chown=fvtt run-server.sh /opt/foundryvtt
RUN chmod +x /opt/foundryvtt/run-server.sh
VOLUME /data/foundryvtt
VOLUME /host
VOLUME /opt/foundryvtt/app
VOLUME /opt/foundryvtt
EXPOSE 30000
ENTRYPOINT /opt/foundryvtt/run-server.sh
So I created a locally modified image to poke around with this. I wanted to monitor the contents of /opt/foundryvtt while potentially making other changes and for some reason the container started working once I applied the new image. Before this unexpectedly started to work, I was hoping to modify run-server.sh to unzip the file, setting the owner on newly created folders to the current user, fvtt (I'm not currently sure why this wasn't already the case - the resources folder was owned by root).
#!/bin/sh # look for a file name foundryvtt-.....zip or FoundryVTT...zip, copy it to # /opt/foundryvtt, unzip and remove it. Then start the foundry app whoami cd /opt/foundryvtt find /host -type f -name [f,F]oundry[vtt,VTT]*.zip -exec cp '{}' . ';' ls -al /opt/foundryvtt unzip -o *.zip && rm *.zip node resources/app/main.js --dataPath=/data/foundryvtt
FROM node:16-alpine RUN deluser node && \ mkdir /opt/foundryvtt && \ mkdir /data && \ mkdir /data/foundryvtt && \ adduser --disabled-password fvtt && \ chown fvtt:fvtt /opt/foundryvtt && \ chown fvtt:fvtt /data/foundryvtt && \ chmod g+s /opt/foundryvtt && \ chmod g+s /data/foundryvtt USER fvtt COPY --chown=fvtt run-server.sh /opt/foundryvtt RUN chmod +x /opt/foundryvtt/run-server.sh VOLUME /data/foundryvtt VOLUME /host VOLUME /opt/foundryvtt/app VOLUME /opt/foundryvtt EXPOSE 30000 ENTRYPOINT /opt/foundryvtt/run-server.sh
Hi :D.
Im a complete docker noob and i just used this image because a guide told me to. Can you maybe tell me where you made those changes ? I would love to get my foundry back up and working again.
I am also having the same issue, any help would be greatly appreciated.
I found a workaround for the Portainer + Traefik tutorial: you need to add a third volume, with /opt/foundryvtt/resources/app as the path in container and something like /home/username/foundryapp for the host. The Readme on github claims it's only necessary for custom login screens, but if you add the volume in Portainer (or in the compose, I assume) it works perfectly.
I found a workaround for the Portainer + Traefik tutorial: you need to add a third volume, with /opt/foundryvtt/resources/app as the path in container and something like /home/username/foundryapp for the host. The Readme on github claims it's only necessary for custom login screens, but if you add the volume in Portainer (or in the compose, I assume) it works perfectly.
Hmm. Tried to do this via the fvtt container but it did not function for me. Need to be added in the portainer docker-compose.yaml file?
Yeah, I'm not sure what is going on. I'm not well versed in docker. Getting these errors from the Portainer fvtt container log:
inflating: resources.pak creating: resources/app/client/ unzip: can't create directory 'resources/app/client/': Permission denied node:internal/modules/cjs/loader:936
throw err; ^ Error: Cannot find module '/opt/foundryvtt/resources/app/main.js' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: []
I found a workaround for the Portainer + Traefik tutorial: you need to add a third volume, with /opt/foundryvtt/resources/app as the path in container and something like /home/username/foundryapp for the host. The Readme on github claims it's only necessary for custom login screens, but if you add the volume in Portainer (or in the compose, I assume) it works perfectly.
Hmm. Tried to do this via the fvtt container but it did not function for me. Need to be added in the portainer docker-compose.yaml file?
No, I just used the GUI from Portainer. You basically need to create a folder such as /home/USERNAME/foundryapp (the name of the folder isn't important, but you need to make it beforehand and make it with your user, not root, otherwise Docker won't have the permissions to write in it), and /opt/foundryvtt/resources/app as the path in container. That worked for me. I was getting the same errors as you are beforehand, so that should work.
I found a workaround for the Portainer + Traefik tutorial: you need to add a third volume, with /opt/foundryvtt/resources/app as the path in container and something like /home/username/foundryapp for the host. The Readme on github claims it's only necessary for custom login screens, but if you add the volume in Portainer (or in the compose, I assume) it works perfectly.
Hmm. Tried to do this via the fvtt container but it did not function for me. Need to be added in the portainer docker-compose.yaml file?
No, I just used the GUI from Portainer. You basically need to create a folder such as /home/USERNAME/foundryapp (the name of the folder isn't important, but you need to make it beforehand and make it with your user, not root, otherwise Docker won't have the permissions to write in it), and /opt/foundryvtt/resources/app as the path in container. That worked for me. I was getting the same errors as you are beforehand, so that should work.
Edit: started with fresh container and this worked. Thanks so much for the help!
I found a workaround for the Portainer + Traefik tutorial: you need to add a third volume, with /opt/foundryvtt/resources/app as the path in container and something like /home/username/foundryapp for the host. The Readme on github claims it's only necessary for custom login screens, but if you add the volume in Portainer (or in the compose, I assume) it works perfectly.
Hmm. Tried to do this via the fvtt container but it did not function for me. Need to be added in the portainer docker-compose.yaml file?
No, I just used the GUI from Portainer. You basically need to create a folder such as /home/USERNAME/foundryapp (the name of the folder isn't important, but you need to make it beforehand and make it with your user, not root, otherwise Docker won't have the permissions to write in it), and /opt/foundryvtt/resources/app as the path in container. That worked for me. I was getting the same errors as you are beforehand, so that should work.
I am having the exact same issues but this doesn't seem to be working for me. Just to be sure I have all this right:
Anything I missed or did wrong? I am still getting the error about not being able to find the module "/opt/foundryvtt/resources/app/main.js" and either a 404 or a Bad Gateway error.
I checked the foundryapp directory via FTP and nothing seems to be written there. I even changed permissions to allow public users to write to it but it still doesn't seem to work. I am sure I have missed something stupid and simple but I can't see what.
@AlexG2490 Changing the permissions to all three directories bound to the container did the trick for me. I used chmod 777 for testing purposes, but didn't have time to find a more restrictive setup which still allows the container to do its thing.
Spent some time staring at this for a while.
Seems like there's a discrepancy with the USER 'fvtt' chmod access in the Dockerfile that prevents the created user 'fvtt' from unzipping due to being unable to write to the directory linked with docker at home/$USER/foundryapp:/opt/foundryvtt/resources/app.
FROM node:16-alpine
RUN deluser node && \
mkdir /opt/foundryvtt && \
mkdir /data && \
mkdir /data/foundryvtt && \
adduser --disabled-password fvtt && \
### chown fvtt:fvtt /opt/foundryvtt && \
### chown fvtt:fvtt /data/foundryvtt && \
### chmod g+s /opt/foundryvtt && \
### chmod g+s /data/foundryvtt
USER fvtt
COPY --chown=fvtt run-server.sh /opt/foundryvtt
RUN chmod +x /opt/foundryvtt/run-server.sh
VOLUME /data/foundryvtt
VOLUME /host
### VOLUME /opt/foundryvtt/resources/app
EXPOSE 30000
ENTRYPOINT /opt/foundryvtt/run-server.sh
I've denoted my suspected lines with three # above.
I think this can be remedied by adding a chmod g+s command for the new volume so the directory can be referenced properly by 'fvtt' user, or if it's not breaking anything, remove the third volume entirely.
Not sure if this helps. I may try to get a fix if it's needed for a PR, but by all means someone post a fix if you have it. I don't have anything set up to test yet.
I've just had this exact same issue. I managed to fix it by changing the ownership of the created files to the user, instead of the root. A more permanent solution is probably modifying the sh file like @rdonohue recommended.
I've just had this exact same issue. I managed to fix it by changing the ownership of the created files to the user, instead of the root. A more permanent solution is probably modifying the sh file like @rdonohue recommended.
Can you please tell me how you changed the ownership ? Im a total noob when it comes to this whole topic. I solved this issue here by just using an old image and just waiting for a fixed version. But i kinda wan't to know how to change file and folder ownership anyways. I tried learning it on my own but im just confused.
I've just had this exact same issue. I managed to fix it by changing the ownership of the created files to the user, instead of the root. A more permanent solution is probably modifying the sh file like @rdonohue recommended.
Can you please tell me how you changed the ownership ? Im a total noob when it comes to this whole topic. I solved this issue here by just using an old image and just waiting for a fixed version. But i kinda wan't to know how to change file and folder ownership anyways. I tried learning it on my own but im just confused.
even more noob question: how do i use an old image?
I've just had this exact same issue. I managed to fix it by changing the ownership of the created files to the user, instead of the root. A more permanent solution is probably modifying the sh file like @rdonohue recommended.
Can you please tell me how you changed the ownership ? Im a total noob when it comes to this whole topic. I solved this issue here by just using an old image and just waiting for a fixed version. But i kinda wan't to know how to change file and folder ownership anyways. I tried learning it on my own but im just confused.
even more noob question: how do i use an old image?
I was kinda hoping that someone would answer your question. I simply restored everything to a backup of the server where the old image was still in use.
Can you please tell me how you changed the ownership ? Im a total noob when it comes to this whole topic.
To recursively set ownership in Linux use the following command:
chown [USER]:[GROUP] [directory containing your foundry data] -R
For instance, as a user called tango, I used docker compose with following bindings:
/home/tango/foundry/data:/data/foundryvtt /home/tango/foundry/core:/opt/foundryvtt/resources/app
After executing compose, the data got placed on the host system in directories left side of the colons, but their owner is the user root and group root. This introduces the need to use elevated permissions, so we need to prefix the command with sudo. To take ownership of those directories I would need to execute the following:
sudo chown tango:tango /home/tango/foundry/* -R
Had the same issue. Using the chmod 777 -R
command on the foundry directory fixed it. Definitely a permission issue.
Still having the same issue even after doing everything here. Any other ideas?
Still having the same issue even after doing everything here. Any other ideas?
I'm sorry, I kinda gave up with the whole project and I'm now using Caddy as a reverse Proxy. I've decided that this setup might be a bit overkill for what I was trying to accomplish so I switched to something more lightweight.
Hello,
I'm currently having trouble getting the container to start up since pulling the latest image. Previously, I was on a version of the image from 2022-01-26 (image does not have a tag) without issue, but since updating the image and the yml file to the new specs, I've been unable to get the container to start. I've even tried running a new version of the container. The below details are all from the new container.
I originally configured this container using the guidance of https://github.com/marcwagner/foundry_swag_docker but have since modified the docker-compose.yml to match the changes made to the image about 10 days ago.
Relevant portion of the docker-compose.yml (really the stack config in portainer):
Log snippet - this repeats continuously. The container is unable to extract to /opt/foundryvtt/resources/app/common/ but from what I've been able to decipher from run-server.sh, it should be able to
Any help that you're able to provide is appreciated.