Git Product home page Git Product logo

project-zomboid's Introduction

⚠️

Sorry, I have no more time to maintain this project and I no longer play ProjectZomboid to properly follow its progress. Feel free to fork this project and continue this work on your side.

Project Zomboid server - Docker image

Docker version of the Project Zomboid steam server.

How to use this image

Before starting

Create two directories where you want to run your server :

  • server-data: mandatory if you want to keep configuration between each restart
  • server-files: optional, contains all the files of the application

If you have any errors with the permissions of these two directories, you can adjust it. It could be done with this commands:

chown 1000:1000 server-data
chown 1000:1000 server-files

1000:1000 represent the user and the group of the LinuxGSM_ user that run server in the image.

Bridge networking

Docker command

docker run -d --name project-zomboid \
              -e SERVER_NAME="pzserver" \
              -e ADMIN_PASSWORD="pzserver-password" \
              -v $(pwd)/server-data:/server-data \
              -p 8766:8766/udp \
              -p 8767:8767/udp \
              -p 16261:16261/udp \
              -p 16262-16272:16262-16272 \
              -p 27015:27015 \
              ghcr.io/cyrale/project-zomboid

Docker Compose

Alternatively, you could use Docker Compose with this docker-compose.yml file:

version: "3.7"

services:
  project-zomboid:
    image: ghcr.io/cyrale/project-zomboid
    restart: unless-stopped
    environment:
      SERVER_NAME: "pzserver"
      ADMIN_PASSWORD: "pzserver-password"
    ports:
      - "8766:8766/udp"
      - "8767:8767/udp"
      - "16261:16261/udp"
      - "16262-16272:16262-16272"
      - "27015:27015"
    volumes:
      - ./server-data:/server-data

After creating this file, launch the server with docker-compose up.

Host networking

Docker command

docker run -d --name project-zomboid \
              --network=host \
              -e SERVER_NAME="pzserver" \
              -e ADMIN_PASSWORD="pzserver-password" \
              -v $(pwd)/server-data:/server-data \
              ghcr.io/cyrale/project-zomboid

Docker Compose

Alternatively, you could use Docker Compose with this docker-compose.yml file:

version: "3.7"

services:
  project-zomboid:
    image: ghcr.io/cyrale/project-zomboid
    restart: unless-stopped
    environment:
      SERVER_NAME: "pzserver"
      ADMIN_PASSWORD: "pzserver-password"
    network_mode: host
    volumes:
      - ./server-data:/server-data

After creating this file, launch the server with docker-compose up.

Specifying IP address

In this network mode, you could specify the IP address of the host instead of letting the program do it automatically.

In the command line, add the parameter -e LGSM_SERVER_CONFIG='ip="xx.xx.xx.xx"'.

In the docker compose file, add this environment variable:

LGSM_SERVER_CONFIG: |
  ip="xx.xx.xx.xx"

After starting

Once you have run the docker for the first time, you can edit your config file in your mapped directory /server-data/Server/$SERVER_NAME.ini. When it's done, restart your server.

Some of options are not used in these two examples. Look below if you want to adjust your settings.

Variables

Some variables are inherited from cyrale/linuxgsm.

  • STEAM_PORT_1 Steam port 1 (default: 8766)
  • STEAM_PORT_2 Steam port 2 (default: 8767)
  • RCON_PORT RCON port (default: 27015)
  • RCON_PASSWORD RCON password
  • SERVER_NAME Name of your server (for db & ini file). Warning: don't use special characters or spaces.
  • SERVER_PASSWORD Password of your server used to connect to it
  • SERVER_PUBLIC_NAME Public name of your server
  • SERVER_PUBLIC_DESC Public description of your server
  • SERVER_BRANCH Name of the beta branch
  • SERVER_BETA_PASSWORD Password for the beta branch
  • ADMIN_PASSWORD Admin password on your server
  • SERVER_PORT Game server port
  • PLAYER_PORTS Game ports to allow player to contact the server (by default : 16262-16272 to allow 10 players)

STEAM_PORT_1, STEAM_PORT_2, RCON_PORT, RCON_PASSWORD, SERVER_PASSWORD, SERVER_PUBLIC_NAME, SERVER_PUBLIC_DESC and SERVER_PORT are optional if you have access to the file /server-data/Server/$SERVER_NAME.ini where the values are.

SERVER_BRANCH, SERVER_BETA_PASSWORD and ADMIN_PASSWORD are not used if these values are set by LGSM_COMMON_CONFIG, LGSM_COMMON_CONFIG_FILE, LGSM_SERVER_CONFIG or LGSM_SERVER_CONFIG_FILE. These 4 variables from cyrale/linuxgsm can override default settings from LinuxGSM_: _default.cfg.

