Compare commits

..

No commits in common. "master" and "develop" have entirely different histories.

10 changed files with 41 additions and 136 deletions

View File

@ -1,46 +0,0 @@
# TMSERVER
SERVER_LOGIN=<Dedicated Server Login>
SERVER_LOGIN_PASSWORD=
VALIDATION_KEY=
SERVER_SA_PASSWORD=
SERVER_ADM_PASSWORD=
SERVER_PORT=2350
SERVER_P2P_PORT=3450
SERVER_NAME=Trackmania Server
SERVER_COMMENT=This is a Trackmania Server
SERVER_PASSWORD=
HIDE_SERVER=0
MAX_PLAYERS=32
PACKMASK=stadium
GAMEMODE=1
CHATTIME=10000
FINISHTIMEOUT=1
DISABLERESPAWN=0
ROUNDS_POINTSLIMIT=30
TIMEATTACK_LIMIT=180000
TEAM_POINTSLIMIT=50
TEAM_MAXPOINTS=6
LAPS_NBLAPS=5
LAPS_TIMELIMIT=0
CUP_POINTSLIMIT=100
CUP_ROUNDSPERCHALLENGE=5
CUP_NBWINNERS=3
CUP_WARMUPDURATION=2
CUSTOM_PLAYLIST=
# XASECO
MASTERADMIN_LOGIN=<Your Login>
MYSQL_HOST=db
MYSQL_LOGIN=trackmania
MYSQL_DATABASE=trackmania
MYSQL_PASSWORD=

View File

@ -1,4 +0,0 @@
MYSQL_ROOT_PASSWORD=
MYSQL_DATABASE=trackmania
MYSQL_USER=trackmania
MYSQL_PASSWORD=

View File

@ -1,7 +1,7 @@
FROM php:5.6-alpine
ARG S6_OVERLAY_VERSION=3.2.0.2
ARG S6_OVERLAY_VERSION=3.1.1.1
RUN apk add --no-cache pwgen gettext xmlstarlet bash xz dos2unix
RUN apk add --no-cache pwgen gettext xmlstarlet bash xz
RUN docker-php-ext-install mysql
COPY tmserver/ /var/lib/tmserver

View File

