Lodestone-Team / lodestone

A free, open source server hosting tool for Minecraft and other multiplayer games
https://www.lodestone.cc/
GNU Affero General Public License v3.0
845 stars 31 forks source link

Docker Compose Doesn't Work #400

Open eusousu opened 4 months ago

eusousu commented 4 months ago

I setup a simple compose script, I aim to expand it to automate a certbot docker to update the lodestone certs. Sadly, trying to start the lodestone service via docker composer always return a rust error

lodestone-1  | The application panicked (crashed).
lodestone-1  | Message:  called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
lodestone-1  | Location: core/src/prelude.rs:70
lodestone-1  |
lodestone-1  | Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
lodestone-1  | Run with RUST_BACKTRACE=full to include source snippets.
lodestone-1 exited with code 0

I am able to setup a container normally but not via compose for some reason.

Please inform me if I can provide any more help. Thnaks for the awesome work!

Steps to reproduce

Create a file named docker-compose.yml with the following content:

services:
  lodestone:
    image: ghcr.io/lodestone-team/lodestone_core
    ports:
      - "16662:16662"
      - "25565:25565"
    restart: unless-stopped
    volumes:
      - ./lodestone_path:/home/user/.lodestone

Run docker compose up you will get the error.

Ynng commented 4 months ago

try to create the ./lodestone_path folder first and make sure it doesn't have dubious permissions before running the docker container

eusousu commented 4 months ago

oh! it really worked. That's strange running without creating the folder beforehand would create a folder with this permissions: drwxr-xr-x 2 root root 4096 lodestone_path while creating it myself: drwxr-xr-x 2 su su 4096 lodestone_path so the only difference is user and group

Sadly, this means a docker compose cant't roll as a standalone as user needs to create a folder beforehand. Could this behavior be changed somehow?

Also, I found a workaround but it is even stranger. I saw stack saying you can change the user docker compose create the files for but I didn't read it in full and went to test. I set the user: "${UID}:${GID}" to the lodestone service but forgot to set the .env file so my docker complained:

WARN[0000] The "UID" variable is not set. Defaulting to a blank string.
WARN[0000] The "GID" variable is not set. Defaulting to a blank string.

but now the lodestone service worked normally (!???) I double checked the folder was not created beforehand redoing the steps twice. Also the folder created has the same permissions that would make it crash before: drwxr-xr-x 2 root root 4096 Jul 11 19:19 lodestone_path I do not understand this fully but maybe it's of some interest to you. Would doing this harm my security somehow?

well, thank you! and in the case I achive my goal do you have a forum where I could post the script so other users can use it?

as always thank you for the awesome work!