Volumes

  • /server-data Data directory of the server. Contains db, config files...
  • /server-files Application dir of the server.

Expose

  • 8766 Steam port 1 (udp)
  • 8767 Steam port 2 (udp)
  • 27015 RCON
  • 16261 Game server (udp)
  • 16262-16XXX Clients slots

You need to bind X ports for client connection. (Example: If you have 10 slots, you need to put -p 16262-16272:16262-16272, if you have 100 slots, you need to put -p 16262-16362:16262-16362).

project-zomboid's People

Contributors

cyrale avatar sylvainmarty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

project-zomboid's Issues

Assertion Failed: CFileWriterThread already exited

Hey, i was trying to setup a server using your docker image and i get the following error,
any idea on what's causing it?

project-zomboid_1 | * Local build: 3417034
project-zomboid_1 | * Remote build: 3417034
project-zomboid_1 | * Branch: public
project-zomboid_1 | https://steamdb.info/app/380870/
project-zomboid_1 |
project-zomboid_1 | Game server installed and updated!
project-zomboid_1 | openjdk version "11.0.9.1" 2020-11-04
[ OK ] Starting ************: Project Zomboid Server
project-zomboid_1 | 1622847909859 znet: Java_zombie_core_znet_SteamUtils_n_1Shutdown
project-zomboid_1 | src/tier1/fileio.cpp (4913) : Assertion Failed: s_bExit
project-zomboid_1 | src/tier1/fileio.cpp (4913) : Assertion Failed: s_bExit
project-zomboid_1 | src/tier1/fileio.cpp (4915) : Assertion Failed: m_vecRegisteredWriters.Count() == 0
project-zomboid_1 | src/tier1/fileio.cpp (4915) : Assertion Failed: m_vecRegisteredWriters.Count() == 0
project-zomboid_1 | Bad thread localsrc/tier1/fileio.cpp (4975) : Assertion Failed: CFileWriterThread already exited
project-zomboid_1 | src/tier1/fileio.cpp (4975) : Assertion Failed: CFileWriterThread already exited
project-zomboid_1 | Bad thread localBad thread localsrc/tier1/fileio.cpp (4975) : Assertion Failed: CFileWriterThread already exited
project-zomboid_1 | src/tier1/fileio.cpp (4975) : Assertion Failed: CFileWriterThread already exited

Any help would be than grateful.

znet: OnSteamServersConnectFailure when starting PZ server via docker-compose

Describe the bug
When I start the server via docker-compose (file pasted below), I'm getting the following errors in my server-console.txt file:

Failed to read SVNRevision.txt
1609522624861 versionNumber=40.43 demo=false
1609522624864 server name is "rollhaxpz"
1609522624864 map_t.bin does not exist, cannot determine the server's WorldVersion.
1609522624865 Loading networking libraries...
1609522624866 Loading steam_api...
1609522624866 Loading RakNet64...
1609522624867 Loading ZNetJNI64...
1609522624868 znet: ZNet loaded
1609522624868 znet: Compiled with SERVER_STEAMAPI == 0
1609522624868 znet: Starting with bServer == true
1609522624869 znet: SteamAPI initialised successfully
1609522624869 SteamUtils initialised successfully
1609522624878 translator: language is EN
LightingFPS set to 15
1609522624924 reading /home/linuxgsm/Zomboid/Server/rollhaxpz.ini
1609522624925 writing /home/linuxgsm/Zomboid/Server/rollhaxpz.ini
1609522624928 znet: Java_zombie_core_znet_SteamGameServer_Init
1609522625019 znet: SteamGameServer seems to be initialized
1609522625019 znet: Java_zombie_core_znet_SteamGameServer_SetProduct
1609522625019 znet: Java_zombie_core_znet_SteamGameServer_SetGameDescription
1609522625019 znet: Java_zombie_core_znet_SteamGameServer_SetModDir
1609522625019 znet: Java_zombie_core_znet_SteamGameServer_SetDedicatedServer
1609522625019 znet: Java_zombie_core_znet_SteamGameServer_SetMaxPlayerCount
1609522625020 znet: Java_zombie_core_znet_SteamGameServer_SetServerName 'Project Zomboid Server'
1609522625020 znet: Java_zombie_core_znet_SteamGameServer_SetMapName 'Muldraugh, KY'
1609522625020 znet: Java_zombie_core_znet_SteamGameServer_SetGameTags 'hidden'
1609522625020 znet: Java_zombie_core_znet_SteamGameServer_SetKeyValue key='description' value=''
1609522625021 znet: Java_zombie_core_znet_SteamGameServer_SetKeyValue key='version' value='40.43'
1609522625021 znet: Java_zombie_core_znet_SteamGameServer_SetKeyValue key='open' value='1'
1609522625021 znet: Java_zombie_core_znet_SteamGameServer_SetKeyValue key='public' value='0'
1609522625023 znet: Java_zombie_core_znet_SteamWorkshop_n_1Init
1609522625023 znet: Java_zombie_core_znet_SteamGameServer_LogOnAnonymous
1609522625023 znet: Java_zombie_core_znet_SteamGameServer_EnableHeartBeats
1609522625023 Waiting for response from Steam servers
1609522625125 znet: OnSteamServersConnectFailure
1609522625126 Failed to connect to Steam servers
1609522625126 znet: Java_zombie_core_znet_SteamUtils_n_1Shutdown

