Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to keep server saves/config? #161

Open
InfernoZeus opened this issue Feb 21, 2021 · 3 comments
Open

How to keep server saves/config? #161

InfernoZeus opened this issue Feb 21, 2021 · 3 comments

Comments

@InfernoZeus
Copy link

I've been trying to use the example docker-compose files that you've got in this repository, but it's not clear to me how this preserves the save files and configuration for the game? (I'm trying to run Valheim, but I don't think it's a game specific question.) The only volume seems to be one for Log files, although even that wasn't working (I had to change from logs to log).

Are there some other paths/volumes I could create so that they outlive the lifetime of the container created by docker-compose?

@joshhsoj1902
Copy link
Owner

@InfernoZeus I apologize that that isn't something that's more cleat in the compose files.

I'm actually working on updating all the examples so that they do save things by default.

#160

The updated compose file will look something like this:

version: '3.1'
services:
  valheim:
    image: joshhsoj1902/linuxgsm-docker:latest
    ports:
      - 2456:2456/tcp
      - 2456:2456/udp
    environment:
      - LGSM_GAMESERVERNAME=vhserver
      - LGSM_SERVERNAME="My Game Name"
      - LGSM_UPDATEINSTALLSKIP=UPDATE
      - LGSM_PORT=2456
      # World Name
      - LGSM_GAMEWORLD
      # Private=0 Public=1
      - LGSM_PUBLIC=1

    # https://docs.docker.com/compose/compose-file/compose-file-v3/#volumes
    volumes:
      - serverfiles:/home/linuxgsm/linuxgsm/serverfiles

But that only half solves your problem, It will save all the serverfiles (and in theory the save files) into a docker volume called valheim_serverfiles. The data will survive across restarts, but the data is still hard to access if you needed wanted to access the save files directly.

Another option is to mount a local folder and have the server files written there. There is some details here on the different ways volumes can be mounted https://docs.docker.com/compose/compose-file/compose-file-v3/#volumes, But the simple suggestion is try something like this:

    volumes:
      - /local/path/where/you/want/to/save:/home/linuxgsm/linuxgsm/serverfiles

Years ago doing a local mount like that could cause some file permission issues if you were using docker on windows, I don't know if that's still the case.

@joshhsoj1902
Copy link
Owner

@InfernoZeus
Copy link
Author

@joshhsoj1902 Really appreciate the quick help on this. No need to apologise!

I'm aware of how Docker works, and the distinction between named volumes and local folders, but I just couldn't work out which path inside the container I should be targeting. I'll give your new version a go 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants