Compare commits

...

37 Commits

Author SHA1 Message Date
bae5256397 „scripts/start.sh“ ändern 2022-10-25 11:01:20 +02:00
a0454a9ec9 „Dockerfile“ ändern 2022-05-06 10:04:50 +02:00
97ce42689f „README.md“ ändern 2022-04-18 10:10:26 +02:00
47d291efec „scripts/start-server.sh“ ändern 2022-04-18 09:55:44 +02:00
3ebec0c14f „scripts/start.sh“ ändern 2022-04-18 09:55:26 +02:00
4c3ba2a2a4 „Dockerfile“ ändern 2022-04-18 09:55:10 +02:00
1ec0f6e6d5 „README.md“ ändern 2022-04-18 09:54:51 +02:00
9150be60cd „scripts/start-server.sh“ ändern 2021-01-14 17:23:35 +01:00
30355efcff „scripts/start.sh“ ändern 2020-07-12 19:35:22 +02:00
b7c7a86e2c „Dockerfile“ ändern 2020-07-12 19:33:52 +02:00
45ed8bd4d8 „scripts/start-server.sh“ ändern 2020-07-12 19:33:32 +02:00
9cb8d44ee8 „scripts/start.sh“ ändern 2020-04-28 16:59:35 +02:00
f8408a737f added Stracker
Reviewed-on: #9
2020-03-21 16:31:27 +01:00
d0228ba1e4 „scripts/start-server.sh“ ändern 2020-03-21 15:34:39 +01:00
972cdd6c0d „scripts/start-server.sh“ ändern 2020-03-21 15:25:51 +01:00
78ecebd002 Dateien hochladen nach „config“ 2020-03-21 15:22:29 +01:00
d88ac33717 „scripts/start-server.sh“ ändern 2020-03-21 15:02:37 +01:00
32a8b07f90 „scripts/start-server.sh“ ändern 2020-03-21 14:46:55 +01:00
33053b0e9f „scripts/start-server.sh“ ändern 2020-03-21 14:45:30 +01:00
aff99ed54c „Dockerfile“ ändern 2020-03-21 14:41:39 +01:00
8c19760844 „scripts/start-server.sh“ ändern 2020-03-21 14:41:23 +01:00
d234184047 „.drone.yml“ löschen 2020-03-08 20:37:59 +01:00
15fdf6b442 „.drone.yml“ hinzufügen
Some checks reported errors
continuous-integration/drone/push Build was killed
2020-03-05 19:01:34 +01:00
5b904bf562 „scripts/start.sh“ hinzufügen 2020-02-25 14:51:10 +01:00
cf6d905df3 „scripts/start-server.sh“ ändern 2020-02-25 14:51:01 +01:00
fd4d55366d „Dockerfile“ ändern 2020-02-25 14:15:30 +01:00
79b92dbe91 „Dockerfile“ ändern 2020-01-19 19:18:45 +01:00
5a6868bfdb „Dockerfile“ ändern 2019-11-11 11:02:42 +01:00
600d899dbe „scripts/start-server.sh“ ändern 2019-11-11 11:02:27 +01:00
3e3ed4892b „scripts/start-server.sh“ ändern 2019-05-21 11:53:02 +02:00
2b2b79e2a8 Update start-server.sh 2019-05-07 16:49:19 +02:00
61643ff990 Update start-server.sh 2019-05-07 16:08:29 +02:00
87c0893b7a Update start-server.sh 2019-05-07 16:06:15 +02:00
0d503a3126 Update Dockerfile 2019-05-07 14:52:22 +02:00
061da78561 Update start-server.sh 2019-05-07 14:44:51 +02:00
edf867a3e5 Update Dockerfile 2019-05-07 13:31:09 +02:00
65fc2d33bc Update Dockerfile 2019-05-07 13:30:55 +02:00
5 changed files with 372 additions and 78 deletions

View File

