Skip to content

Commit

Permalink
Updated docs and License to Apache 2.0;
Browse files Browse the repository at this point in the history
  • Loading branch information
Renegade-Master committed Jan 26, 2024
1 parent 9a86858 commit a491236
Show file tree
Hide file tree
Showing 10 changed files with 329 additions and 765 deletions.
5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

879 changes: 201 additions & 678 deletions LICENSE

Large diffs are not rendered by default.

78 changes: 51 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,53 @@ the [GitHub repository](https://github.com/Renegade-Master/zomboid-dedicated-ser
Dedicated Server for Project Zomboid using Docker, and optionally Docker-Compose.
Built almost from scratch to be the smallest Project Zomboid Dedicated Server around!

**Note:** This Image is "rootless", and therefore should not be run as the `root` user.
Attempting to do so will prevent the server from starting (
see [#8](https://github.com/Renegade-Master/zomboid-dedicated-server/issues/8)
, [#14](https://github.com/Renegade-Master/zomboid-dedicated-server/issues/14)).

Bare-Minimum instructions to get a server running:

```shell
# Pull the latest image:
docker pull renegademaster/zomboid-dedicated-server:latest
## Pull the latest image:
# With Docker
docker pull docker.io/renegademaster/zomboid-dedicated-server:latest

# Or with Podman
podman pull docker.io/renegademaster/zomboid-dedicated-server:latest


## Make two volumes
# With Docker
docker volume create ZomboidDedicatedServer
docker volume create ZomboidConfig

# Make two folders
mkdir ZomboidConfig ZomboidDedicatedServer
# Or with Podman
podman volume create ZomboidDedicatedServer
podman volume create ZomboidConfig

# Run the server (with bare minimum options):
## Run the server (with bare minimum options):
# With Docker
docker run --detach \
--mount type=bind,source="$(pwd)/ZomboidDedicatedServer",target=/home/steam/ZomboidDedicatedServer \
--mount type=bind,source="$(pwd)/ZomboidConfig",target=/home/steam/Zomboid \
--volume "ZomboidDedicatedServer":/home/steam/ZomboidDedicatedServer \
--volume "ZomboidConfig":/home/steam/Zomboid \
--publish 16261:16261/udp --publish 16262:16262/udp \
--name zomboid-server \
docker.io/renegademaster/zomboid-dedicated-server:latest

# Or with Podman
podman run --detach \
--volume "ZomboidDedicatedServer":/home/steam/ZomboidDedicatedServer \
--volume "ZomboidConfig":/home/steam/Zomboid \
--publish 16261:16261/udp --publish 16262:16262/udp \
--name zomboid-server \
docker.io/renegademaster/zomboid-dedicated-server:latest
```

The default behaviour of the Container is not to automatically restart after a crash to give the user time to investigate the cause of the issue. You may however want to change the [restart policy](https://docs.docker.com/engine/reference/run/#restart-policies---restart) to automatically recover from an unexpected failure. The following options will help to recover from such a situation:
The default behaviour of the Container is not to automatically restart after a crash to give the user time to
investigate the cause of the issue. You may however want to change
the [restart policy](https://docs.docker.com/engine/reference/run/#restart-policies---restart) to automatically recover
from an unexpected failure. The following options will help to recover from such a situation:

- `--restart=unless-stopped` will restart the container every time that it exits unless the Container is stopped using the Docker/Podman API.
- `--restart=on-failure[:max-retries]` will restart the container only if it exits with a non-zero exit code. Optionally, it can also be configured to only restart a fixed number of times to help prevent crash-loops.
- `--restart=unless-stopped` will restart the container every time that it exits unless the Container is stopped using
the Docker/Podman API.
- `--restart=on-failure[:max-retries]` will restart the container only if it exits with a non-zero exit code.
Optionally, it can also be configured to only restart a fixed number of times to help prevent crash-loops.

These same options can be set in the `docker-compose.yaml` file.

Expand All @@ -69,7 +89,7 @@ runs [here](https://github.com/Renegade-Master/zomboid-dedicated-server/actions/
### Images:

| Provider | Image | Pull Command |
| ---------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| [GitHub Packages](https://github.com/Renegade-Master/zomboid-dedicated-server/pkgs/container/zomboid-dedicated-server) | `ghcr.io/renegade-master/zomboid-dedicated-server` | `docker pull ghcr.io/renegade-master/zomboid-dedicated-server:x.y.z`<br/>`docker pull ghcr.io/renegade-master/zomboid-dedicated-server:latest` |
| [DockerHub](https://hub.docker.com/r/renegademaster/zomboid-dedicated-server) | `docker.io/renegademaster/zomboid-dedicated-server` | `docker pull docker.io/renegademaster/zomboid-dedicated-server:x.y.z`<br/>`docker pull docker.io/renegademaster/zomboid-dedicated-server:latest` |
| [Red Hat Quay](https://quay.io/repository/renegade_master/zomboid-dedicated-server) | `quay.io/renegade_master/zomboid-dedicated-server` | `docker pull quay.io/renegade_master/zomboid-dedicated-server:x.y.z`<br/>`docker pull quay.io/renegade_master/zomboid-dedicated-server:latest` |
Expand All @@ -87,7 +107,7 @@ runs [here](https://github.com/Renegade-Master/zomboid-dedicated-server/actions/
Two directories are required to be present on the host:

| Name | Directory | Description |
| ------------------ | ------------------------ | ---------------------------------------------------- |
|--------------------|--------------------------|------------------------------------------------------|
| Configuration Data | `ZomboidConfig` | For storing the server configuration and save files. |
| Installation Data | `ZomboidDedicatedServer` | For storing the server game data. |

Expand Down Expand Up @@ -116,7 +136,7 @@ table provided by the Docker image.
There are a total of three ports that can be utilised by the server, but only two are strictly required:

| Name | Default Port | Description | Required |
|----------------|--------------|----------------------------------------------------------------------| -------- |
|----------------|--------------|----------------------------------------------------------------------|----------|
| `DEFAULT_PORT` | `16261` | Port used by the server to listen for connections. | yes |
| `RCON_PORT` | `27015` | Port used by the server to listen for RCON connections/commands. | no |
| `UDP_PORT` | `16262` | Additional Port used by the server to facilitate Client connections. | yes |
Expand Down Expand Up @@ -147,7 +167,7 @@ recommended for ease of configuration.
### Optional environment variables

| Argument | Description | Values | Default |
| ---------------- | -------------------------------------------- | ----------------- | ------------- |
|------------------|----------------------------------------------|-------------------|---------------|
| `ADMIN_PASSWORD` | Server Admin account password | [a-zA-Z0-9]+ | changeme |
| `ADMIN_USERNAME` | Server Admin account username | [a-zA-Z0-9]+ | superuser |
| `BIND_IP` | IP to bind the server to | 0.0.0.0 | 0.0.0.0 |
Expand All @@ -169,7 +189,7 @@ the configured environment variable.
Any other values *can* and *should* be edited directly in the .ini file.

| Argument | Description | .ini variable | Values | Default |
|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------| --------------------- | ---------------------- | ------------- |
|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------|-----------------------|------------------------|---------------|
| `AUTOSAVE_INTERVAL` | Interval between autosaves in minutes | SaveWorldEveryMinutes | [0-9]+ | 15m |
| `DEFAULT_PORT` | Port for other players to connect to | DefaultPort | 1000 - 65535 | 16261 |
| `MAX_PLAYERS` | Maximum players allowed in the Server | MaxPlayers | [0-9]+ | 16 |
Expand All @@ -192,7 +212,7 @@ The following are instructions for running the server using the Docker image.
- Pull the image from DockerHub:

```shell
docker pull renegademaster/zomboid-dedicated-server:<tagname>
docker pull docker.io/renegademaster/zomboid-dedicated-server:<tagname>
```

- Or alternatively, build the image:
Expand All @@ -201,7 +221,9 @@ The following are instructions for running the server using the Docker image.
git clone https://github.com/Renegade-Master/zomboid-dedicated-server.git \
&& cd zomboid-dedicated-server
docker build -t docker.io/renegademaster/zomboid-dedicated-server:<tag> -f docker/zomboid-dedicated-server.Dockerfile .
docker build . \
--tag docker.io/renegademaster/zomboid-dedicated-server:<tag> \
--file image/zomboid-dedicated-server.Containerfile
```

2. Run the container:
Expand All @@ -210,11 +232,12 @@ The following are instructions for running the server using the Docker image.
`published` ports below must also be changed\*

```shell
mkdir ZomboidConfig ZomboidDedicatedServer
docker volume create ZomboidDedicatedServer
docker volume create ZomboidConfig
docker run --detach \
--mount type=bind,source="$(pwd)/ZomboidDedicatedServer",target=/home/steam/ZomboidDedicatedServer \
--mount type=bind,source="$(pwd)/ZomboidConfig",target=/home/steam/Zomboid \
--volume "ZomboidDedicatedServer":/home/steam/ZomboidDedicatedServer \
--volume "ZomboidConfig":/home/steam/Zomboid \
--publish 16261:16261/udp --publish 16262:16262/udp [--publish 27015:27015/tcp] \
--name zomboid-server \
[--restart=no] \
Expand Down Expand Up @@ -272,7 +295,8 @@ The following are instructions for running the server using Docker-Compose.
- Make the data and configuration directories:

```shell
mkdir ZomboidConfig ZomboidDedicatedServer
docker volume create ZomboidDedicatedServer
docker volume create ZomboidConfig
```

- Pull the image from DockerHub:
Expand Down
16 changes: 16 additions & 0 deletions cmd/zomboid-dedicated-server/zomboid-dedicated-server.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2021-2024 Renegade-Master [[email protected]]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package main

import (
Expand Down
24 changes: 3 additions & 21 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
#
# Project Zomboid Dedicated Server using SteamCMD Docker Image.
# Copyright (C) 2021-2022 Renegade-Master [[email protected]]
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#

version: "3.8"

services:
Expand All @@ -24,7 +6,7 @@ services:
context: .
dockerfile: image/zomboid-dedicated-server.Dockerfile
image: "docker.io/renegademaster/zomboid-dedicated-server:latest"
container_name: zomboid-dedicated-server-dedicated-server
container_name: zomboid-server
restart: "no"
environment:
- "ADMIN_PASSWORD=changeme"
Expand Down Expand Up @@ -60,5 +42,5 @@ services:
published: 27015
protocol: tcp
volumes:
- ./ZomboidDedicatedServer:/home/steam/ZomboidDedicatedServer
- ./ZomboidConfig:/home/steam/Zomboid/
- ZomboidDedicatedServer:/home/steam/ZomboidDedicatedServer
- ZomboidConfig:/home/steam/Zomboid/
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#
# Copyright 2021-2024 Renegade-Master [[email protected]]
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

ARG BUILDER_IMAGE="docker.io/golang:1.21.6-bullseye"
ARG DOWNLOAD_IMAGE="docker.io/fedora:40"
ARG RCON_IMAGE="docker.io/outdead/rcon:0.10.2"
Expand Down Expand Up @@ -33,8 +49,8 @@ ENV LD_LIBRARY_PATH=/usr/local/bin/linux32:$LD_LIBRARY_PATH \

# Copy required System Utils
COPY --from=downloader [ \
"/usr/bin/env", \
"/usr/bin/basename", \
"/usr/bin/env", \
"/usr/bin/uname", \
"/usr/bin/" \
]
Expand Down
16 changes: 16 additions & 0 deletions internal/utils.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2021-2024 Renegade-Master [[email protected]]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package internal

import (
Expand Down
22 changes: 10 additions & 12 deletions static/edit_server_config.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
#!/usr/bin/env python3

#
# Project Zomboid Dedicated Server using SteamCMD Docker Image.
# Copyright (C) 2021-2022 Renegade-Master [[email protected]]
# Copyright 2021-2024 Renegade-Master [[email protected]]
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# http://www.apache.org/licenses/LICENSE-2.0
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

"""
Expand Down
7 changes: 0 additions & 7 deletions static/install_server.scmd
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
///////////////////////////////////////////////////////////////////////
// Author: Renegade-Master
// Description: SteamCMD installation script for Project Zomboid
// Dedicated Server
// License: GNU General Public License v3.0 (see LICENSE)
///////////////////////////////////////////////////////////////////////

// Do not shutdown on a failed command
@ShutdownOnFailedCommand 0

Expand Down
29 changes: 10 additions & 19 deletions static/run_server.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
#!/usr/bin/env bash

#
# Project Zomboid Dedicated Server using SteamCMD Docker Image.
# Copyright (C) 2021-2022 Renegade-Master [[email protected]]
# Copyright 2021-2024 Renegade-Master [[email protected]]
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# http://www.apache.org/licenses/LICENSE-2.0
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#######################################################################
# Author: Renegade-Master
# Contributors: JohnEarle, ramielrowe
# Description: Install, update, and start a Dedicated Project Zomboid
# instance.
#######################################################################

# Set to `-x` for Debug logging
set +x -o pipefail

Expand Down

0 comments on commit a491236

Please sign in to comment.