No world is ever created.

If I run the container directly (not using docker-compose) it appears to work without issue; a world is created on disk.

To Reproduce
Steps to reproduce the behavior:

  1. Run docker-compose -f docker-compose.yml up
  2. See error

Expected behavior
Server starts, world is created.

Actual behavior
Server doesn't start, docker container remains running, world is not created.

Screenshots
N/A

Additional context
Here is my docker-compose.yml file (mostly copy/pasted from another issue on this github to address the invalid IP bug, which still seems to be an issue on 0.2.1/latest):

version: "3.0"

services:
    project-zomboid:
      image: cyrale/project-zomboid:latest
      restart: unless-stopped
      environment:
        SERVER_NAME: "RollhaxPZ"
        ADMIN_PASSWORD: "derp"
        LGSM_SERVER_CONFIG: |
          ip="10.3.8.200"
      ports:
        - "8766:8766/udp"
        - "8767:8767/udp"
        - "16261:16261/udp"
        - "16262-16272:16262-16272"
        - "27015:27015"
      volumes:
        - ./server-data:/server-data

I'm far from a docker whiz, but pretty sure it's telling me that the container is unable to communicate with steam. Might be wrong. Definitely odd that it works via docker compose though?

$(pwd) What does it do?

It's more a question but i can see that you are using $(pwd) for mounting volumes.
What does this do and is it required?
For example i would like to use a shared folder i have available under /mnt/
When starting the image it stops at the following.

    fetching command_update_linuxgsm.sh...OK,

[ .... ] Update LinuxGSM pzserver: Updating LinuxGSM    fetching check_root.sh...OK,
,
    checking config _default.cfg...OK,
    checking linuxgsm.sh...UPDATE,
    fetching linuxgsm.sh...OK,
    checking pzserver...UPDATE,
    backup pzserver...OK,
	Backup: /home/steam/ProjectZomboid/lgsm/backup/script/pzserver-12_10_2019_39.bak,
    fetching pzserver...OK,
    checking function check.sh...OK,
    checking function check_deps.sh...OK,
    checking function check_glibc.sh...OK,
    checking function check_permissions.sh...OK,
    checking function check_root.sh...OK,
    checking function check_steamcmd.sh...OK,
    checking function check_system_requirements.sh...OK,
    checking function check_tmuxception.sh...OK,
    checking function command_install.sh...OK,
    checking function command_update_linuxgsm.sh...OK,
    checking function core_dl.sh...UPDATE,
    fetching core_dl.sh...OK,
    checking function core_exit.sh...OK,
    checking function core_functions.sh...OK,
    checking function core_getopt.sh...OK,
    checking function core_legacy.sh...OK,
    checking function core_messages.sh...OK,
    checking function core_trap.sh...OK,
    checking function fix.sh...OK,
    checking function info_distro.sh...OK,
    checking function install_complete.sh...OK,
    checking function install_config.sh...OK,
    checking function install_header.sh...OK,
    checking function install_logs.sh...OK,
    checking function install_server_dir.sh...OK,
    checking function install_server_files.sh...OK,
    checking function install_stats.sh...UPDATE,
    fetching install_stats.sh...OK,
    checking function install_steamcmd.sh...OK,

[  OK  ] Update LinuxGSM pzserver: Updating functions    fetching command_update.sh...OK,

[ .... ] Update pzserver:     fetching check_system_dir.sh...OK,
    fetching check_logs.sh...OK,
    fetching check_status.sh...OK,
    fetching logs.sh...OK,
    fetching update_steamcmd.sh...OK,

