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.94k stars 272 forks source link

Server is running but client fails to connect #478

Closed dfibuch closed 2 years ago

dfibuch commented 2 years ago

I am using Azure Container Instances to host the docker image and am using the docker compose file, which I've modified to make it work with Azure File Share. It looks like it is all working as I am seeing the "Game server connected" message in the logs but then it seems to shut itself down and start again.

image

The Restart Count on my ACI is 0 so its not the instance that's resetting. If I try to connect I just get a "Failed to connect" message.

Here is my docker compose yaml:

version: "3"
services: 
  valheim: 
    image: ghcr.io/lloesche/valheim-server
    cap_add:
      - sys_nice
    volumes: 
      - configfiles:/config
      - datafiles:/opt/valheim
    ports:
      - "2456:2456/udp"
      - "2457:2457/udp"
      - "2458:2458/udp"
      - "80:80"
    env_file:
      - ./valheim.env  
    restart: always
    stop_grace_period: 2m
volumes:
  configfiles:
    driver: azure_file
    driver_opts:
      share_name: server-files
      storage_account_name: valheimskhcmtsa
  datafiles:
    driver: azure_file
    driver_opts:
      share_name: server-files
      storage_account_name: valheimskhcmtsa      

And my valheim.env

SERVER_NAME=Test
WORLD_NAME=Dedicated
SERVER_PASS=mypassword
SERVER_PUBLIC=true
SERVER_PORT=2456
STATUS_HTTP=true
dfibuch commented 2 years ago

Looks like I solved it, I believe the problem was not enough power. I saw someone else talk about setting the cpu/memory in their script and thought I'd try it and looks like that fixed it. My new docker compose file looks like this now

version: "3.7"
services: 
  valheim: 
    image: ghcr.io/lloesche/valheim-server
    cap_add:
      - sys_nice
    volumes: 
      - configfiles:/config
      - datafiles:/opt/valheim
    ports:
      - "2456:2456/udp"
      - "2457:2457/udp"
      - "2458:2458/udp"
      - "80:80"
    env_file:
      - ./valheim.env  
    restart: always
    stop_grace_period: 2m
    deploy:
        resources:
            limits:
                cpus: "2"
                memory: 4gb
            reservations:
                cpus: "2"
                memory: 4gb                
volumes:
  configfiles:
    driver: azure_file
    driver_opts:
      share_name: server-files
      storage_account_name: valheimskhcmtsa
  datafiles:
    driver: azure_file
    driver_opts:
      share_name: server-files
      storage_account_name: valheimskhcmtsa