@@ -1,9 +1,11 @@
FROM ubuntu
FROM ich777/debian-baseimage
MAINTAINER ich777
LABEL org.opencontainers.image.authors="admin@minenet.at"
LABEL org.opencontainers.image.source="https://github.com/ich777/docker-steamcmd-server"
RUN apt-get update
RUN apt-get -y install lib32gcc1 libc6-i386 wget language-pack-en lib32stdc++6
RUN apt-get update && \
apt-get -y install --no-install-recommends lib32gcc-s1 libc6-i386 lib32z1 unzip curl screen && \
rm -rf /var/lib/apt/lists/*
ENV DATA_DIR="/serverdata"
ENV STEAMCMD_DIR="${DATA_DIR}/steamcmd"
@@ -12,25 +14,26 @@ ENV GAME_ID="template"
ENV GAME_NAME="template"
ENV GAME_PARAMS="template"
ENV GAME_PORT=27015
ENV INSTALL_STRACKER=""
ENV INSTALL_ASSETTO_SERVER_MANAGER=""
ENV VALIDATE=""
ENV UMASK=000
ENV UID=99
ENV GID=100
ENV USERNAME=""
ENV PASSWRD=""
ENV USER="steam"
ENV DATA_PERM=770
RUN mkdir $DATA_DIR
RUN mkdir $STEAMCMD_DIR
RUN mkdir $SERVER_DIR
RUN useradd -d $DATA_DIR -s /bin/bash --uid $UID --gid $GID steam
RUN chown -R steam $DATA_DIR
RUN ulimit -n 2048
RUN mkdir $DATA_DIR && \
mkdir $STEAMCMD_DIR && \
mkdir $SERVER_DIR && \
useradd -d $DATA_DIR -s /bin/bash $USER && \
chown -R $USER $DATA_DIR && \
ulimit -n 2048
ADD /scripts/ /opt/scripts/
RUN chmod -R 770 /opt/scripts/
RUN chown -R steam /opt/scripts
USER steam
#Server Start
ENTRYPOINT ["/opt/scripts/start-server.sh"]
ENTRYPOINT ["/opt/scripts/start.sh"]

View File

@@ -1,45 +1,40 @@
# SteamCMD in Docker optimized for Unraid
This Docker will download and install SteamCMD. It will also install Counter-Strike: Source and run it. Update Notice: Simply restart the container if a newer version of the game is available.
This Docker will download and install SteamCMD. It will also install AssettoCorsa and run it.
**Install Note:** You must provide a valid Steam username and password with Steam Guard disabled (the user dosen't have to have the game in the library).
**Update Notice:** Simply restart the container if a newer version of the game is available.
## Env params
| Name | Value | Example |
| --- | --- | --- |
| STEAMCMD_DIR | Folder for SteamCMD | /serverdata/steamcmd |
| SERVER_DIR | Folder for gamefile | /serverdata/serverfiles |
| GAME_ID | SteamID for server | 232330 |
| GAME_NAME | SRCDS gamename | cstrike |
| GAME_PARAMS | Values to start the server | -secure +maxplayers 32 +map de_dust2 |
| GAME_ID | The GAME_ID that the container downloads at startup. If you want to install a static or beta version of the game change the value to: '302550 -beta YOURBRANCH' (without quotes, replace YOURBRANCH with the branch or version you want to install). | 302550 |
| INSTALL_STRACKER | Set to 'true' (without quotes) to install Stacker, otherwise leave blank (Please note that you can only Stacker or Assetto-Server-Manager, not both at the same time). | empty |
| INSTALL_ASSETTO_SERVER_MANAGER | Set to 'true' (without quotes) to install Assetto-Server-Manager, otherwise leave blank (Please note that you can only Stacker or Assetto-Server-Manager, not both at the same time). | empty |
| UID | User Identifier | 99 |
| GID | Group Identifier | 100 |
| GAME_PORT | Port the server will be running on | 27015 |
| VALIDATE | Validates the game data | true |
| USERNAME | Leave blank for anonymous login | blank |
| PASSWRD | Leave blank for anonymous login | blank |
***ATTENTION: You have to disable Steam Guard for games that require authentication, Steam recommends to create a seperate account for dedicated servers***
>**NOTE** GAME_ID values can be found [here](https://developer.valvesoftware.com/wiki/Dedicated_Servers_List)
> And for GAME_NAME there is no list, so a quick search should give you the result
## Run example
```
docker run --name CSSource -d \
-p 27015:27015 -p 27015:27015/udp \
--env 'GAME_ID=232330' \
--env 'GAME_NAME=cstrike' \
--env 'GAME_PORT=27015' \
--env 'GAME_PARAMS=-secure +maxplayers 32 +map de_dust2' \
docker run --name AssettoCorsa -d \
-p 9600:9600 -p 9600:9600/udp -p 8081:8081 -p 50041:50041 -p 8772:8772 \
--env 'GAME_ID=302550' \
--env 'USERNAME=YOURSTEAMUSER' \
--env 'PASSWRD=YOURSTEAMPASSWORD' \
--env 'UID=99' \
--env 'GID=100' \
--volume /mnt/user/appdata/steamcmd:/serverdata/steamcmd \
--volume /mnt/user/appdata/cstrikesource:/serverdata/serverfiles \
ich777/steamcmd:latest
--volume /path/to/steamcmd:/serverdata/steamcmd \
--volume /path/to/assettocorsa:/serverdata/serverfiles \
ich777/steamcmd:assettocorsa
```
>**NOTE** port 26900 is the port for vac, in case of multiple servers make sure these are not the same
This Docker was mainly edited for better use with Unraid, if you don't use Unraid you should definitely try it!
This Docker is forked from mattieserver, thank you for this wonderfull Docker.
### Support Thread: https://forums.unraid.net/topic/79530-support-ich777-gameserver-dockers/

164
config/stracker.ini Normal file
View File

@@ -0,0 +1,164 @@
[STRACKER_CONFIG]
; Server ip address or name used to poll results from. You should not touch the default value: 127.0.0.1
ac_server_address = 127.0.0.1
; Path to configuration file of ac server. Note: whenever the server is restarted, it is required to restart stracker as well
ac_server_cfg_ini = /serverdata/serverfiles/cfg/server_cfg.ini
; Working directory of the ac server, needed to read the race result json files. If empty, the directory is deduced from the ac_server_cfg_ini path assuming the default directory structure
ac_server_working_dir = /serverdata/serverfiles
; Set to 1, if you want to append to log files rather than overwriting them. Only meaningful with external log file rotation system.
append_log_file = False
; you normally want to leave that at the default (False). Use case for this is an environment where the same steam account is used by different drivers.
guids_based_on_driver_names = False
; set to false, if you want to disable the TCP keep_alive option (that was the behaviour pre 3.1.7).
keep_alive_ptracker_conns = True
; Listening port for incoming connections of ptracker. Must be one of 50042, 50043, 54242, 54243, 60023, 60024, 62323, 62324, 42423, 42424, 23232, 23233, <AC udp port>+42; ptracker will try all these ports on the ac server's ip address (until a better solution is found...)
listening_port = 50042
; name of the stracker log file (utf-8 encoded), all messages go into there
log_file = /serverdata/serverfiles/stracker.log
; Valid values are "info", "debug" and "dump". Use "dump" only for problem analysis, log files can get very big.
log_level = info
; set to true, if you want the log messages to be prefixed with a timestamp
log_timestamps = False
; set to true, if you want stracker to reduce its priority. Will use BELOW_NORMAL on windows and nice(5) on linux.
lower_priority = True
; set to 1, if you want stracker to compare the players checksums.
perform_checksum_comparisons = False
; Configure which ptracker instances shall be allowed to connect: Valid values are "any", "newer" or "none".
ptracker_connection_mode = any
; name for the server; sessions in the database will be tagged with that name; useful when more than one server is running in parallel on the same database
server_name = acserver
; set to 1, if you want the messages appear on stdout
tee_to_stdout = False
[SWEAR_FILTER]
; Valid values are "none", "kick" and "ban".
action = none
; Number of days the player shall be banned (if action is "ban").
ban_duration = 30
; Specify the number of warnings issued before the player is going to be kicked.
num_warnings = 3
; Specify a file with bad words (one in each line). See https://github.com/shutterstock/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words for examples.
swear_file = bad_words.txt
; message sent to player after a swear detection
warning = Please be polite and do not swear in the chat. You will be %(swear_action)s from the server after receiving %(num_warnings_left)d more warnings.
[SESSION_MANAGEMENT]
; What to do when the race is over and no player is actively racing. Valid values are: "none" or "skip".
race_over_strategy = none
; Number of seconds to wait before the session skip is executed (if race_over_strategy is set to "skip")
wait_secs_before_skip = 15
[MESSAGES]
; Lap times below this threshold (in percent of the best time) will be broadcasted as best laps. Lap times above this will be whispered to the player achieving it.
best_lap_time_broadcast_threshold = 105
; set to 1 to enable car to car private messages.
car_to_car_collision_msg = True
; available message types are "enter_leave","best_lap","checksum_errors","welcome","race_finished" and "collision". Connect them using a + sign without spaces.
message_types_to_send_over_chat = best_lap+welcome+race_finished
[DATABASE]
; Only relevant if database_type=sqlite3. Path to the stracker database. If a relative path is given, it is relative to the <stracker> executable
database_file = ./stracker.db3
; Valid values are "sqlite3" and "postgres". Selects the database to be used.
database_type = sqlite3
; Set to "False", if you do not want stracker to backup the database before migrating to a new db version. Note: The backups will be created as sqlite3 db in the current working directory.
perform_backups = True
; name of the postgres database.
postgres_db = stracker
; name of the host running the postgresql server.
postgres_host = localhost
; name of the postgres user password.
postgres_pwd = password
; name of the postgres user.
postgres_user = myuser
[DB_COMPRESSION]
; Interval of database compression in minutes.
interval = 60
; Various options to minimize database size. Valid values are "none" (no compression, save all available infos), "remove_slow_laps" (save detailed infos for fast laps only) and "remove_all" (save no detailed lap info).
mode = none
; If set to 1, database compression will only take place if the server is empty.
needs_empty_server = 1
[HTTP_CONFIG]
; password for the stracker admin pages (leaving it empty results in disabled admin pages
admin_password =
; username for the stracker admin pages (leaving it empty results in disabled admin pages
admin_username =
; Add anonymized players to blacklist (works only if stracker's AUTH feature is used in server).
auth_ban_anonymized_players = False
; Set to a file to be used for logging http authentication requests. Useful to prevent attacks with external program (e.g., fail2ban).
auth_log_file =
; icon to be used in webpages (leave empty for default Assetto Corsa icon)
banner =
; set to false if you do not want svg graphs in the http output (for saving bandwidth)
enable_svg_generation = True
; set to 1, if you want to start a http server for statistics access
enabled = True
; set to true to get the navbar inverted (i.e., dark instead of bright)
inverse_navbar = False
; number of items displayed per page
items_per_page = 15
; Additional columns to be displayed in LapTimes table (seperated by a + sign). Columns can be "valid", "aids", "laps", "date", "grip", "cuts", "collisions", "tyres", "temps", "ballast" and "vmax". Note that too many displayed columns might cause problems on some browsers.
lap_times_add_columns = valid+aids+laps+date
; listening address of the http server (normally there is no need to change the default value 0.0.0.0 which means that the whole internet can connect to the server)
listen_addr = 0.0.0.0
; tcp listening port of the http server
listen_port = 50041
; If set to true, http requests will be logged in stracker.log. Otherwise they are not logged.
log_requests = False
; Maximum number of streaming clients (LiveMap/Log users) allowed to connect to this server in parallel. The number of threads allocated for http serving will be max(10, max_streaming_clients + 5)
max_streaming_clients = 10
; Set to true if you want to use https. Note that you need a SSL certificate and key. If you enable this option, you can reach stracker at https://ip:port/ instead of http://ip:port/
ssl = False
; Path to the SSL certificate for https. Only used when ssl is True. A self-signed certificate can be generated with "openssl req -new -x509 -days 365 -key privkey.pem -out cert.pem"
ssl_certificate =
; Path to the SSL private key for https. Only used when ssl is True. A private key can be generated with "openssl genrsa -out privkey.pem 2048"
ssl_private_key =
; Valid values are "degc" or "degf".
temperature_unit = degc
; Valid values are "kmh" or "mph".
velocity_unit = kmh
[WELCOME_MSG]
; First line of welcome message text (if not empty, this text is sent a player when he enters the server
line1 = Welcome to stracker %(version)s
; Second line of welcome message text (if not empty, this text is sent a player when he enters the server
line2 =
; Third line of welcome message text (if not empty, this text is sent a player when he enters the server
line3 =
; Fourth line of welcome message text (if not empty, this text is sent a player when he enters the server
line4 = Your activities on this server are tracked. By driving on this server you give consent to store and process
; Fifth line of welcome message text (if not empty, this text is sent a player when he enters the server
line5 = information like your driver name, steam GUID, chat messages and session statistics. You can anonymize this
; Sixth line of welcome message text (if not empty, this text is sent a player when he enters the server
line6 = data by typing the chat message "/st anonymize on". You might not be able to join the server again afterwards.
[ACPLUGIN]
; proxy the AC server protocol on these ports, so multiple plugins may be chained (this is equivalent to UDP_PLUGIN_LOCAL_PORT in server_cfg.ini)
proxyPluginLocalPort = -1
; proxy the AC server protocol on these ports, so multiple plugins may be chained (this is equivalent to UDP_PLUGIN_ADDRESS in server_cfg.ini)
proxyPluginPort = -1
; udp port the plugins receives from. -1 means to use the AC servers setting UDP_PLUGIN_ADDRESS
rcvPort = -1
; udp port the plugins sends to. -1 means to use the AC servers setting UDP_PLUGIN_LOCAL_PORT
sendPort = -1
[LAP_VALID_CHECKS]
; if true, collisions with other cars will invalidate laps
invalidateOnCarCollisions = True
; if true, collisions with environment objects will invalidate laps
invalidateOnEnvCollisions = True
; if -1: use server penalty setting, if available, otherwise use 2. All other values are passed to ptracker.
ptrackerAllowedTyresOut = -1

View File

@@ -8,9 +8,8 @@ fi
echo "---Update SteamCMD---"
if [ "${USERNAME}" == "" ]; then
${STEAMCMD_DIR}/steamcmd.sh \
+login anonymous \
+quit
echo "Please enter a valid username and password and restart the container. ATTENTION: Steam Guard must be DISABLED!!!"
sleep infinity
else
${STEAMCMD_DIR}/steamcmd.sh \
+login ${USERNAME} ${PASSWRD} \
@@ -18,48 +17,140 @@ else
fi
echo "---Update Server---"
if [ "${USERNAME}" == "" ]; then
if [ "${VALIDATE}" == "true" ]; then
${STEAMCMD_DIR}/steamcmd.sh \
+login anonymous \
+force_install_dir ${SERVER_DIR} \
+app_update ${GAME_ID} validate \
+quit
else
${STEAMCMD_DIR}/steamcmd.sh \
+login anonymous \
+force_install_dir ${SERVER_DIR} \
+app_update ${GAME_ID} \
+quit
fi
if [ "${VALIDATE}" == "true" ]; then
echo "---Validating installation---"
${STEAMCMD_DIR}/steamcmd.sh \
+@sSteamCmdForcePlatformType windows \
+force_install_dir ${SERVER_DIR} \
+login ${USERNAME} ${PASSWRD} \
+app_update ${GAME_ID} validate \
+quit
else
if [ "${VALIDATE}" == "true" ]; then
${STEAMCMD_DIR}/steamcmd.sh \
+login ${USERNAME} ${PASSWRD} \
+force_install_dir ${SERVER_DIR} \
+app_update ${GAME_ID} validate \
+quit
else
${STEAMCMD_DIR}/steamcmd.sh \
+login ${USERNAME} ${PASSWRD} \
+force_install_dir ${SERVER_DIR} \
+app_update ${GAME_ID} \
+quit
fi
${STEAMCMD_DIR}/steamcmd.sh \
+@sSteamCmdForcePlatformType windows \
+force_install_dir ${SERVER_DIR} \
+login ${USERNAME} ${PASSWRD} \
+app_update ${GAME_ID} \
+quit
fi
if [ "${INSTALL_STRACKER}" == "true" ]; then
echo "---Searching for Stracker installation---"
if [ ! -f ${SERVER_DIR}/stracker/stracker_linux_x86/stracker ]; then
echo "---Stracker not found, downloading and installing---"
if [ ! -d ${SERVER_DIR}/stracker ]; then
mkdir ${SERVER_DIR}/stracker
fi
cd ${SERVER_DIR}/stracker
if wget -q -nc --show-progress --progress=bar:force:noscroll -O stracker.zip https://github.com/ich777/runtimes/raw/master/stracker/stracker.zip ; then
echo "---Successfully downloaded Stracker!---"
else
echo "---Something went wrong, can't download Stracker, putting server in sleep mode---"
sleep infinity
fi
unzip -o stracker.zip
rm ${SERVER_DIR}/stracker/stracker.zip
tar -xvzf stracker_linux_x86.tgz
rm ${SERVER_DIR}/stracker/stracker_linux_x86.tgz
rm ${SERVER_DIR}/stracker/start-stracker.cmd
if [ -f ${SERVER_DIR}/stracker.ini ]; then
echo "---Old stracker.ini found, copying!---"
mv ${SERVER_DIR}/stracker.ini ${SERVER_DIR}/stracker/stracker_linux_x86/stracker.ini
rm ${SERVER_DIR}/stracker/stracker-default.ini
else
rm ${SERVER_DIR}/stracker/stracker-default.ini
fi
else
echo "---Stracker found, continuing---"
fi
else
if [ -d ${SERVER_DIR}/stracker ]; then
echo "---Old stracker installation found, removing and backing up stracker.ini---"
if [ -f ${SERVER_DIR}/stracker/stracker_linux_x86/stracker.ini ]; then
cp ${SERVER_DIR}/stracker/stracker_linux_x86/stracker.ini ${SERVER_DIR}/stracker.ini
echo "---'stracker.ini' backed up to main directory---"
else
echo "---Can't find old 'stracker.ini', continuing---"
fi
rm -R ${SERVER_DIR}/stracker
fi
if [ -f ${SERVER_DIR}/stracker.log ]; then
rm ${SERVER_DIR}/stracker.log
fi
if [ -f ${SERVER_DIR}/AC.log ]; then
rm ${SERVER_DIR}/AC.log
fi
fi
if [ "${INSTALL_ASSETTO_SERVER_MANAGER}" == "true" ]; then
if [ ! -f ${SERVER_DIR}/assetto-server-manager/linux/server-manager ]; then
echo "---Assetto-Server-Manager not found, installing!---"
echo "---Trying to get latest version for Assetto-Server-Manager---"
ASSETTO_SERVER_MANAGER_V="$(curl -s https://api.github.com/repos/JustaPenguin/assetto-server-manager/releases/latest | grep tag_name | cut -d '"' -f4 | cut -d 'v' -f2)"
if [ -z $ASSETTO_SERVER_MANAGER_V ]; then
echo "---Can't get latest version for Assetto-Server-Manager, putting container into sleep mode!---"
sleep infinity
fi
echo "---Latest version for Assetto-Server-Manager: v$ASSETTO_SERVER_MANAGER_V---"
if [ ! -d ${SERVER_DIR}/assetto-server-manager ]; then
mkdir -p ${SERVER_DIR}/assetto-server-manager
fi
cd ${SERVER_DIR}/assetto-server-manager
echo "---Downloading Assetto-Server-Manager v$ASSETTO_SERVER_MANAGER_V, please wait!---"
if wget -q -nc --show-progress --progress=bar:force:noscroll -O ${SERVER_DIR}/assetto-server-manager/asm.zip "https://github.com/JustaPenguin/assetto-server-manager/releases/download/v$ASSETTO_SERVER_MANAGER_V/server-manager_v$ASSETTO_SERVER_MANAGER_V.zip" ; then
echo "---Successfully downloaded Assetto-Server-Manager v$ASSETTO_SERVER_MANAGER_V---"
else
echo "---Download of Assetto-Server-Manager v$ASSETTO_SERVER_MANAGER_V failed, putting container into sleep mode!---"
sleep infinity
fi
unzip ${SERVER_DIR}/assetto-server-manager/asm.zip
rm ${SERVER_DIR}/assetto-server-manager/asm.zip
else
echo "---Assetto-Server-Manager found, continuing!---"
fi
fi
echo "---Prepare Server---"
if [ ! -d ${DATA_DIR}/.steam/sdk32 ]; then
mkdir ${DATA_DIR}/.steam/sdk32
cp -R ${SERVER_DIR}/bin/* ${DATA_DIR}/.steam/sdk32/
echo "---Server ready---"
if [ "${INSTALL_STRACKER}" == "true" ]; then
echo "---Checking if Server is configured properly---"
sed -i '/UDP_PLUGIN_ADDRESS/c\UDP_PLUGIN_ADDRESS=127.0.0.1:12000' ${SERVER_DIR}/cfg/server_cfg.ini
sed -i '/UDP_PLUGIN_LOCAL_PORT/c\UDP_PLUGIN_LOCAL_PORT=11000' ${SERVER_DIR}/cfg/server_cfg.ini
if [ ! -f ${SERVER_DIR}/stracker/stracker_linux_x86/stracker.ini ]; then
cd ${SERVER_DIR}/stracker/stracker_linux_x86
if wget -q -nc --show-progress --progress=bar:force:noscroll -O stracker.ini https://raw.githubusercontent.com/ich777/docker-steamcmd-server/assettocorsa/config/stracker.ini ; then
echo "---Successfully downloaded 'stacker.ini'---"
else
echo "---Something went wrong, can't download 'stacker.ini', putting server in sleep mode---"
sleep infinity
fi
fi
echo "---Checking for old logs---"
find ${SERVER_DIR} -name "AC.log" -exec rm -f {} \;
find ${SERVER_DIR} -name "stracker.log" -exec rm -f {} \;
else
echo "---Server ready---"
sed -i '/UDP_PLUGIN_ADDRESS/c\UDP_PLUGIN_ADDRESS=' ${SERVER_DIR}/cfg/server_cfg.ini
sed -i '/UDP_PLUGIN_LOCAL_PORT/c\UDP_PLUGIN_LOCAL_PORT=0' ${SERVER_DIR}/cfg/server_cfg.ini
fi
chmod -R 770 ${DATA_DIR}
if [ "${INSTALL_ASSETTO_SERVER_MANAGER}" == "true" ]; then
sed -i '/ username:/c\ username:' ${SERVER_DIR}/assetto-server-manager/linux/config.yml
sed -i '/ password:/c\ password:' ${SERVER_DIR}/assetto-server-manager/linux/config.yml
sed -i '/ install_path:/c\ install_path: /serverdata/serverfiles/' ${SERVER_DIR}/assetto-server-manager/linux/config.yml
fi
chmod -R ${DATA_PERM} ${DATA_DIR}
echo "---Start Server---"
${SERVER_DIR}/srcds_run -game ${GAME_NAME} ${GAME_PARAMS} +port ${GAME_PORT}
if [ "${INSTALL_STRACKER}" == "true" ]; then
cd ${SERVER_DIR}
screen -S AssettoCorsa -L -Logfile ${SERVER_DIR}/AC.log -d -m ${SERVER_DIR}/acServer
sleep 10
cd ${SERVER_DIR}/stracker/stracker_linux_x86
screen -S Stracker -L -d -m ${SERVER_DIR}/stracker/stracker_linux_x86/stracker --stracker_ini ${SERVER_DIR}/stracker/stracker_linux_x86/stracker.ini
sleep 2
tail -f ${SERVER_DIR}/AC.log ${SERVER_DIR}/stracker.log
elif [ "${INSTALL_ASSETTO_SERVER_MANAGER}" == "true" ]; then
cd ${SERVER_DIR}/assetto-server-manager/linux
${SERVER_DIR}/assetto-server-manager/linux/server-manager
else
cd ${SERVER_DIR}
${SERVER_DIR}/acServer
fi

41
scripts/start.sh Normal file
View File

@@ -0,0 +1,41 @@
#!/bin/bash
echo "---Ensuring UID: ${UID} matches user---"
usermod -u ${UID} ${USER}
echo "---Ensuring GID: ${GID} matches user---"
groupmod -g ${GID} ${USER} > /dev/null 2>&1 ||:
usermod -g ${GID} ${USER}
echo "---Setting umask to ${UMASK}---"
umask ${UMASK}
echo "---Checking for optional scripts---"
cp -f /opt/custom/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||:
cp -f /opt/scripts/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||:
if [ -f /opt/scripts/start-user.sh ]; then
echo "---Found optional script, executing---"
chmod -f +x /opt/scripts/start-user.sh ||:
/opt/scripts/start-user.sh || echo "---Optional Script has thrown an Error---"
else
echo "---No optional script found, continuing---"
fi
echo "---Taking ownership of data...---"
chown -R root:${GID} /opt/scripts
chmod -R 750 /opt/scripts
chown -R ${UID}:${GID} ${DATA_DIR}
echo "---Starting...---"
term_handler() {
kill -SIGTERM "$killpid"
wait "$killpid" -f 2>/dev/null
exit 143;
}
trap 'kill ${!}; term_handler' SIGTERM
su ${USER} -c "/opt/scripts/start-server.sh" &
killpid="$!"
while true
do
wait $killpid
exit 0;
done