[ .... ] Update pzserver: Checking for update: SteamCMD: checking local build
[ .... ] Update pzserver: Checking for update: SteamCMD: checking remote build
[  OK  ] Update pzserver: Checking for update: SteamCMD: checking remote build
[ .... ] Update pzserver: Checking for update: SteamCMD
[  OK  ] Update pzserver: Checking for update: SteamCMD,
,
Update available,
* Local build: 0,
* Remote build: 3417034,
https://steamdb.info/app/380870/,
,
applying update.
applying update..
applying update...
,
    fetching info_config.sh...OK,
WARNING: setlocale('en_US.UTF-8') failed, using locale: 'C'. International characters may not work.,
Redirecting stderr to '/home/steam/Steam/logs/stderr.txt',
[  0%] Checking for available updates...,
[----] Verifying installation...,
Steam Console Client (c) Valve Corporation,
-- type 'quit' to exit --,
Loading Steam API...OK.,
,
Connecting anonymously to Steam Public...Logged in OK,
Waiting for user info...OK,
 Update state (0x3) reconfiguring, progress: 0.00 (0 / 0),
 Update state (0x11) preallocating, progress: 2.36 (53495681 / 2268532511),
 Update state (0x11) preallocating, progress: 3.44 (78045648 / 2268532511),
 Update state (0x11) preallocating, progress: 3.51 (79589879 / 2268532511),
 Update state (0x11) preallocating, progress: 3.55 (80572691 / 2268532511),
 Update state (0x11) preallocating, progress: 3.65 (82710996 / 2268532511),
 Update state (0x11) preallocating, progress: 3.71 (84274593 / 2268532511),
 Update state (0x11) preallocating, progress: 3.76 (85403650 / 2268532511),
 Update state (0x11) preallocating, progress: 12.14 (275353529 / 2268532511),
 Update state (0x11) preallocating, progress: 12.33 (279663300 / 2268532511),
 Update state (0x11) preallocating, progress: 12.42 (281805285 / 2268532511),
 Update state (0x11) preallocating, progress: 12.62 (286358647 / 2268532511),
 Update state (0x11) preallocating, progress: 12.95 (293777570 / 2268532511),
 Update state (0x11) preallocating, progress: 13.07 (296609002 / 2268532511),
 Update state (0x11) preallocating, progress: 13.19 (299292677 / 2268532511),
 Update state (0x11) preallocating, progress: 13.24 (300384513 / 2268532511),
 Update state (0x11) preallocating, progress: 13.29 (301506057 / 2268532511),
 Update state (0x11) preallocating, progress: 27.56 (625173659 / 2268532511),
 Update state (0x11) preallocating, progress: 51.00 (1156991055 / 2268532511),
 Update state (0x11) preallocating, progress: 74.30 (1685630195 / 2268532511),
 Update state (0x11) preallocating, progress: 84.64 (1920162420 / 2268532511),
 Update state (0x11) preallocating, progress: 90.68 (2057024233 / 2268532511),
Error! App '380870' state is 0x602 after update job.,
    fetching fix_steamcmd.sh...OK,

[ .... ] Fix pzserver: Applying steamclient.so fix: Project Zomboid
[ INFO ] Fix pzserver: Applying steamclient.so fix: Project Zomboid
[  OK  ] Fix pzserver: Applying steamclient.so fix: Project Zomboid,
    fetching alert.sh...OK,
    fetching info_messages.sh...OK,
ls: cannot access '/home/steam/Zomboid/Logs': No such file or directory,
cp: cannot create regular file '/server-data/Server/pz-server.ini': No such file or directory,
Start the project-zomboid server named pz-server,
    fetching command_start.sh...OK,
    fetching check_executable.sh...OK,

[ FAIL ] Starting pz-server: executable was not found,
* /home/steam/ProjectZomboid/serverfiles/start-server.sh,
tail: cannot open '/server-data/server-console.txt' for reading: No such file or directory,
tail: no files remaining,

Workshop Mod Support

As it stands, adding mods to the server via the 'workshopitems=' line in the server.ini does not seem to allow the server process to connect and download the mods appropriately. From my research, this appears to be caused by the process not being tied to a steam user. I'm not 100% sure how to go about solving for this. I believe it is possible to download with 'login anonymous' but this still doesn't allow the server process to automatically handle the downloads and requires a lot of manual work. Other solutions already exist in some forms so adapting one of them for zomboid seems feasible. Including them in the docker image is where my knowledge ends however.