@ -11,7 +11,7 @@ bundled with XAseco.
### docker-compose
Check the default [`docker-compose.yml`](./docker-compose.yml) to familiarize yourself
Check the default [`docker-compose.yml`](./docker-compose.yml) to familiarize yourself
with a possible setup. Adjust it to your needs and according to the documentation below,
then run
@ -29,15 +29,15 @@ then run
### Optional
```
- SERVER_SA_PASSWORD | Password for SuperAdmin credential
- SERVER_SA_PASSWORD | Password for SuperAdmin credential
-> when left empty will be randomly generated
- SERVER_ADM_PASSWORD | Password for Admin credential
- SERVER_ADM_PASSWORD | Password for Admin credential
-> when left empty will be randomly generated
- SERVER_PORT | Port for server communications -> Default : 2350
- SERVER_P2P_PORT | Port for peer2peer communication -> Default : 3450
- SERVER_NAME | Server name in ingame browser -> Default : "Trackmania Server"
- SERVER_COMMENT | Server description -> Default : "This is a Trackmania Server"
- SERVER_PASSWORD | If you want to secure your server against
- SERVER_PASSWORD | If you want to secure your server against
unwanted logins, set a server password
- HIDE_SERVER | Whether you want your server public or not -> Default : 0 (public)
- MAX_PLAYERS | Max player count -> Default : 32
@ -92,8 +92,8 @@ then run
## Configuration - XAseco
I've taken the freedom to ease the MySQL configuration a bit.
Other plugins still need to be configured fully.
I've taken the freedom to ease the MySQL configuration a bit.
Other plugins still need to be configured fully.
Acquire the necessary files and follow the guide to custom configurations below.
### Mandatory
@ -108,7 +108,7 @@ Acquire the necessary files and follow the guide to custom configurations below.
- MYSQL_HOST | Host of MySQL database -> Default : db
- MYSQL_LOGIN | Username of MySQL database -> Default : trackmania
- MYSQL_PASSWORD (Mandatory) | Password of MySQL user
- MYSQL_DATABASE | Name of MySQL database -> Default : trackmania
- MYSQL_DATABASE | Name of MySQL database -> Default : trackmania
```
## Customization
@ -133,11 +133,10 @@ in the `tracks/` folder and mounting it to `/var/lib/tmserver/GameData/Tracks/Cu
### Custom Playlist
You can add tracks to a playlist in a simple way.
You can add tracks to a playlist in a simple way.
Create a plaintext file like in the example below and mount it to `/var/lib/tmserver/playlist.txt`.
To enable parsing of this file set `CUSTOM_PLAYLIST` in your env-file to anything but an empty string.
The tracks for the server are stored relative to `/var/lib/tmserver/GameData/Tracks`.
The tracks for the server are stored relative to `/var/lib/tmserver/GameData/Tracks`.
Creating your own playlist is as easy as specifying each track on a separate line in the `playlist.txt`
by its relative path to the `Tracks` folder.
@ -159,60 +158,27 @@ Custom/mini01.Challenge.Gbx
Custom/SpeedxZxZ.Challenge.Gbx
```
---
**NOTE**
When mounting your own `playlist.xml` file to the container you overwrite a lot of
customization options that usually would be parsed from environment variables.
```xml
<gameinfos>
<game_mode>@GAMEMODE@</game_mode>
<chat_time>@CHATTIME@</chat_time>
<finishtimeout>@FINISHTIMEOUT@</finishtimeout>
<disablerespawn>@DISABLERESPAWN@</disablerespawn>
<rounds_pointslimit>@ROUNDS_POINTSLIMIT@</rounds_pointslimit>
<team_pointslimit>@TEAM_POINTSLIMIT@</team_pointslimit>
<team_maxpoints>@TEAM_MAXPOINTS@</team_maxpoints>
<timeattack_limit>@TIMEATTACK_LIMIT@</timeattack_limit>
<timeattack_synchstartperiod>0</timeattack_synchstartperiod>
<laps_nblaps>@LAPS_NBLAPS@</laps_nblaps>
<laps_timelimit>@LAPS_TIMELIMIT@</laps_timelimit>
<cup_pointslimit>@CUP_POINTSLIMIT@</cup_pointslimit>
<cup_roundsperchallenge>@CUP_ROUNDSPERCHALLENGE@</cup_roundsperchallenge>
<cup_nbwinners>@CUP_NBWINNERS@</cup_nbwinners>
<cup_warmupduration>@CUP_WARMUPDURATION@</cup_warmupduration>
</gameinfos>
```
If you're familiar with these options anyway, you can mount `playlist.xml` to
`/var/lib/tmserver/GameData/MatchSettings/playlist.xml` and use it as a complete
and persistent configuration file that can be written to by plugins or external tools
like RemoteCP.
---
### Custom configuration files
Most plugins need you to provide valid configuration files to function in the first place.
Place these in a folder e.g. `config/` and mount it to `/var/lib/xaseco/config/`.
Most plugins need you to provide valid configuration files to function in the first place.
Place these in a folder e.g. `config/` and mount it to `/var/lib/xaseco/config/`.
All files will be linked to XAseco's root folder.
Careful, this will overwrite exisiting default files and `localdatabase.xml` as well.
### Custom plugins
Custom plugins work similar to configuration files.
Create a folder like `plugins/` and mount it to `/var/lib/xaseco/plugins/custom/`.
Custom plugins work similar to configuration files.
Create a folder like `plugins/` and mount it to `/var/lib/xaseco/plugins/custom/`.
They will be linked down to the plugins folder.
### Plugin blacklist
Create a file called `blacklist.txt` and list plugins by filename that you want ignored on
XAseco's boot.
Mount this file at `/var/lib/xaseco/blacklist.txt`.
Create a file called `blacklist` and list plugins by filename that you want ignored on
XAseco's boot.
Mount this file at `/var/lib/xaseco/blacklist`.
blacklist.txt:
blacklist:
```
jfreu.chat.php
jfreu.plugin.php

View File

@ -1,6 +1,7 @@
version: '3.8'
services:
tmserver:
image: fanyx/tmserver:2.2.1
image: fanyx/tmserver:2.0.5
container_name: trackmania_tmserver
depends_on:
- db
@ -9,7 +10,7 @@ services:
volumes:
- ./tracks:/var/lib/tmserver/GameData/Tracks/Challenges/Custom # => Custom tracks
- ./playlist.txt:/var/lib/tmserver/playlist.txt # => Custom playlist
- ./blacklist.txt:/var/lib/xaseco/blacklist.txt # => Plugin blacklis1
- ./blacklist:/var/lib/xaseco/blacklist # => Plugin blacklist
- ./plugins:/var/lib/xaseco/plugins/custom # => Custom plugins
- ./config:/var/lib/xaseco/config # => Custom configuration files
ports:

View File

@ -15,13 +15,13 @@
<password>User</password>
</level>
</authorization_levels>
<masterserver_account>
<login>@SERVER_LOGIN@</login>
<password>@SERVER_LOGIN_PASSWORD@</password>
<validation_key>@VALIDATION_KEY@</validation_key>
</masterserver_account>
<server_options>
<name>@SERVER_NAME@</name>
<comment>@SERVER_COMMENT@</comment>
@ -29,17 +29,17 @@
<max_players>@MAX_PLAYERS@</max_players>
<password>@SERVER_PASSWORD@</password>
<max_spectators>32</max_spectators>
<password_spectator></password_spectator>
<ladder_mode>forced</ladder_mode> <!-- value between 'inactive', 'forced' (or '0', '1') -->
<ladder_serverlimit_min>0</ladder_serverlimit_min> <!-- Those values will be clamped to the limits authorized on http://official.trackmania.com/tmf-ladderserver/ -->
<ladder_serverlimit_max>50000</ladder_serverlimit_max>
<ladder_serverlimit_max>50000</ladder_serverlimit_max>
<enable_p2p_upload>True</enable_p2p_upload>
<enable_p2p_download>True</enable_p2p_download>
<callvote_timeout>60000</callvote_timeout>
<callvote_ratio>0.5</callvote_ratio> <!-- default ratio. value in [0..1], or -1 to forbid. -->
<callvote_ratios>
@ -56,27 +56,27 @@
<use_changing_validation_seed>False</use_changing_validation_seed>
</server_options>
<system_config>
<connection_uploadrate>512</connection_uploadrate> <!-- Kbps (kilo bits per second) -->
<connection_downloadrate>8192</connection_downloadrate> <!-- Kbps -->
<force_ip_address>@FORCE_IP_ADDRESS@</force_ip_address>
<force_ip_address></force_ip_address>
<server_port>@SERVER_PORT@</server_port>
<server_p2p_port>@SERVER_P2P_PORT@</server_p2p_port>
<client_port>0</client_port>
<bind_ip_address></bind_ip_address>
<use_nat_upnp></use_nat_upnp>
<p2p_cache_size>600</p2p_cache_size>
<xmlrpc_port>5000</xmlrpc_port>
<xmlrpc_allowremote>True</xmlrpc_allowremote> <!-- If you specify an ip adress here, it'll be the only accepted adress. this will improve security. -->
<blacklist_url></blacklist_url>
<guestlist_filename></guestlist_filename>
<blacklist_filename></blacklist_filename>
<packmask>@PACKMASK@</packmask>
<allow_spectator_relays>False</allow_spectator_relays>

View File

@ -10,7 +10,6 @@ SERVER_LOGIN_PASSWORD=${SERVER_LOGIN_PASSWORD?:ERROR | ServerLoginPassword is mi
config+=( "SERVER_LOGIN_PASSWORD" )
# Optional
VALIDATION_KEY=${VALIDATION_KEY:-} && config+=( "VALIDATION_KEY" )
SERVER_SA_PASSWORD=${SERVER_SA_PASSWORD:-$(pwgen -s 24 1)} && config+=( "SERVER_SA_PASSWORD" )
echo "INFO | SERVER_SA_PASSWORD: ${SERVER_SA_PASSWORD}"
SERVER_ADM_PASSWORD=${SERVER_ADM_PASSWORD:-$(pwgen -s 24 1)} && config+=( "SERVER_ADM_PASSWORD" )
@ -19,8 +18,6 @@ SERVER_PORT=${SERVER_PORT:-2350} && config+=( "SERVER_PORT" )
echo "INFO | SERVER_PORT: ${SERVER_PORT}"
SERVER_P2P_PORT=${SERVER_P2P_PORT:-3450} && config+=( "SERVER_P2P_PORT" )
echo "INFO | SERVER_P2P_PORT: ${SERVER_P2P_PORT}"
FORCE_IP_ADDRESS=${FORCE_IP_ADDRESS:-${curl https://api.ipify.org}} && config += ( "FORCE_IP_ADDRESS" )
echo "INFO | FORCE_IP_ADDRESS: ${FORCE_IP_ADDRESS}"
SERVER_NAME=${SERVER_NAME:-Trackmania Server} && config+=( "SERVER_NAME" )
echo "INFO | SERVER_NAME: ${SERVER_NAME}"
SERVER_COMMENT=${SERVER_COMMENT:-This is a Trackmania Server} && config+=( "SERVER_COMMENT" )
@ -74,4 +71,4 @@ done
for idx in "${!playlist[@]}"; do
arg=${playlist[$idx]}
sed -i -e "s/@$arg@/${!arg}/g" GameData/Tracks/MatchSettings/playlist.xml
done
done

View File

@ -2,23 +2,19 @@
echo "INFO | Parsing custom playlist..."
[[ -z "${CUSTOM_PLAYLIST}" ]] && \
echo "INFO | Custom Playlist is not enabled, keeping default or user-edited playlist" && \
exit 0
PLAYLIST_PATH=${PLAYLIST_PATH:-playlist.txt}
CUSTOM_PLAYLIST=${CUSTOM_PLAYLIST:-playlist.txt}
PLAYLIST_FILE='GameData/Tracks/MatchSettings/playlist.xml'
if [[ -f "${PLAYLIST_PATH}" ]]; then
if [[ -f "${CUSTOM_PLAYLIST}" ]]; then
count=1
while read l; do
xmlstarlet ed -L -s /playlist -t elem -n challenge $PLAYLIST_FILE
xmlstarlet ed -L -s "/playlist/challenge[${count}]" -t elem -n file -v "${l}" $PLAYLIST_FILE
count=$((count+1))
done < $PLAYLIST_PATH
done < $CUSTOM_PLAYLIST
else
xmlstarlet ed -L -s /playlist -t elem -n challenge $PLAYLIST_FILE
xmlstarlet ed -L -s "playlist/challenge[1]" -t elem -n file -v "Challenges/Nadeo/A01-Race.Challenge.Gbx" $PLAYLIST_FILE
fi
echo "INFO | Finished parsing playlist files"
echo "INFO | Finished parsing playlist files."

View File

@ -14,11 +14,8 @@ fi
PLUGINS_LIST=($(ls -d plugins/*.php | sed -e 's/plugins\///g'))
[[ -r ./blacklist.txt ]] && {
BLACKLIST=($(cat ./blacklist.txt | tr '\r' ' ' | tr '\n' ' '))
PLUGINS_LIST=($(echo "${PLUGINS_LIST[@]}" | tr ' ' '\n' |\
grep -vf <(echo "${BLACKLIST[@]}" | tr ' ' '\n')))
}
[[ -r ./blacklist ]] && \
PLUGINS_LIST=($(echo ${PLUGINS_LIST[@]} | tr ' ' '\n' | grep -vFf blacklist))
{
# open with header -- \n interpreted
@ -33,7 +30,7 @@ PLUGINS_LIST=($(ls -d plugins/*.php | sed -e 's/plugins\///g'))
"plugin.localdatabase.php")
;;
"plugin.records_eyepiece.php")
;;
;;
*)
printf " <plugin>%s</plugin>\n" "${plugin}"
;;

View File

@ -1,2 +0,0 @@
jfreu.lite.php
jfreu.chat.php