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

Add h2server variables #1

Open
wants to merge 1 commit into
base: master
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
30 changes: 29 additions & 1 deletion .env → .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,30 @@ H2SERVER1_USERNAME=
# The password used to login to the defined account.
H2SERVER1_PASSWORD=

# The stats api key (without this, your server won't record stats)
H2SERVER1_STATS_AUTH_KEY=

# vip_lock (Server):
# This flag tells the server to lock the game to VIP mode when the game starts
# Players who are in the lobby when the game starts are added to VIP and can rejoin if there are connection issues
# The VIP list will be cleared when the lobby reaches Post game
H2SERVER1_VIP_LOCK=false

# minimum_player_start options (Server):
# Changes the starting behaviour of the countdown, setting this to any value (1-16) will cause the
# Server to not start until the player count is equal to or above the given value. A value of 0 will disable this setting.
H2SERVER1_MINIMUM_PLAYER_START=0

# teams_enabled_bit_flags (Server)
# By default, the game reads team bitflags from the current map.
# With this option, you can enable which teams are enabled.
# Each bit corresponds to a team. Example bellow where we disable Blue, Green and Pink teams:
# Teams: Red Blue Yellow Green Purple Orange Brown Pink
# | | | | | | | |
# \/ \/ \/ \/ \/ \/ \/ \/
# 1 - 0 - 1 - 0 - 1 - 1 - 1 - 0
H2SERVER1_TEAMS_ENABLED_BIT_FLAGS=1-1-1-1-1-1-1-1

# To add more servers just add more configs and port ranges (with approriate port forward on host)
# and add more blocks to the docker-compose.yml file
#H2SERVER2_UDP_PORT_RANGE=
Expand All @@ -91,4 +115,8 @@ H2SERVER1_PASSWORD=
#H2SERVER2_SERVER_NAME=
#H2SERVER2_SERVER_PLAYLIST=
#H2SERVER2_USERNAME=
#H2SERVER2_PASSWORD=
#H2SERVER2_PASSWORD=
#H2SERVER2_STATS_AUTH_KEY=
#H2SERVER2_VIP_LOCK=
#H2SERVER2_MINIMUM_PLAYER_START=
#H2SERVER2_TEAMS_ENABLED_BIT_FLAGS=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
6 changes: 5 additions & 1 deletion Dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ ARG server_name
ARG server_playlist
ARG username
ARG password
ARG stats_auth_key
ARG vip_lock
ARG minimum_player_start
ARG teams_enabled_bit_flags

# Build h2server registry file
ADD createRegistryFile.sh .
Expand All @@ -33,7 +37,7 @@ RUN ./createRegistryFile.sh "$description" "$owner"
ADD createServerConfig.sh .
ADD h2serverconfig.ini.template .
RUN chmod 755 createServerConfig.sh
RUN ./createServerConfig.sh "$wan_ip" "$lan_ip" "$enable_xdelay" "$debug_log" "$debug_log_level" "$debug_log_console" "$server_name" "$server_playlist" "$pcr_time" "$username" "$password" "$udp_port_range"
RUN ./createServerConfig.sh "$wan_ip" "$lan_ip" "$enable_xdelay" "$debug_log" "$debug_log_level" "$debug_log_console" "$server_name" "$server_playlist" "$pcr_time" "$username" "$password" "$udp_port_range" "$stats_auth_key" "$vip_lock" "$minimum_player_start" "$teams_enabled_bit_flags"
RUN mkdir /home/config
RUN mv h2serverconfig.ini /home/config/

Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/createServerConfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
portRange="${12}"
basePort="${portRange%-*}"

sed -e "s/\${var1}/$1/" -e "s/\${var2}/$2/" -e "s/\${var3}/$3/" -e "s/\${var4}/$4/" -e "s/\${var5}/$5/" -e "s/\${var6}/$6/" -e "s/\${var7}/$7/" -e "s/\${var8}/$8/" -e "s/\${var9}/$9/" -e "s/\${var10}/${10}/" -e "s/\${var11}/${11}/" -e "s/\${var12}/${basePort}/" h2serverconfig.ini.template | tee h2serverconfig.ini
sed -e "s/\${var1}/$1/" -e "s/\${var2}/$2/" -e "s/\${var3}/$3/" -e "s/\${var4}/$4/" -e "s/\${var5}/$5/" -e "s/\${var6}/$6/" -e "s/\${var7}/$7/" -e "s/\${var8}/$8/" -e "s/\${var9}/$9/" -e "s/\${var10}/${10}/" -e "s/\${var11}/${11}/" -e "s/\${var12}/${basePort}/" -e "s/\${var13}/${13}/" -e "s/\${var14}/${14}/" -e "s/\${var15}/${15}/" -e "s/\${var16}/${16}/" h2serverconfig.ini.template | tee h2serverconfig.ini
5 changes: 4 additions & 1 deletion Dockerfiles/h2serverconfig.ini.template
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,8 @@ server_playlist = ${var8}
additional_pcr_time = ${var9}
login_identifier = ${var10}
login_password = ${var11}

stats_auth_key = ${var13}
vip_lock = ${var14}
minimum_player_start = ${var15}
teams_enabled_bit_flags = ${var16}

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ This set of docker configurations enables someone to host halo2vista dedicated (
- Ability to open ports
- Ability to use linux based distributions
- Ability to use git
- Make sure following is installed:
- git
- docker
- docker-compose
- python
- python-yaml

## Setup

Expand Down
10 changes: 9 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ def getH2ServerBlock(id):
h2ServerPlaylist = validateValueAndGetKey(h2ServerUniqueStringPrefix + "SERVER_PLAYLIST")
h2ServerUsername = validateValueAndGetKey(h2ServerUniqueStringPrefix + "USERNAME")
h2ServerPassword = validateValueAndGetKey(h2ServerUniqueStringPrefix + "PASSWORD")
h2ServerStatsAuthKey = validateValueAndGetKey(h2ServerUniqueStringPrefix + "STATS_AUTH_KEY")
h2ServerVipLock = validateValueAndGetKey(h2ServerUniqueStringPrefix + "VIP_LOCK")
h2ServerMinimumPlayerStart = validateValueAndGetKey(h2ServerUniqueStringPrefix + "MINIMUM_PLAYER_START")
h2ServerTeamsEnabledBitFlags = validateValueAndGetKey(h2ServerUniqueStringPrefix + "TEAMS_ENABLED_BIT_FLAGS")

h2ServerArgs = {
"description": variablize(h2ServerDescription),
Expand All @@ -88,7 +92,11 @@ def getH2ServerBlock(id):
"server_name": variablize(h2ServerName),
"server_playlist": variablize(h2ServerPlaylist),
"username": variablize(h2ServerUsername),
"password": variablize(h2ServerPassword)
"password": variablize(h2ServerPassword),
"stats_auth_key": variablize(h2ServerStatsAuthKey),
"vip_lock": variablize(h2ServerVipLock),
"minimum_player_start": variablize(h2ServerMinimumPlayerStart),
"teams_enabled_bit_flags": variablize(h2ServerTeamsEnabledBitFlags)
}

h2ServerBuild = {"context": "./Dockerfiles", "dockerfile": "Dockerfile", "args": h2ServerArgs}
Expand Down