lloesche / valheim-server-docker

Valheim dedicated gameserver with automatic update, World backup, BepInEx and ValheimPlus mod support
https://hub.docker.com/r/lloesche/valheim-server
Apache License 2.0
1.92k stars 269 forks source link

trouble importing world #554

Closed jbkroner closed 1 year ago

jbkroner commented 1 year ago

Hey all, need some help troubleshooting. Bit of a docker newbie here. Relevant info upfront, specific questions at the bottom.

I'm trying to import an existing world. V+ enabled, after world creation, not sure if that matters.

I copied in my existing world file:

user@server:~$ ls $HOME/valheim-server/config/worlds_local/
codysworld.db  codysworld.db.old  codysworld.fwl  codysworld.fwl.old

also created a data folder, it's empty

user@server:~$ ls $HOME/valheim-server/data/
user@server:~$

The bash script that launches the container looks like this:

docker run -d \
    --name "valheim-server" \
    --cap-add=sys_nice \
    --stop-timeout 120 \
    -p 2456-2457:2456-2457/udp \
    -v $HOME/valheim-server/config:/config \
    -v $HOME/valheim-server/data:/opt/valheim \
    -e SERVER_NAME="scrubbed" \
    -e WORLD_NAME="codysworld" \
    -e SERVER_PASS="scrubbed" \
    -e VALHEIM_PLUS="true" \
    ghcr.io/lloesche/valheim-server

The first time I launched the server it didn't seem to pick up my world file:

an  4 04:14:01 supervisord: valheim-server 01/04/2023 04:14:01: Get create world codysworld
Jan  4 04:14:01 supervisord: valheim-server 01/04/2023 04:14:01:   failed to load codysworld

Connecting to the server yielded a fresh world as expected.

I stopped and rmd the container and launched it again. This time it picked up on the world it created in the previous run and still did not pick up the world file I imported.

 Jan  4 05:01:12 supervisord: valheim-backup   adding: config/worlds_local/ (stored 0%)
Jan  4 05:01:12 supervisord: valheim-backup   adding: config/worlds_local/codysworld.db.old
Jan  4 05:01:12 supervisord: valheim-backup  (deflated 65%)
Jan  4 05:01:12 supervisord: valheim-backup   adding: config/worlds_local/codysworld.fwl (deflated 4%)
Jan  4 05:01:12 supervisord: valheim-backup   adding: config/worlds_local/codysworld.db

I also don't see directories I expect to see under ~/valheim-server/config like valheimplus. Is the documentation referring to the host ../config/? or within the container?

My questions:

jbkroner commented 1 year ago

I got it sorted. I think that two things were happening:

It was loading the correct world, I assumed it was not. I think I put a bad or old file in there which is why it seemed new. I re-added that world to the host. In fact, I just copied in the entire /config/ folder from the backup to make sure I wasn't missing anything.

I also updated the path inside my launch script. Not sure if that made a difference, echoing $HOME yields the correct path. Looks like this now:

docker run -d \
    --name "valheim-server" \
    --cap-add=sys_nice \
    --stop-timeout 120 \
    -p 2456-2457:2456-2457/udp \
    -v /home/username/valheim-server/config:/config \
    -v /home/username/valheim-server/data:/opt/valheim \
    -e SERVER_NAME="scrubbed" \
    -e WORLD_NAME="codysworld" \
    -e SERVER_PASS="scrubbed" \
    -e VALHEIM_PLUS="true" \
    lloesche/valheim-server

This resolves my issue, feel free to ping me for follow up or clarifying details.