should respond to sig_term and shutdown gracefully

Describe the bug
Failure to respond to the sig_term signal in the container may cause the game to fail to save progress.

To Reproduce
Steps to reproduce the behavior:

  1. pull up container
  2. run docker stop ${container_name}

Expected behavior
game exit correctly and not kill by sig_kill

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Help with connecting to server from external network.

Hey there, I managed to get the server up and running on a remote machine that I have access to. At first I experienced the same issue that was raised in another issue with the server failing on startup due to the inability to parse IP=... Applying the workaround worked well enough to have it running. However I am a bit unsure of how to reach the server from an external network. the console spits out an external IP address but when I try with it my game client says it cannot connect to the server. I am not so sharp at networking and lack some knowledge on the subject. Do I need to configure a sort of reverse proxy or is there perhaps just something that I am overlooking?

Many thanks for your time, and cool project. :)

Server fails to start with default configuration (znet: ERROR: couldn’t parse IP)

Describe the bug
Server fails to start with default configuration (znet: ERROR: couldn’t parse IP).

The default LGSM configuration provides the IP as "0.0.0.0", which the server does not parse / allow.
The server must be configured to use the docker IP address.

To Reproduce

  1. Create a new server as described in the README
  2. Wait for the server to fail during startup

Expected behavior
The image should read the container IP address and set the server IP accordingly.

Additional context
Reference: Linux GSM Forum

Workaround
The problem can be fixed using Docker Compose and changing the compose file to give the container a static IP address and add it to the LGSM instance config:

version: "3.0"

services:
    project-zomboid:
        image: cyrale/project-zomboid
        restart: unless-stopped
        environment:
            SERVER_NAME: "MyServer"
            SERVER_PASSWORD: "Sh00tZ0mb13s"
            ADMIN_PASSWORD: "l3tm31n"
            PLAYER_PORTS: "10"
            # SERVER_BRANCH: "iwillbackupmysave"
            # Insert server IP into LGSM instance config
            LGSM_SERVER_CONFIG: |
              ip="172.20.128.2"
        ports:
            - "8766:8766/udp"
            - "8767:8767/udp"
            - "16261:16261/udp"
            - "16262-16272:16262-16272"
            - "27015:27015"
        volumes:
            - ./server-data:/server-data
            - ./server-files:/server-files
        # Give the container a static IP address
        networks:
            static-network:
              ipv4_address: 172.20.128.2
        restart: always

# Create a network to apply a conflict free static IP
networks:
  static-network:
    ipam:
      config:
        - subnet: 172.20.0.0/16

Error starting up the server after a shutdown

I am not sure what I am doing wrong here?

Trying to start the docker container results in an error. Failed to find any .lotheader files at zombie.iso.IsoMetaGrid.CreateStep1

To Reproduce
docker start project-zomboid

Expected behavior
Expected the container to start up again with the server running

Screenshots
Screenshot 2021-01-31 104225

Is SteamCMD necessary?

If I just run this I get two lines of permission errors in my Docker logs.
[Error] Can't access your data directory. Check permissions on your mapped directory with /server-data.

nosteam configuration?

I have the question that if it can be placed in nosteam mode, I have bought the game but 1 friend wants to play with us and cannot enter because he tells him that he can only play on non-steam servers.
Any way to configure it like this? since I put the command in my game on steam as -nosteam but it won't let me enter.
I have it hosted on a VPS, where I already tried connecting as a steam user and it works perfect.

Problems starting docker compose in daemon

If use docker-compose up -d I get the following error

1622489323661 RCON: listening on port 27015
1622489323947 Missing texture: media/textures/weather/fogwhite.png
1622489324063 znet: OnPolicyResponse
1622489324064 znet: Zomboid Server is VAC Secure
./start-server.sh: line 21:  3161 Killed                  LD_PRELOAD="${LD_PRELOAD}:${JSIG}" ./ProjectZomboid64 "$@"

But if use docker-comopse up the server starts normally


Docker version 20.10.6, build 370c289
docker-compose version 1.25.0, build unknown

version: "3.7"
services:
    project-zomboid:
        image: ghcr.io/cyrale/project-zomboid
        restart: unless-stopped
        environment:
            SERVER_NAME: "MyServer"
            SERVER_PASSWORD: "*****"
            ADMIN_PASSWORD: "*****"
        ports:
            - "8766:8766/udp"
            - "8767:8767/udp"
            - "16261:16261/udp"
            - "16262-16272:16262-16272"
            - "27015:27015"
        volumes:
            - ./server-data:/server-data

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.