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

Use correct private IP in AWS ECS #73

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/zomboid-dedicated-server.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ COPY src /home/steam/

# Install Python, and take ownership of rcon binary
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-minimal iputils-ping tzdata \
python3-minimal iputils-ping tzdata curl jq \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

Expand Down
8 changes: 6 additions & 2 deletions src/run_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,12 @@ function set_variables() {
# Set the IP address variable
# NOTE: Project Zomboid cannot handle the IN_ANY address
if [[ -z "$BIND_IP" ]] || [[ "$BIND_IP" == "0.0.0.0" ]]; then
BIND_IP=($(hostname -I))
BIND_IP="${BIND_IP[0]}"
if [[ ! -z "$ECS_CONTAINER_METADATA_URI" ]]; then
BIND_IP=$(curl -s $ECS_CONTAINER_METADATA_URI | jq -r '.Networks[0].IPv4Addresses[0]')
else
BIND_IP=($(hostname -I))
BIND_IP="${BIND_IP[0]}"
fi
else
BIND_IP="$BIND_IP"
fi
Expand Down