push multi version for wow server
This commit is contained in:
		
							parent
							
								
									ca8eb8b36e
								
							
						
					
					
						commit
						ac84a68f69
					
				
							
								
								
									
										126
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										126
									
								
								README.md
									
									
									
									
									
								
							| @ -1,115 +1,41 @@ | ||||
| # WORLD OF WARCRAFT SERVER INSTALL (VERSION 1.12) | ||||
| # wow private server | ||||
| 
 | ||||
| ## PRE REQUIS | ||||
| ## Versions prises en charge | ||||
| 
 | ||||
| - debian 12 | ||||
| - user wow | ||||
| - ports: | ||||
|   - TCP: 3724, 8085 | ||||
|   - UDP: 3724, 8085 | ||||
| 
 | ||||
| - WOW 1.12 client: https://drive.usercontent.google.com/download?id=1TDoNNUXCtsgIUhLw96biPCqjv3AcLYkg&export=download | ||||
| ## Pre requis | ||||
| 
 | ||||
| ## CONFIG | ||||
| - Clients: | ||||
| |                  Game name                 | Game version |  Keyword  | | ||||
| |--------------------------------------------|--------------|-----------| | ||||
| |             World of Warcraft®             |  **v1.12.x** | `classic` | | ||||
| |   World of Warcraft: The Burning Crusade®  |  **v2.4.3**  |   `tbc`   | | ||||
| | World of Warcraft: Wrath of the Link King® |  **v3.3.5a** |  `wotlk`  | | ||||
| 
 | ||||
| - Mettre en place les données du server: | ||||
| - Docker | ||||
| 
 | ||||
| ## Configuration | ||||
| 
 | ||||
| - .env path to wow client | ||||
| 
 | ||||
| ## Installation | ||||
| 
 | ||||
| - Extraire les maps du client: | ||||
| ```bash | ||||
| wget https://www.mediafire.com/file_premium/j6cyqjeif3dvrv2/data.7z | ||||
| 7z x data.7z | ||||
| rm -r data.7z | ||||
| mv data/ storage/mangosd/extracted-data/ | ||||
| ./builder/run.sh extract | ||||
| ``` | ||||
| 
 | ||||
| - Modifier l'IP du server: | ||||
| > Choisir l'import en HD avec le plus de CPU possible car c'est long | ||||
| 
 | ||||
| - Lançer la base de données: | ||||
| ```bash | ||||
| nano compose.yml | ||||
| docker compose up wow-db | ||||
| ``` | ||||
| 
 | ||||
| ## LANCER LA STACK | ||||
| 
 | ||||
| - Dans un autre terminal, lançer le script d'import des données du jeu: | ||||
| ```bash | ||||
| docker compose up -d | ||||
| ./builder/run.sh init-db | ||||
| ``` | ||||
| 
 | ||||
| ## CREER UN UTILISATEURS | ||||
| > Patienter le temps de la mise en place de la base de données | ||||
| 
 | ||||
| Lancer le service mangosd: | ||||
| ```bash | ||||
| docker attach vmangos-deploy-mangosd-1 | ||||
| ``` | ||||
| 
 | ||||
| - Créer un utilisateur: | ||||
| ```bash | ||||
| account create <username> <password> | ||||
| ``` | ||||
| 
 | ||||
| [autres commandes](https://github.com/dkpminus/mangos-gm-commands) | ||||
| 
 | ||||
| ## PROTEGER LE SERVEUR VIA FAIL2BAN | ||||
| 
 | ||||
| - Installer fail2ban: | ||||
| ```bash | ||||
| sudo apt install fail2ban -y | ||||
| ``` | ||||
| 
 | ||||
| - Créer `/etc/fail2ban/filter.d/realmd.conf`: | ||||
| ```conf | ||||
| [Definition] | ||||
| failregex = \[AuthChallenge\] Account '.*' using IP '<HOST>' tried to login with wrong password! | ||||
| ignoreregex = | ||||
| ``` | ||||
| 
 | ||||
| - Créer `/etc/fail2ban/jail.local`: | ||||
| 
 | ||||
| ```conf | ||||
| [realmd] | ||||
| enabled  = true | ||||
| filter   = realmd | ||||
| port     = 3724 | ||||
| protocol = tcp | ||||
| logpath  = /home/wow/vmangos/logs/realmd/realmd.log | ||||
| maxretry = 5 | ||||
| findtime = 600 | ||||
| bantime  = 36000 | ||||
| ``` | ||||
| 
 | ||||
| - Redémarrer fail2ban: | ||||
| ```bash | ||||
| sudo systemctl restart fail2ban | ||||
| sudo fail2ban-client reload | ||||
| ``` | ||||
| 
 | ||||
| ## SE CONNECTER AU SERVEUR | ||||
| 
 | ||||
| - Télécharger le [client (v1.12)](https://drive.usercontent.google.com/download?id=1TDoNNUXCtsgIUhLw96biPCqjv3AcLYkg&export=download) | ||||
| 
 | ||||
| - Editer le fichier `realmlist.wtf` pour y mettre l'IP du serveur: | ||||
| ```bash | ||||
| set <server_ip> | ||||
| ``` | ||||
| 
 | ||||
| ## BACKUP DATABASE ET RESTORE | ||||
| 
 | ||||
| - Exporter la base de données: | ||||
| ```bash | ||||
| docker exec nom_du_conteneur_db mysqldump -u root -pMOTDEPASS --databases realmd mangos characters logs > wow-db-dump.sql | ||||
| ``` | ||||
| 
 | ||||
| - Importer la base de données: | ||||
| ```bash | ||||
| docker cp wow-db-dump.sql <database_container>:/ | ||||
| docker exec -it <database_container> bash | ||||
| apt update && apt install -y mysql-client | ||||
| mysql -u root -ppassword < wow-db-dump.sql | ||||
| ``` | ||||
| 
 | ||||
| ## SOURCES | ||||
| 
 | ||||
| - [vmangos](https://github.com/vmangos) | ||||
| - [tuto](https://www.youtube.com/watch?v=ac1mVFz2u1o) | ||||
| - [docker version](https://github.com/mserajnik/vmangos-deploy) | ||||
| 
 | ||||
| ## TO DO  | ||||
| 
 | ||||
| - [ ] jail for realmd port | ||||
| - [ ] Server IP as env for confs et Dockerfiles | ||||
							
								
								
									
										67
									
								
								builder/InstallFullDB.config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								builder/InstallFullDB.config
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,67 @@ | ||||
| #!/usr/bin/env bash | ||||
| # | ||||
| 
 | ||||
| #################################################################################################### | ||||
| # This is the config file for the 'InstallFullDB.sh' script | ||||
| # | ||||
| # You need to customize | ||||
| # MYSQL_HOST: Host on which the database resides | ||||
| # MYSQL_PORT: Port on which the database is running | ||||
| # MYSQL_USERNAME: Your a valid mysql username | ||||
| # MYSQL_PASSWORD: Your corresponding mysql password | ||||
| # MYSQL_PATH: Your mysql command (usually mysql) | ||||
| # WORLD_DB_NAME: Your content database | ||||
| # CORE_PATH: Your path to core's directory | ||||
| # | ||||
| #################################################################################################### | ||||
| 
 | ||||
| ## Define the host on which the mangos database resides (typically localhost) | ||||
| MYSQL_HOST="${MANGOS_DBHOST}" | ||||
| 
 | ||||
| ## Define the port on which the mangos database is running (typically 3306) | ||||
| MYSQL_PORT="${MANGOS_DBPORT}" | ||||
| 
 | ||||
| ## Define your username | ||||
| MYSQL_USERNAME="${MANGOS_DBUSER}" | ||||
| 
 | ||||
| ## Define your password (It is suggested to restrict read access to this file!) | ||||
| MYSQL_PASSWORD="${MANGOS_DBPASS}" | ||||
| 
 | ||||
| ## Define default mysql address binding(you can set "%" to be able to connect from any computer) | ||||
| MYSQL_USERIP="%" | ||||
| 
 | ||||
| ## Define the databases names (let them empty for default name '<expansion><dbtype>') | ||||
| WORLD_DB_NAME="${MANGOS_WORLD_DBNAME}" | ||||
| REALM_DB_NAME="${MANGOS_REALMD_DBNAME}" | ||||
| CHAR_DB_NAME="${MANGOS_CHARACTERS_DBNAME}" | ||||
| LOGS_DB_NAME="${MANGOS_LOGS_DBNAME}" | ||||
| 
 | ||||
| ## Define your mysql programm if this differs | ||||
| MYSQL_PATH="/usr/bin/mariadb" | ||||
| 
 | ||||
| ## Define the path to your mysql dump binary folder | ||||
| MYSQL_DUMP_PATH="/usr/bin/mariadb-dump" | ||||
| 
 | ||||
| ## Define the path to your core's folder | ||||
| CORE_PATH="${MANGOS_DIR}" | ||||
| 
 | ||||
| ## Define if the 'locales' directory for processing localization/multi-language SQL files needs to be used | ||||
| ## Set the variable to "YES" to use the locales directory | ||||
| LOCALES="YES" | ||||
| 
 | ||||
| ## Define if you want to wait a bit before applying the full database | ||||
| FORCE_WAIT="NO" | ||||
| 
 | ||||
| ## Define if the 'dev' directory for processing development SQL files needs to be used | ||||
| ## Set the variable to "YES" to use the dev directory | ||||
| DEV_UPDATES="NO" | ||||
| 
 | ||||
| ## Define if AHBot SQL updates need to be applied (by default, assume the core is built without AHBot) | ||||
| ## Set the variable to "YES" to import AHBot sql. | ||||
| AHBOT="NO" | ||||
| 
 | ||||
| ## Define if the 'src/modules/PlayerBots/sql' directory for processing development SQL files needs to be used | ||||
| ## Set the variable to "YES" to use the playerbots directory | ||||
| PLAYERBOTS_DB="NO" | ||||
| 
 | ||||
| # Enjoy using the tool | ||||
							
								
								
									
										430
									
								
								builder/entrypoint.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										430
									
								
								builder/entrypoint.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,430 @@ | ||||
| #!/usr/bin/env bash | ||||
| # | ||||
| 
 | ||||
| readonly SCRIPT_VERSION="1.0.0" | ||||
| 
 | ||||
| set -e | ||||
| 
 | ||||
| # Utils: | ||||
| # | ||||
| function echoerr() | ||||
| { | ||||
|     echo ${@} >&2 | ||||
| } | ||||
| 
 | ||||
| function success() | ||||
| { | ||||
|     echo -e "\e[32m${1}\e[0m" | ||||
| } | ||||
| function info() | ||||
| { | ||||
|     echo -e "\e[36m${1}\e[0m" | ||||
| } | ||||
| function warning() | ||||
| { | ||||
|     if [[ "${2}" == "--underline" ]] | ||||
|     then | ||||
|         echo -e "\e[4;33m${1}\e[0m" | ||||
|     else | ||||
|         echo -e "\e[33m${1}\e[0m" | ||||
|     fi | ||||
| } | ||||
| function error() | ||||
| { | ||||
|     if [[ "${2}" == "--underline" ]] | ||||
|     then | ||||
|         echo -e "\e[4;31m${1}\e[0m" | ||||
|     else | ||||
|         echo -e "\e[31m${1}\e[0m" | ||||
|     fi | ||||
| } | ||||
| 
 | ||||
| function mysql_execute() | ||||
| { | ||||
|     mariadb "-h${MANGOS_DBHOST}" "-P${MANGOS_DBPORT}" "-u${MYSQL_SUPERUSER}" "-p${MYSQL_SUPERPASS}" ${@} | ||||
| } | ||||
| function mysql_dump() | ||||
| { | ||||
|     local DATABASE_NAME="${1}" | ||||
|     local OUTPUT_FILE="${2}" | ||||
| 
 | ||||
|     mariadb-dump "-h${MANGOS_DBHOST}" "-P${MANGOS_DBPORT}" "-u${MYSQL_SUPERUSER}" "-p${MYSQL_SUPERPASS}" \ | ||||
|         "${DATABASE_NAME}" --opt --result-file="${OUTPUT_FILE}" | ||||
| } | ||||
| 
 | ||||
| # Sub-functions: | ||||
| # | ||||
| function install_updates() | ||||
| { | ||||
|     cd "${DATABASE_DIR}" | ||||
| 
 | ||||
|     ./InstallFullDB.sh -UpdateCore | ||||
| 
 | ||||
|     if [[ "${1}" == "--world" ]] | ||||
|     then | ||||
|         ./InstallFullDB.sh -World | ||||
|     fi | ||||
| } | ||||
| 
 | ||||
| # Main functions: | ||||
| # | ||||
| function extract_resources_from_client() | ||||
| { | ||||
|     cd "${VOLUME_DIR}" | ||||
| 
 | ||||
|     if [[ -f ".resext" ]] || [[ $(ls | grep -c -E "Cameras|dbc|maps|mmaps|vmaps") -gt 0 ]] | ||||
|     then | ||||
|         echo "" | ||||
|         echo -e " $(warning "WARNING!" --underline)" | ||||
|         echo -e "  $(warning "└") It seems that you've already extracted the resources from the client before." | ||||
|         echo -e "    If you continue, existing resources will be overwritten by the new ones." | ||||
|         echo "" | ||||
|         read -p "Are you sure to continue? [Y/n]: " ANSWER | ||||
| 
 | ||||
|         if [[ "${ANSWER}" != "y" ]] && [[ "${ANSWER}" != "Y" ]] | ||||
|         then | ||||
|             echo -e " └ Ok, no problem! Resources have been left untouched." | ||||
| 
 | ||||
|             return | ||||
|         fi | ||||
| 
 | ||||
|         rm -rf Cameras/ \ | ||||
|                dbc/ \ | ||||
|                maps/ \ | ||||
|                mmaps/ \ | ||||
|                vmaps/ | ||||
|     fi | ||||
| 
 | ||||
|     cd "${HOME_DIR}/run/bin/tools" | ||||
| 
 | ||||
|     cp * "${HOME_DIR}/wow-client/" | ||||
|     cd "${HOME_DIR}/wow-client" | ||||
| 
 | ||||
|     ./ExtractResources.sh ${@} | ||||
| 
 | ||||
|     mv Cameras "${VOLUME_DIR}/Cameras" | ||||
|     mv dbc "${VOLUME_DIR}/dbc" | ||||
|     mv maps "${VOLUME_DIR}/maps" | ||||
|     mv mmaps "${VOLUME_DIR}/mmaps" | ||||
|     mv vmaps "${VOLUME_DIR}/vmaps" | ||||
| 
 | ||||
|     mkdir -p "${VOLUME_DIR}/logs" | ||||
|     mv *.log "${VOLUME_DIR}/logs/" | ||||
| 
 | ||||
|     rm -rf Buildings/ \ | ||||
|        \ | ||||
|        ExtractResources.sh \ | ||||
|        MoveMapGen \ | ||||
|        MoveMapGen.sh \ | ||||
|        ad \ | ||||
|        offmesh.txt \ | ||||
|        vmap_assembler \ | ||||
|        vmap_extractor | ||||
| 
 | ||||
|     echo "${SCRIPT_VERSION}" > "${VOLUME_DIR}/.resext" | ||||
| } | ||||
| function init_db() | ||||
| { | ||||
|     cd "${DATABASE_DIR}" | ||||
| 
 | ||||
|     echo "" | ||||
|     echo "This procedure will create all the databases required by the server" | ||||
|     echo " to run properly and will initialize them with the default data." | ||||
|     echo "" | ||||
|     echo -e " $(warning "WARNING!" --underline)" | ||||
|     echo -e "  $(warning "└") Please note that, if you have already initialized the databases before," | ||||
|                  echo -e "     this procedure will prune $(info "ALL") of your data and" | ||||
|                  echo -e "     they will be lost $(info "FOREVER") (it's a very long time)!" | ||||
|     echo "" | ||||
|     read -p "Are you sure to continue? [Y/n]: " ANSWER | ||||
| 
 | ||||
|     if [[ "${ANSWER}" != "y" ]] && [[ "${ANSWER}" != "Y" ]] | ||||
|     then | ||||
|         echo -e " └ Ok, no problem! Databases have been left untouched." | ||||
| 
 | ||||
|         return | ||||
|     fi | ||||
| 
 | ||||
|     echo -e " └ Please, wait... Initializing databases..." | ||||
|     echo "" | ||||
|     echo -e " --------------------------------------" | ||||
| 
 | ||||
|     ./InstallFullDB.sh -InstallAll "${MYSQL_SUPERUSER}" "${MYSQL_SUPERPASS}" DeleteAll | ||||
| } | ||||
| function backup_db() | ||||
| { | ||||
|     readonly HELP_MSG=" | ||||
| Backups the specified database(s) and then returns the | ||||
|  result as a single \"tar.gz\" file via standard output. | ||||
| 
 | ||||
| Usage: | ||||
|     backup-db [OPTIONS...] | ||||
| 
 | ||||
| Options: | ||||
|     -a | --all | ||||
|         Backups all databases. | ||||
| 
 | ||||
|     -w | --world | ||||
|         Backups the world database: \"$(info "${MANGOS_WORLD_DBNAME}")\". | ||||
| 
 | ||||
|     -c | --characters | ||||
|         Backups the characters database: \"$(info "${MANGOS_CHARACTERS_DBNAME}")\". | ||||
| 
 | ||||
|     -l | --logs | ||||
|         Backups the logs database: \"$(info "${MANGOS_LOGS_DBNAME}")\". | ||||
| 
 | ||||
|     -r | --realmd | ||||
|         Backups the realmd database: \"$(info "${MANGOS_REALMD_DBNAME}")\". | ||||
| 
 | ||||
|     -h | -? | --help | ||||
|         Displays this help message. | ||||
| " | ||||
| 
 | ||||
|     declare -A DATABASES | ||||
| 
 | ||||
|     while [[ ${#} -gt 0 ]] | ||||
|     do | ||||
|         case "${1}" in | ||||
|             -a | --all) | ||||
|                 readonly BACKUPS_ALL="true" | ||||
|                 ;; | ||||
|             -w | --world) | ||||
|                 DATABASES+=(["world"]="${MANGOS_WORLD_DBNAME}") | ||||
|                 ;; | ||||
|             -c | --characters) | ||||
|                 DATABASES+=(["characters"]="${MANGOS_CHARACTERS_DBNAME}") | ||||
|                 ;; | ||||
|             -l | --logs) | ||||
|                 DATABASES+=(["logs"]="${MANGOS_LOGS_DBNAME}") | ||||
|                 ;; | ||||
|             -r | --realmd) | ||||
|                 DATABASES+=(["realmd"]="${MANGOS_REALMD_DBNAME}") | ||||
|                 ;; | ||||
|             -h | -? | --help) | ||||
|                 echo -e "${HELP_MSG}" | ||||
| 
 | ||||
|                 exit 0 | ||||
|                 ;; | ||||
|             *) | ||||
|                 echoerr "" | ||||
|                 echoerr -e " $(error "ERROR!" --underline)" | ||||
|                 echoerr -e "  $(error "└") Unknown option: \"$(info "${1}")\"" | ||||
|                 echoerr "" | ||||
|                 echoerr " Run \"$(info "backup-db --help")\" for more information." | ||||
| 
 | ||||
|                 exit 1 | ||||
|                 ;; | ||||
|         esac | ||||
| 
 | ||||
|         shift | ||||
|     done | ||||
| 
 | ||||
|     if [[ "${BACKUPS_ALL}" == "true" ]] | ||||
|     then | ||||
|         if [[ -n ${DATABASES[@]} ]] | ||||
|         then | ||||
|             echoerr "" | ||||
|             echoerr -e " $(error "ERROR!" --underline)" | ||||
|             echoerr -e "  $(error "└") You cannot specify both \"$(info "--all")\" and any other" | ||||
|             echoerr -e "     specific database options at the same time." | ||||
|             echoerr "" | ||||
|             echoerr " Run \"$(info "backup-db --help")\" for more information." | ||||
| 
 | ||||
|             exit 2 | ||||
|         fi | ||||
| 
 | ||||
|         DATABASES=(["world"]="${MANGOS_WORLD_DBNAME}" \ | ||||
|                    ["characters"]="${MANGOS_CHARACTERS_DBNAME}" \ | ||||
|                    ["logs"]="${MANGOS_LOGS_DBNAME}" \ | ||||
|                    ["realmd"]="${MANGOS_REALMD_DBNAME}") | ||||
|     fi | ||||
|     if [[ -z ${DATABASES[@]} ]] | ||||
|     then | ||||
|         echoerr "" | ||||
|         echoerr -e " $(error "ERROR!" --underline)" | ||||
|         echoerr -e "  $(error "└") You must specify at least one database to backup." | ||||
|         echoerr "" | ||||
|         echoerr " Run \"$(info "backup-db --help")\" for more information." | ||||
| 
 | ||||
|         exit 3 | ||||
|     fi | ||||
| 
 | ||||
|     local TIMESTAMP="$(date +"%Y-%m-%d_%H-%M-%S")" | ||||
|     local BACKUP_DIR="/home/mangos/data/backups/${TIMESTAMP}" | ||||
|     local BACKUP_FILE="${BACKUP_DIR}/backup_${TIMESTAMP}.tar.gz" | ||||
| 
 | ||||
|     mkdir -p "${BACKUP_DIR}" | ||||
| 
 | ||||
|     for DATABASE in ${!DATABASES[@]} | ||||
|     do | ||||
|         local DATABASE_NAME="${DATABASES["${DATABASE}"]}" | ||||
|         local OUTPUT_FILENAME="${DATABASE}.sql" | ||||
| 
 | ||||
|         mysql_dump "${DATABASE_NAME}" "${BACKUP_DIR}/${OUTPUT_FILENAME}" | ||||
|     done | ||||
| 
 | ||||
|     cd "${BACKUP_DIR}" | ||||
| 
 | ||||
|     echo "${SCRIPT_VERSION}" > .version | ||||
|     tar -czvf "${BACKUP_FILE}" .version $(ls *.sql | xargs -n 1) > /dev/null | ||||
| 
 | ||||
|     cat "${BACKUP_FILE}" | ||||
| } | ||||
| function manage_db() | ||||
| { | ||||
|     cd "${DATABASE_DIR}" | ||||
| 
 | ||||
|     ./InstallFullDB.sh | ||||
| } | ||||
| function restore_db() | ||||
| { | ||||
|     local TIMESTAMP="$(date +"%Y-%m-%d_%H-%M-%S")" | ||||
|     local TEMP_DIR="${TMPDIR}/${TIMESTAMP}" | ||||
|     local BACKUP_FILE="${TEMP_DIR}/backup_${TIMESTAMP}.tar.gz" | ||||
| 
 | ||||
|     mkdir -p "${TEMP_DIR}" | ||||
|     cat - > "${BACKUP_FILE}" | ||||
| 
 | ||||
|     cd "${TEMP_DIR}" | ||||
| 
 | ||||
|     tar -xzvf "${BACKUP_FILE}" -C . > /dev/null | ||||
| 
 | ||||
|     local BACKUP_FILES=($(ls *.sql | xargs -n 1)) | ||||
| 
 | ||||
|     for BACKUP_FILE in ${BACKUP_FILES[@]} | ||||
|     do | ||||
|         local DATABASE="${BACKUP_FILE%.sql}" | ||||
| 
 | ||||
|         if [[ "${DATABASE}" == "world" ]] | ||||
|         then | ||||
|             local DATABASE_NAME="${MANGOS_WORLD_DBNAME}" | ||||
|         elif [[ "${DATABASE}" == "characters" ]] | ||||
|         then | ||||
|             local DATABASE_NAME="${MANGOS_CHARACTERS_DBNAME}" | ||||
|         elif [[ "${DATABASE}" == "logs" ]] | ||||
|         then | ||||
|             local DATABASE_NAME="${MANGOS_LOGS_DBNAME}" | ||||
|         elif [[ "${DATABASE}" == "realmd" ]] | ||||
|         then | ||||
|             local DATABASE_NAME="${MANGOS_REALMD_DBNAME}" | ||||
|         fi | ||||
| 
 | ||||
|         mysql_execute "${DATABASE_NAME}" < "${TEMP_DIR}/${BACKUP_FILE}" | ||||
|     done | ||||
| } | ||||
| function update_db() | ||||
| { | ||||
|     readonly HELP_MSG=" | ||||
| Updates databases by applying the latest changes | ||||
|  to the database structure and default data. | ||||
| Dy default, this is a non-destructive procedure, | ||||
|  so any custom data you may have loaded into | ||||
|  your \"$(info "${MANGOS_WORLD_DBNAME}")\" database will remain intact. | ||||
| 
 | ||||
| Unfortunately, however, sometimes this plain update procedure | ||||
|  isn't enough to apply all the changes required by | ||||
|  the new version of the server to run properly. | ||||
| In these cases, you can use the \"$(info "--world")\" option to | ||||
|  perform a \"deeper\" update procedure to solve the issue. | ||||
| 
 | ||||
| Please note that this more \"aggressive\" update procedure | ||||
|  will prune any custom data from the \"$(info "${MANGOS_WORLD_DBNAME}")\" database | ||||
|  and will restore the default data shipped with the server. | ||||
| If, however, you use an original version of the database | ||||
|  and have never customized any data, you can safely use | ||||
|  this option without any fear. No data will be lost. | ||||
| 
 | ||||
| Usage: | ||||
|     update-db [OPTIONS...] | ||||
| 
 | ||||
| Options: | ||||
|     -w | --world | ||||
|         Updates the world database: \"$(info "${MANGOS_WORLD_DBNAME}")\". | ||||
| 
 | ||||
|     -h | -? | --help | ||||
|         Displays this help message. | ||||
| " | ||||
|     if [[ -n "${1}" ]] | ||||
|     then | ||||
|         case "${1}" in | ||||
|             -w | --world) | ||||
|                 echo "" | ||||
|                 echo -e " $(warning "WARNING!" --underline)" | ||||
|                 echo -e "  $(warning "└") This procedure will prune all custom data you" | ||||
|                 echo -e "     may have loaded into your \"$(info "${MANGOS_WORLD_DBNAME}")\" database." | ||||
|                 echo "" | ||||
|                 read -p "Are you sure to continue? [Y/n]: " ANSWER | ||||
| 
 | ||||
|                 if [[ "${ANSWER}" != "y" ]] && [[ "${ANSWER}" != "Y" ]] | ||||
|                 then | ||||
|                     echo -e " └ Ok, no problem! Database have been left untouched." | ||||
| 
 | ||||
|                     return | ||||
|                 fi | ||||
| 
 | ||||
|                 echo -e " └ Please, wait... Updating database..." | ||||
|                 echo "" | ||||
|                 echo -e " --------------------------------------" | ||||
| 
 | ||||
|                 install_updates --world | ||||
| 
 | ||||
|                 ;; | ||||
|             -h | -? | --help) | ||||
|                 echo -e "${HELP_MSG}" | ||||
| 
 | ||||
|                 exit 0 | ||||
|                 ;; | ||||
|             *) | ||||
|                 echoerr "" | ||||
|                 echoerr -e " $(error "ERROR!" --underline)" | ||||
|                 echoerr -e "  $(error "└") Unknown option: \"$(info "${1}")\"" | ||||
|                 echoerr "" | ||||
|                 echoerr " Run \"$(info "update-db --help")\" for more information." | ||||
| 
 | ||||
|                 exit 1 | ||||
|                 ;; | ||||
|         esac | ||||
|     else | ||||
|         install_updates | ||||
|     fi | ||||
| } | ||||
| 
 | ||||
| # Execution: | ||||
| # | ||||
| case "${1}" in | ||||
|     extract) | ||||
|         shift | ||||
| 
 | ||||
|         extract_resources_from_client ${@} | ||||
|         ;; | ||||
|     init-db) | ||||
|         shift | ||||
| 
 | ||||
|         init_db | ||||
|         ;; | ||||
|     backup-db) | ||||
|         shift | ||||
| 
 | ||||
|         backup_db ${@} | ||||
|         ;; | ||||
|     restore-db) | ||||
|         shift | ||||
| 
 | ||||
|         restore_db ${@} | ||||
|         ;; | ||||
|     manage-db) | ||||
|         shift | ||||
| 
 | ||||
|         manage_db | ||||
|         ;; | ||||
|     update-db) | ||||
|         shift | ||||
| 
 | ||||
|         update_db ${@} | ||||
|         ;; | ||||
|     *) | ||||
|         cd "${HOME_DIR}" | ||||
| 
 | ||||
|         exec ${@} | ||||
|         ;; | ||||
| esac | ||||
							
								
								
									
										35
									
								
								builder/run.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										35
									
								
								builder/run.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,35 @@ | ||||
| #!/usr/bin/env bash | ||||
| # | ||||
| 
 | ||||
| set -e | ||||
| 
 | ||||
| readonly BASE_DIR="$(realpath "$(dirname "${0}")/..")" | ||||
| source "${BASE_DIR}/.env" | ||||
| 
 | ||||
| readonly NAME="cmangos-builder" | ||||
| readonly IMAGE="ghcr.io/byloth/cmangos/${WOW_VERSION}/builder" | ||||
| readonly VERSION="latest" | ||||
| 
 | ||||
| readonly DATA_VOLUME="./mangosd_data" | ||||
| readonly NETWORK="wow" | ||||
| 
 | ||||
| if [[ -t 0 ]] && [[ -t 1 ]] | ||||
| then | ||||
|     readonly TTY="-it" | ||||
| else | ||||
|     readonly TTY="-i" | ||||
| fi | ||||
| 
 | ||||
| docker run ${TTY} \ | ||||
|            --name "${NAME}" \ | ||||
|            --network "${NETWORK}" \ | ||||
|            --rm \ | ||||
|            -e MYSQL_SUPERUSER="root" \ | ||||
|            -e MYSQL_SUPERPASS="${MYSQL_SUPERPASS}" \ | ||||
|            -e MANGOS_DBHOST="database" \ | ||||
|            -e MANGOS_DBUSER="${MANGOS_DBUSER}" \ | ||||
|            -e MANGOS_DBPASS="${MANGOS_DBPASS}" \ | ||||
|            -v "${DATA_VOLUME}":/home/mangos/data \ | ||||
|            -v "${WOW_CLIENT_DIR}":/home/mangos/wow-client \ | ||||
|     \ | ||||
|     "${IMAGE}:${VERSION}" ${@} | ||||
							
								
								
									
										1
									
								
								cmangos-docker.wiki
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
								
									
									
								
							
						
						
									
										1
									
								
								cmangos-docker.wiki
									
									
									
									
									
										Submodule
									
								
							| @ -0,0 +1 @@ | ||||
| Subproject commit 30bb1fe5e20b1fdb74892316f55ab2ad57d8d8fd | ||||
							
								
								
									
										161
									
								
								compose.yml
									
									
									
									
									
								
							
							
						
						
									
										161
									
								
								compose.yml
									
									
									
									
									
								
							| @ -1,116 +1,71 @@ | ||||
| name: cmangos | ||||
| services: | ||||
|   database: | ||||
|     build: | ||||
|       context: . | ||||
|       dockerfile: ./docker/database/Dockerfile | ||||
|     restart: unless-stopped | ||||
|     healthcheck: | ||||
|       test: ['CMD', 'healthcheck.sh', '--connect', '--innodb_initialized'] | ||||
|       interval: 1m | ||||
|       timeout: 3s | ||||
|       retries: 5 | ||||
|       start_period: 5m | ||||
|     volumes: | ||||
|       - ./vmangos-database:/var/lib/mysql | ||||
|       - ./storage/database/custom-sql:/sql/custom:ro | ||||
|     image: mariadb:11.8 | ||||
|     container_name: wow-db | ||||
|     environment: | ||||
|       - TZ=Europe/Paris | ||||
|       - MARIADB_PASSWORD=mangos | ||||
|       - MARIADB_ROOT_PASSWORD=password | ||||
|       - VMANGOS_REALMLIST_NAME=gregan-wow | ||||
|       - VMANGOS_REALMLIST_ADDRESS=127.0.0.1 | ||||
|       - VMANGOS_REALMLIST_PORT=8085 | ||||
|       - VMANGOS_REALMLIST_ICON=1 # Sets the icon of the realm; 0 = Normal, 1 = PvP, 6 = RP, 8 = RP PVP | ||||
|       - VMANGOS_REALMLIST_TIMEZONE=10 # Sets the timezone of the realm; some common values are: 2 = United States, 3 = Oceanic, 4 = Latin America, 8 = English, 9 = German, 10 = French, 11 = Spanish, 12 = Russian | ||||
|       - VMANGOS_REALMLIST_ALLOWED_SECURITY_LEVEL=0 # Sets the minimum account security level required to log in to the realm; 0 = regular players | ||||
|       - VMANGOS_ENABLE_AUTOMATIC_WORLD_DB_CORRECTIONS=1 | ||||
|       - VMANGOS_PROCESS_CUSTOM_SQL=1 | ||||
| 
 | ||||
|   realmd: | ||||
|     build: | ||||
|       context: . | ||||
|       dockerfile: ./docker/server/Dockerfile | ||||
|     user: 1000:1000 | ||||
|     command: realmd | ||||
|     ulimits: | ||||
|       nofile: 1024 | ||||
|     depends_on: | ||||
|       - database | ||||
|     restart: unless-stopped | ||||
|     healthcheck: | ||||
|       test: ['CMD', 'nc', '-z', 'localhost', '3724'] | ||||
|       interval: 1m | ||||
|       timeout: 3s | ||||
|       retries: 5 | ||||
|       start_period: 5m | ||||
|     ports: | ||||
|       - 3724:3724 | ||||
|       database_ROOT_PASSWORD: "${MYSQL_SUPERPASS}" | ||||
|     volumes: | ||||
|       - ./config/realmd.conf:/opt/vmangos/config/realmd.conf:ro | ||||
|       - ./storage/realmd/logs:/opt/vmangos/storage/logs | ||||
|     environment: | ||||
|       - TZ=Europe/Paris | ||||
|       - WAIT_HOSTS=database:3306 | ||||
|       - WAIT_TIMEOUT=300 | ||||
|       - ./database_data:/var/lib/mysql | ||||
|       - ./config/database:/etc/mysql/conf.d:ro | ||||
|     networks: | ||||
|       - wow | ||||
| 
 | ||||
|   mangosd: | ||||
|     build: | ||||
|       context: . | ||||
|       dockerfile: ./docker/server/Dockerfile | ||||
|     user: 1000:1000 | ||||
|     command: mangosd | ||||
|     ulimits: | ||||
|       nofile: 1024 | ||||
|     tty: true | ||||
|     stdin_open: true | ||||
|     image: "ghcr.io/byloth/cmangos/${WOW_VERSION}:latest" | ||||
|     container_name: wow-mangosd | ||||
|     depends_on: | ||||
|       - database | ||||
|     restart: unless-stopped | ||||
|     stop_grace_period: 2m | ||||
|     healthcheck: | ||||
|       test: ['CMD', 'nc', '-z', 'localhost', '8085'] | ||||
|       interval: 1m | ||||
|       timeout: 3s | ||||
|       retries: 5 | ||||
|       start_period: 5m | ||||
|     ports: | ||||
|       - 8085:8085 | ||||
|     volumes: | ||||
|       - ./config/mangosd.conf:/opt/vmangos/config/mangosd.conf:ro | ||||
|       - ./storage/mangosd/extracted-data:/opt/vmangos/storage/data:ro | ||||
|       - ./storage/mangosd/logs:/opt/vmangos/storage/logs | ||||
|       - ./storage/mangosd/honor:/opt/vmangos/storage/honor | ||||
|     environment: | ||||
|       - TZ=Europe/Paris | ||||
|       - WAIT_HOSTS=database:3306 | ||||
|       - WAIT_TIMEOUT=300 | ||||
|       MANGOS_DBHOST: database | ||||
|       MANGOS_DBUSER: "${MANGOS_DBUSER}" | ||||
|       MANGOS_DBPASS: "${MANGOS_DBPASS}" | ||||
|       TZ: "${WOW_TIMEZONE}" | ||||
|     command: mangosd | ||||
|     stdin_open: true | ||||
|     tty: true | ||||
|     ports: | ||||
|       - "${MANGOSD_PORT:-8085}:8085" | ||||
|     volumes: | ||||
|       - ./mangosd_data:/var/lib/mangos:ro | ||||
|       - ./config/mangosd:/opt/mangos/conf:ro | ||||
|     networks: | ||||
|       - wow | ||||
| 
 | ||||
|   # # Optional: | ||||
|   # # See https://github.com/tiredofit/docker-db-backup#configuration for more | ||||
|   # # information. | ||||
|   # database-backup: | ||||
|   #   image: tiredofit/db-backup | ||||
|   realmd: | ||||
|     image: "ghcr.io/byloth/cmangos/${WOW_VERSION}:latest" | ||||
|     container_name: wow-realmd | ||||
|     depends_on: | ||||
|       - database | ||||
|     environment: | ||||
|       MANGOS_DBHOST: database | ||||
|       MANGOS_DBUSER: "${MANGOS_DBUSER}" | ||||
|       MANGOS_DBPASS: "${MANGOS_DBPASS}" | ||||
|       TZ: "${WOW_TIMEZONE}" | ||||
|     command: realmd | ||||
|     ports: | ||||
|       - "${REALMD_PORT:-3724}:3724" | ||||
|     volumes: | ||||
|       - ./mangosd_data:/var/lib/mangos:ro | ||||
|     networks: | ||||
|       - wow | ||||
| 
 | ||||
|   # phpmyadmin: | ||||
|   #   image: phpmyadmin:5.2 | ||||
|   #   container_name: wow-db-admin | ||||
|   #   depends_on: | ||||
|   #     - database | ||||
|   #   restart: unless-stopped | ||||
|   #   volumes: | ||||
|   #     - ./storage/database/backups:/backup | ||||
|   #   profiles: | ||||
|   #     - debug | ||||
|   #   environment: | ||||
|   #     - TIMEZONE=Etc/UTC # Change this to your desired timezone (usually you want to match your host system's timezone) | ||||
|   #     - CONTAINER_ENABLE_MONITORING=FALSE | ||||
|   #     # If you are using a Linux host and your user's UID and GID are not 1000, | ||||
|   #     # change these next two variables to reflect your user's UID and GID. | ||||
|   #     # This will cause the user in the container to use the same UID and GID | ||||
|   #     # and prevent permission issues on the bind mount. | ||||
|   #     # If you are on Windows or macOS, you can ignore this. | ||||
|   #     - USER_DBBACKUP=1000 | ||||
|   #     - GROUP_DBBACKUP=1000 | ||||
|   #     - DEFAULT_COMPRESSION=GZ | ||||
|   #     - DEFAULT_BACKUP_INTERVAL=1440 # How often to run the backup in minutes; 1440 means once per day | ||||
|   #     - DEFAULT_BACKUP_BEGIN=0400 # When to start the backup; 0400 means it starts at 04:00 | ||||
|   #     - DEFAULT_CLEANUP_TIME=10080 # How old backups have to be to get deleted; 10080 means backups older than a week get deleted | ||||
|   #     - DB01_TYPE=mariadb | ||||
|   #     - DB01_HOST=database | ||||
|   #     - DB01_NAME=characters,realmd # Which databases should be backed up | ||||
|   #     - DB01_USER=root | ||||
|   #     - DB01_PASS=password # Must match the `MARIADB_ROOT_PASSWORD` environment variable of the `database` service | ||||
|   #     PMA_HOST: database | ||||
|   #     PMA_USER: root | ||||
|   #     PMA_PASSWORD: "${MYSQL_SUPERPASS}" | ||||
|   #   networks: | ||||
|   #     - wow | ||||
|   #   ports: | ||||
|   #     - "${PHPMYADMIN_PORT:-8080}:80" | ||||
| 
 | ||||
| networks: | ||||
|   wow: | ||||
|     driver: bridge | ||||
							
								
								
									
										2
									
								
								config/database/my.cnf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								config/database/my.cnf
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | ||||
| [mysqld] | ||||
| wait_timeout = 28800 | ||||
							
								
								
									
										3042
									
								
								config/mangosd.conf
									
									
									
									
									
								
							
							
						
						
									
										3042
									
								
								config/mangosd.conf
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										56
									
								
								config/mangosd/mangosd.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								config/mangosd/mangosd.conf
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,56 @@ | ||||
| 
 | ||||
| ################################################################################################################### | ||||
| # | ||||
| #    GameType | ||||
| #        Server realm style | ||||
| #        0 = NORMAL; 1 = PVP; 4 = NORMAL; 6 = RP; 8 = RPPVP | ||||
| #        also custom type: 16 FFA_PVP (free for all pvp mode like arena PvP in all zones except rest | ||||
| #        activated places and sanctuaries) | ||||
| # | ||||
| #    RealmZone | ||||
| #        Server realm zone (set allowed alphabet in character names/etc). See also Strict*Names options. | ||||
| # | ||||
| #        1 Development    - any language (Default) | ||||
| #        2 United States  - extended-Latin | ||||
| #        3 Oceanic        - extended-Latin | ||||
| #        4 Latin America  - extended-Latin | ||||
| #        5 Tournament     - basic-Latin at create, any at login | ||||
| #        6 Korea          - East-Asian | ||||
| #        7 Tournament     - basic-Latin at create, any at login | ||||
| #        8 English        - extended-Latin | ||||
| #        9 German         - extended-Latin | ||||
| #        10 French        - extended-Latin | ||||
| #        11 Spanish       - extended-Latin | ||||
| #        12 Russian       - Cyrillic | ||||
| #        13 Tournament    - basic-Latin at create, any at login | ||||
| #        14 Taiwan        - East-Asian | ||||
| #        15 Tournament    - basic-Latin at create, any at login | ||||
| #        16 China         - East-Asian | ||||
| #        17 CN1           - basic-Latin at create, any at login | ||||
| #        18 CN2           - basic-Latin at create, any at login | ||||
| #        19 CN3           - basic-Latin at create, any at login | ||||
| #        20 CN4           - basic-Latin at create, any at login | ||||
| #        21 CN5           - basic-Latin at create, any at login | ||||
| #        22 CN6           - basic-Latin at create, any at login | ||||
| #        23 CN7           - basic-Latin at create, any at login | ||||
| #        24 CN8           - basic-Latin at create, any at login | ||||
| #        25 Tournament    - basic-Latin at create, any at login | ||||
| #        26 Test Server   - any language | ||||
| #        27 Tournament    - basic-Latin at create, any at login | ||||
| #        28 QA Server     - any language | ||||
| #        29 CN9           - basic-Latin at create, any at login | ||||
| # | ||||
| #    RabbitDay | ||||
| #        Set to Rabbit Day (date in unix time), only the day and month are considered, the year is not important | ||||
| #        Default: 0 (off) | ||||
| #        Suggested: 954547200 (April 1st, 2000) | ||||
| # | ||||
| #    Motd | ||||
| #        Message of the Day. Displayed at worldlogin for every user ('@' for a newline). | ||||
| # | ||||
| #################################################################################################################### | ||||
| 
 | ||||
| GameType = 0 | ||||
| RealmZone = 8 | ||||
| RabbitDay = 954547200 | ||||
| Motd = "Bienvenue en Azeroth! (sur le serveur du garage)" | ||||
| @ -1,189 +0,0 @@ | ||||
| ############################################ | ||||
| # MaNGOS realmd configuration file         # | ||||
| ############################################ | ||||
| 
 | ||||
| [RealmdConf] | ||||
| ConfVersion=2020010501 | ||||
| 
 | ||||
| ################################################################################################################### | ||||
| # REALMD SETTINGS | ||||
| # | ||||
| #    LoginDatabaseInfo | ||||
| #        Database connection settings for the realm server. | ||||
| #        Default: hostname;port;username;password;database | ||||
| #                 .;somenumber;username;password;database - use named pipes at Windows | ||||
| #                       Named pipes: mySQL required adding "enable-named-pipe" to [mysqld] section my.ini | ||||
| #                 .;/path/to/unix_socket;username;password;database - use Unix sockets at Unix/Linux | ||||
| #                       Unix sockets: experimental, not tested | ||||
| # | ||||
| #    LogsDir | ||||
| #         Logs directory setting. | ||||
| #         Important: Logs dir must exists, or all logs be disable | ||||
| #         Default: "" - no log directory prefix. if used log names aren't absolute paths | ||||
| #                       then logs will be stored in the current directory of the running program. | ||||
| # | ||||
| #    PatchesDir | ||||
| #         Folder to serve client patches. | ||||
| #         Important: Patches dir must contain mpq files like this: <build><lang>.mpq e.g. 65535enGB.mpq | ||||
| #         Default: "./patches" | ||||
| # | ||||
| #    MaxPingTime | ||||
| #         Settings for maximum database-ping interval (minutes between pings) | ||||
| # | ||||
| #    RealmServerPort | ||||
| #         Port on which the server will listen | ||||
| # | ||||
| #    BindIP | ||||
| #         Bind Realm Server to IP/hostname | ||||
| #         This option is useful for running multiple worldd/realmd instances | ||||
| #         on different IP addresses using default ports. | ||||
| #         DO NOT CHANGE THIS UNLESS YOU _REALLY_ KNOW WHAT YOU'RE DOING | ||||
| # | ||||
| #    PidFile | ||||
| #        Realmd daemon PID file | ||||
| #        Default: ""             - do not create PID file | ||||
| #                 "./realmd.pid" - create PID file (recommended name) | ||||
| # | ||||
| #    LogLevel | ||||
| #        Server console level of logging | ||||
| #        0 = Minimum; 1 = Error; 2 = Detail; 3 = Full/Debug | ||||
| #        Default: 0 | ||||
| # | ||||
| #    LogTime | ||||
| #        Include time in server console output [hh:mm:ss] | ||||
| #        Default: 0 (no time) | ||||
| #                 1 (print time) | ||||
| # | ||||
| #    LogFile | ||||
| #        Logfile name | ||||
| #        Default: "Realmd.log" | ||||
| #                 "" - empty name disable creating log file | ||||
| # | ||||
| #    LogTimestamp | ||||
| #        Logfile with timestamp of server start in name | ||||
| #        Default: 0 - no timestamp in name | ||||
| #                 1 - add timestamp in name in form Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext | ||||
| # | ||||
| #    LogFileLevel | ||||
| #        Server file level of logging | ||||
| #        0 = Minimum; 1 = Error; 2 = Detail; 3 = Full/Debug | ||||
| #        Default: 0 | ||||
| # | ||||
| #    UseProcessors | ||||
| #        Used processors mask for multi-processors system (Used only at Windows) | ||||
| #        Default: 0 (selected by OS) | ||||
| #                 number (bitmask value of selected processors) | ||||
| # | ||||
| #    ProcessPriority | ||||
| #        Process proirity setting (Used only at Windows) | ||||
| #        Default: 1 (HIGH) | ||||
| #                 0 (Normal) | ||||
| # | ||||
| #    WaitAtStartupError | ||||
| #        After startup error report wait <Enter> or some time before continue (and possible close console window) | ||||
| #                 -1 (wait until <Enter> press) | ||||
| #        Default:  0 (not wait) | ||||
| #                  N (>0, wait N secs) | ||||
| # | ||||
| #    MinRealmListDelay | ||||
| #        Minimum amount of time, in seconds, that must pass before a second realm list request is considered legitimate | ||||
| #        Default: 1 | ||||
| # | ||||
| #    RealmsStateUpdateDelay | ||||
| #        Realm list Update up delay (updated at realm list request if delay expired). | ||||
| #        Default: 20 | ||||
| #                 0  (Disabled) | ||||
| # | ||||
| #    WrongPass.MaxCount | ||||
| #        Number of login attemps with wrong password before the account or IP is banned | ||||
| #        Default: 0  (Never ban) | ||||
| # | ||||
| #    WrongPass.BanTime | ||||
| #        Duration of the ban in seconds (0 means permanent ban) | ||||
| #        Default: 600 | ||||
| # | ||||
| #    WrongPass.BanType | ||||
| #        Ban the IP or account on which login is attempted | ||||
| #        Default: 0 (Ban IP) | ||||
| #                 1 (Ban Account) | ||||
| # | ||||
| #    ReqEmailVerification | ||||
| #        Required that the user has verified their email address before allowing logins | ||||
| #        Default: 0 (No verification required) | ||||
| #                 1 (Verification required) | ||||
| # | ||||
| #    ReqEmailSince | ||||
| #        Require the Email Verification Since the Timestamp | ||||
| #        Default: 0 (Disabled) | ||||
| #                 1530302395 (Timestamp) | ||||
| # | ||||
| #    GeoLocking | ||||
| #        Blocks account logins when a change in geographical location is detected | ||||
| #        Default: 0 | ||||
| # | ||||
| #    StrictVersionCheck | ||||
| #        Description: Prevent modified clients from connnecting | ||||
| #        Default: 1 - (Enabled) | ||||
| #                 0 - (Disabled) | ||||
| # | ||||
| #    SendMail | ||||
| #        Whether the server is allowed to send emails | ||||
| #        The server must have been compiled with ENABLE_MAILSENDER | ||||
| #        Default: 0 (Do not send mail) | ||||
| # | ||||
| #    MailFrom | ||||
| #        Specify the email address to send mail from | ||||
| #        Default: "" | ||||
| # | ||||
| #    MailCertChecks | ||||
| #        Whether to validate the certificates of the mail server | ||||
| #        Default: 1 (Recommended) | ||||
| # | ||||
| #    SendGridKey | ||||
| #        If SendGrid is being used for emailing, specify your API key here | ||||
| #        This option must be set if SendGrid is enabled | ||||
| #        Default: "" | ||||
| # | ||||
| #    GeolockGUID | ||||
| #        The SendGrid template GUID for geolocking emails | ||||
| #        Default: "" | ||||
| # | ||||
| #    MaxSessionDuration | ||||
| #        Maximum time in seconds that sessions can stay open | ||||
| #        Default: 300 (5 minutes) | ||||
| # | ||||
| ################################################################################################################### | ||||
| 
 | ||||
| # Username and password must match the `MARIADB_USER` and `MARIADB_PASSWORD` | ||||
| # environment variables of the `database` service in your `compose.yaml` | ||||
| # respectively. | ||||
| LoginDatabaseInfo = "database;3306;mangos;mangos;realmd" | ||||
| LogsDir = "/opt/vmangos/storage/logs" | ||||
| PatchesDir = "./patches" | ||||
| MaxPingTime = 30 | ||||
| RealmServerPort = 3724 | ||||
| BindIP = "0.0.0.0" | ||||
| PidFile = "" | ||||
| LogLevel = 0 | ||||
| LogTime = 0 | ||||
| LogFile = "Realmd.log" | ||||
| LogTimestamp = 0 | ||||
| LogFileLevel = 0 | ||||
| UseProcessors = 0 | ||||
| ProcessPriority = 1 | ||||
| WaitAtStartupError = 0 | ||||
| MinRealmListDelay = 1 | ||||
| RealmsStateUpdateDelay = 20 | ||||
| WrongPass.MaxCount = 0 | ||||
| WrongPass.BanTime = 600 | ||||
| WrongPass.BanType = 0 | ||||
| ReqEmailVerification = 0 | ||||
| ReqEmailSince = 0 | ||||
| GeoLocking = 0 | ||||
| StrictVersionCheck = 1 | ||||
| SendMail = 0 | ||||
| MailFrom = "" | ||||
| MailCertChecks = 1 | ||||
| SendGridKey = "" | ||||
| GeolockGUID = "" | ||||
| MaxSessionDuration = 300 | ||||
							
								
								
									
										223
									
								
								docker/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										223
									
								
								docker/Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,223 @@ | ||||
| FROM ubuntu:24.04 AS builder | ||||
| 
 | ||||
| ENV DEBIAN_FRONTEND="noninteractive" | ||||
| 
 | ||||
| ARG TIMEZONE="Etc/UTC" | ||||
| ENV TZ="${TIMEZONE}" | ||||
| RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||||
|     --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \ | ||||
|     \ | ||||
|     apt-get update \ | ||||
|  && apt-get install -y --no-install-recommends \ | ||||
|         tzdata \ | ||||
|  && ln -snf "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime \ | ||||
|  && echo "${TIMEZONE}" > /etc/timezone \ | ||||
|  && dpkg-reconfigure --frontend noninteractive tzdata \ | ||||
|  \ | ||||
|  && apt-get install -y --no-install-recommends \ | ||||
|         build-essential \ | ||||
|         ca-certificates \ | ||||
|         cmake \ | ||||
|         g++-14 \ | ||||
|         git-core \ | ||||
|         libboost-filesystem-dev \ | ||||
|         libboost-program-options-dev \ | ||||
|         libboost-regex-dev \ | ||||
|         libboost-serialization-dev \ | ||||
|         libboost-system-dev \ | ||||
|         libboost-thread-dev \ | ||||
|         libmariadb-dev-compat \ | ||||
|         libssl-dev \ | ||||
|         mariadb-client \ | ||||
|  \ | ||||
|  && update-alternatives --install /usr/bin/gcc gcc \ | ||||
|                                   /usr/bin/gcc-14 14 \ | ||||
|                         --slave /usr/bin/g++ g++ \ | ||||
|                                 /usr/bin/g++-14 \ | ||||
|  \ | ||||
|  && rm -rf /tmp/* | ||||
| 
 | ||||
| ARG EXPANSION | ||||
| ARG MANGOS_SHA1="latest" | ||||
| ARG DATABASE_SHA1="latest" | ||||
| ENV HOME_DIR="/home/mangos" | ||||
| ENV MANGOS_DIR="${HOME_DIR}/mangos" | ||||
| ENV DATABASE_DIR="${HOME_DIR}/${EXPANSION}-db" | ||||
| 
 | ||||
| RUN mkdir -p "${MANGOS_DIR}" \ | ||||
|              "${DATABASE_DIR}" \ | ||||
|  \ | ||||
|  && cd /tmp \ | ||||
|  && if [ "${MANGOS_SHA1}" = "latest" ]; \ | ||||
|     then \ | ||||
|         git clone "https://github.com/cmangos/mangos-${EXPANSION}.git" \ | ||||
|                 --branch "master" \ | ||||
|                 --single-branch \ | ||||
|                 --depth 1 \ | ||||
|            "${MANGOS_DIR}"; \ | ||||
|     else \ | ||||
|         git clone "https://github.com/cmangos/mangos-${EXPANSION}.git" \ | ||||
|                 --branch "master" \ | ||||
|                 --single-branch \ | ||||
|             cmangos-mangos \ | ||||
|      && cd cmangos-mangos \ | ||||
|      && git archive "${MANGOS_SHA1}" | tar xC "${MANGOS_DIR}"; \ | ||||
|     fi \ | ||||
|  \ | ||||
|  && cd /tmp \ | ||||
|  && if [ "${DATABASE_SHA1}" = "latest" ]; \ | ||||
|     then \ | ||||
|         git clone "https://github.com/cmangos/${EXPANSION}-db.git" \ | ||||
|                 --branch "master" \ | ||||
|                 --single-branch \ | ||||
|                 --depth 1 \ | ||||
|             "${DATABASE_DIR}"; \ | ||||
|     else \ | ||||
|         git clone "https://github.com/cmangos/${EXPANSION}-db.git" \ | ||||
|                 --branch "master" \ | ||||
|                 --single-branch \ | ||||
|             cmangos-db \ | ||||
|      && cd cmangos-db \ | ||||
|      && git archive "${DATABASE_SHA1}" | tar xC "${DATABASE_DIR}"; \ | ||||
|     fi \ | ||||
|  \ | ||||
|  && rm -rf /tmp/* | ||||
| 
 | ||||
| # TODO: Add here as building arguments all `cmake` parameters. | ||||
| #   - CMAKE_INSTALL_PREFIX    Path where the server should be installed to | ||||
| #   - PCH                     Use precompiled headers | ||||
| #   - DEBUG                   Include additional debug-code in core | ||||
| #   - WARNINGS                Show all warnings during compile | ||||
| #   - POSTGRESQL              Use PostgreSQL instead of mysql | ||||
| #   - BUILD_EXTRACTORS        Build map/dbc/vmap/mmap extractor | ||||
| #   - BUILD_SCRIPTDEV         Build scriptdev. (Disable it to speedup build in dev mode by not including scripts) | ||||
| #   - BUILD_PLAYERBOTS        Build Playerbot mod | ||||
| #   - BUILD_AHBOT             Build Auction House Bot mod | ||||
| #   - BUILD_METRICS           Build Metrics, generate data for Grafana | ||||
| #   - BUILD_RECASTDEMOMOD     Build map/vmap/mmap viewer | ||||
| #   - BUILD_GIT_ID            Build git_id | ||||
| #   - BUILD_DOCS              Build documentation with doxygen | ||||
| # | ||||
| ARG THREADS="1" | ||||
| RUN mkdir -p "${HOME_DIR}/build" \ | ||||
|              "${HOME_DIR}/run" \ | ||||
|  \ | ||||
|  && cd "${HOME_DIR}/build" \ | ||||
|  && cmake ../mangos/ \ | ||||
|         -D CMAKE_INSTALL_PREFIX=../run \ | ||||
|         -D PCH=1 \ | ||||
|         -D DEBUG=0 \ | ||||
|         -D BUILD_EXTRACTORS=ON \ | ||||
|  && make -j "${THREADS}" \ | ||||
|  && make install \ | ||||
|  \ | ||||
|  && cd "${HOME_DIR}/run/bin/tools" \ | ||||
|  && chmod +x ExtractResources.sh \ | ||||
|              MoveMapGen.sh | ||||
| 
 | ||||
| RUN useradd --comment "MaNGOS" \ | ||||
|             --home "${HOME_DIR}" \ | ||||
|             --user-group mangos | ||||
| 
 | ||||
| WORKDIR "${HOME_DIR}" | ||||
| 
 | ||||
| ENV MYSQL_SUPERUSER="root" | ||||
| ENV MYSQL_SUPERPASS="" | ||||
| 
 | ||||
| ENV MANGOS_DBHOST="host.docker.internal" | ||||
| ENV MANGOS_DBPORT="3306" | ||||
| ENV MANGOS_DBUSER="mangos" | ||||
| ENV MANGOS_DBPASS="" | ||||
| 
 | ||||
| ENV MANGOS_WORLD_DBNAME="${EXPANSION}mangos" | ||||
| ENV MANGOS_CHARACTERS_DBNAME="${EXPANSION}characters" | ||||
| ENV MANGOS_LOGS_DBNAME="${EXPANSION}logs" | ||||
| ENV MANGOS_REALMD_DBNAME="${EXPANSION}realmd" | ||||
| 
 | ||||
| COPY builder/entrypoint.sh / | ||||
| COPY builder/InstallFullDB.config "${DATABASE_DIR}/" | ||||
| 
 | ||||
| ENTRYPOINT ["/entrypoint.sh"] | ||||
| CMD ["bash"] | ||||
| 
 | ||||
| ENV VOLUME_DIR="/home/mangos/data" | ||||
| ENV TMPDIR="${VOLUME_DIR}/tmp" | ||||
| VOLUME ["${VOLUME_DIR}"] | ||||
| 
 | ||||
| 
 | ||||
| FROM ubuntu:24.04 AS runner | ||||
| 
 | ||||
| ENV DEBIAN_FRONTEND="noninteractive" | ||||
| 
 | ||||
| ARG TIMEZONE="Etc/UTC" | ||||
| ENV TZ="${TIMEZONE}" | ||||
| RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||||
|     --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \ | ||||
|     \ | ||||
|     apt-get update \ | ||||
|  && apt-get install -y --no-install-recommends \ | ||||
|         tzdata \ | ||||
|  && ln -snf "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime \ | ||||
|  && echo "${TIMEZONE}" > /etc/timezone \ | ||||
|  && dpkg-reconfigure --frontend noninteractive tzdata \ | ||||
|  \ | ||||
|  && apt-get install -y --no-install-recommends \ | ||||
|         gosu \ | ||||
|         libmariadb-dev \ | ||||
|         libssl3 \ | ||||
|         wait-for-it \ | ||||
|  \ | ||||
|  && rm -rf /tmp/* | ||||
| 
 | ||||
| ENV HOME_DIR="/home/mangos" | ||||
| ENV MANGOS_DIR="/opt/mangos" | ||||
| RUN useradd --home "${HOME_DIR}" --create-home \ | ||||
|             --comment "MaNGOS" \ | ||||
|             --user-group mangos | ||||
| 
 | ||||
| WORKDIR "${MANGOS_DIR}" | ||||
| 
 | ||||
| ARG EXPANSION | ||||
| COPY --from=builder "${HOME_DIR}/run" "${MANGOS_DIR}" | ||||
| COPY runner/entrypoint.sh / | ||||
| 
 | ||||
| ENV VOLUME_DIR="/var/lib/mangos" | ||||
| ENV TMPDIR="${VOLUME_DIR}/tmp" | ||||
| RUN mkdir "${VOLUME_DIR}" \ | ||||
|  && sed -i '/^DataDir/c\DataDir = "'"${VOLUME_DIR}"'"' etc/mangosd.conf.dist | ||||
| 
 | ||||
| ENV MANGOS_DBHOST="host.docker.internal" | ||||
| ENV MANGOS_DBPORT="3306" | ||||
| ENV MANGOS_DBUSER="mangos" | ||||
| ENV MANGOS_DBPASS="" | ||||
| 
 | ||||
| ENV MANGOS_WORLD_DBNAME="${EXPANSION}mangos" | ||||
| ENV MANGOS_CHARACTERS_DBNAME="${EXPANSION}characters" | ||||
| ENV MANGOS_LOGS_DBNAME="${EXPANSION}logs" | ||||
| ENV MANGOS_REALMD_DBNAME="${EXPANSION}realmd" | ||||
| 
 | ||||
| ENTRYPOINT ["/entrypoint.sh"] | ||||
| CMD ["bash"] | ||||
| 
 | ||||
| EXPOSE 3443 3724 7878 8085 8086 | ||||
| VOLUME ["${VOLUME_DIR}"] | ||||
| 
 | ||||
| ARG COMMIT_SHA | ||||
| ARG CREATE_DATE | ||||
| ARG VERSION | ||||
| LABEL org.opencontainers.image.title="CMaNGOS Runner \"${EXPANSION}\" version" | ||||
| LABEL org.opencontainers.image.description="A CMaNGOS \"${EXPANSION}\" version Docker image ready-to-use to host your emulated private server for WoW wherever you want." | ||||
| LABEL org.opencontainers.image.licenses="GPL-2.0" | ||||
| LABEL org.opencontainers.image.version="${VERSION}" | ||||
| LABEL org.opencontainers.image.revision="${COMMIT_SHA}" | ||||
| LABEL org.opencontainers.image.created="${CREATE_DATE}" | ||||
| 
 | ||||
| ARG MANGOS_SHA1 | ||||
| LABEL "net.cmangos.mangos-${EXPANSION}.revision"="${MANGOS_SHA1}" | ||||
| LABEL "net.cmangos.mangos-${EXPANSION}.source"="https://github.com/cmangos/mangos-${EXPANSION}" | ||||
| LABEL "net.cmangos.mangos-${EXPANSION}.url"="https://github.com/cmangos/mangos-${EXPANSION}" | ||||
| 
 | ||||
| ARG DATABASE_SHA1 | ||||
| LABEL "net.cmangos.${EXPANSION}-db.revision"="${DATABASE_SHA1}" | ||||
| LABEL "net.cmangos.${EXPANSION}-db.source"="https://github.com/cmangos/${EXPANSION}-db" | ||||
| LABEL "net.cmangos.${EXPANSION}-db.url"="https://github.com/cmangos/${EXPANSION}-db" | ||||
| @ -1,85 +0,0 @@ | ||||
| ARG DEBIAN_FRONTEND=noninteractive | ||||
| ARG VMANGOS_REPOSITORY_URL=https://github.com/vmangos/core.git | ||||
| ARG VMANGOS_REVISION=development | ||||
| ARG VMANGOS_WORLD_DB_REPOSITORY_URL=https://github.com/brotalnia/database.git | ||||
| ARG VMANGOS_WORLD_DB_DUMP_NAME=world_full_14_june_2021 | ||||
| ARG VMANGOS_WORLD_DB_DUMP_NEW_FILE=/sql/world-new.sql | ||||
| 
 | ||||
| FROM mariadb:11.8 AS setup | ||||
| 
 | ||||
| ARG DEBIAN_FRONTEND | ||||
| ARG VMANGOS_REPOSITORY_URL | ||||
| ARG VMANGOS_REVISION | ||||
| ARG VMANGOS_WORLD_DB_REPOSITORY_URL | ||||
| ARG VMANGOS_WORLD_DB_DUMP_NAME | ||||
| 
 | ||||
| RUN \ | ||||
|   apt update -y && \ | ||||
|   apt install -y \ | ||||
|     git \ | ||||
|     p7zip-full && \ | ||||
|   git clone "${VMANGOS_REPOSITORY_URL}" /core && \ | ||||
|   cd /core && \ | ||||
|   git checkout "${VMANGOS_REVISION}" && \ | ||||
|   git clone "${VMANGOS_WORLD_DB_REPOSITORY_URL}" /database && \ | ||||
|   mkdir -p /sql/custom && \ | ||||
|   mkdir -p /sql/migrations && \ | ||||
|   cd /core/sql && \ | ||||
|   mv characters.sql /sql && \ | ||||
|   mv logon.sql /sql && \ | ||||
|   mv logs.sql /sql && \ | ||||
|   cd /core/sql/migrations && \ | ||||
|   chmod +x merge.sh && \ | ||||
|   ./merge.sh && \ | ||||
|   mv characters_db_updates.sql /sql/migrations && \ | ||||
|   mv logon_db_updates.sql /sql/migrations && \ | ||||
|   mv logs_db_updates.sql /sql/migrations && \ | ||||
|   mv world_db_updates.sql /sql/migrations && \ | ||||
|   cd /database && \ | ||||
|   7z e ${VMANGOS_WORLD_DB_DUMP_NAME}.7z && \ | ||||
|   mv ${VMANGOS_WORLD_DB_DUMP_NAME}.sql /sql/world.sql && \ | ||||
|   rm -rf /core /database && \ | ||||
|   apt remove -y \ | ||||
|     git \ | ||||
|     p7zip-full && \ | ||||
|   apt autoremove -y && \ | ||||
|   apt clean -y && \ | ||||
|   rm -rf /var/lib/apt/lists/* | ||||
| 
 | ||||
| FROM mariadb:11.8 | ||||
| 
 | ||||
| ARG VMANGOS_WORLD_DB_DUMP_NEW_FILE | ||||
| 
 | ||||
| ENV MARIADB_AUTO_UPGRADE=1 | ||||
| ENV MARIADB_USER=mangos | ||||
| ENV MARIADB_PASSWORD=mangos | ||||
| ENV MARIADB_ROOT_PASSWORD=password | ||||
| ENV VMANGOS_REALMLIST_NAME=VMaNGOS | ||||
| ENV VMANGOS_REALMLIST_ADDRESS=127.0.0.1 | ||||
| ENV VMANGOS_REALMLIST_PORT=8085 | ||||
| ENV VMANGOS_REALMLIST_ICON=1 | ||||
| ENV VMANGOS_REALMLIST_TIMEZONE=0 | ||||
| ENV VMANGOS_REALMLIST_ALLOWED_SECURITY_LEVEL=0 | ||||
| ENV VMANGOS_WORLD_DB_DUMP_NEW_FILE=${VMANGOS_WORLD_DB_DUMP_NEW_FILE} | ||||
| ENV VMANGOS_ENABLE_AUTOMATIC_WORLD_DB_CORRECTIONS=1 | ||||
| ENV VMANGOS_PROCESS_CUSTOM_SQL=1 | ||||
| 
 | ||||
| COPY --from=setup /sql /sql | ||||
| 
 | ||||
| RUN \ | ||||
|   mkdir -p /opt/scripts && \ | ||||
|   mkdir /always-initdb.d | ||||
| 
 | ||||
| COPY ./docker/database/db-functions.sh /opt/scripts | ||||
| COPY ./docker/database/create-db.sh /docker-entrypoint-initdb.d | ||||
| COPY ./docker/database/update-db.sh /always-initdb.d | ||||
| 
 | ||||
| COPY ./docker/database/docker-entrypoint.sh /entrypoint.sh | ||||
| 
 | ||||
| RUN \ | ||||
|   chmod +x /docker-entrypoint-initdb.d/create-db.sh && \ | ||||
|   chmod +x /always-initdb.d/update-db.sh && \ | ||||
|   chmod +x /entrypoint.sh | ||||
| 
 | ||||
| ENTRYPOINT ["/entrypoint.sh"] | ||||
| CMD ["mariadbd"] | ||||
| @ -1,41 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| . "/opt/scripts/db-functions.sh" | ||||
| 
 | ||||
| if [ "${VMANGOS_ENABLE_AUTOMATIC_WORLD_DB_CORRECTIONS:-0}" = "1" ]; then | ||||
|   echo "[vmangos-deploy]: [x] Automatic world database corrections are enabled" | ||||
| else | ||||
|   echo "[vmangos-deploy]: [ ] Automatic world database corrections are disabled" | ||||
| fi | ||||
| 
 | ||||
| if [ "${VMANGOS_PROCESS_CUSTOM_SQL:-0}" = "1" ]; then | ||||
|   echo "[vmangos-deploy]: [x] Custom SQL processing is enabled" | ||||
| else | ||||
|   echo "[vmangos-deploy]: [ ] Custom SQL processing is disabled" | ||||
| fi | ||||
| 
 | ||||
| create_database "mangos" | ||||
| create_database "characters" | ||||
| create_database "realmd" | ||||
| create_database "logs" | ||||
| 
 | ||||
| grant_permissions "mangos" | ||||
| grant_permissions "characters" | ||||
| grant_permissions "realmd" | ||||
| grant_permissions "logs" | ||||
| 
 | ||||
| import_dump "mangos" "/sql/world.sql" | ||||
| import_dump "characters" "/sql/characters.sql" | ||||
| import_dump "realmd" "/sql/logon.sql" | ||||
| import_dump "logs" "/sql/logs.sql" | ||||
| 
 | ||||
| import_updates "mangos" "/sql/migrations/world_db_updates.sql" | ||||
| import_updates "characters" "/sql/migrations/characters_db_updates.sql" | ||||
| import_updates "realmd" "/sql/migrations/logon_db_updates.sql" | ||||
| import_updates "logs" "/sql/migrations/logs_db_updates.sql" | ||||
| 
 | ||||
| configure_realm | ||||
| 
 | ||||
| if [ "${VMANGOS_PROCESS_CUSTOM_SQL:-0}" = "1" ]; then | ||||
|   process_custom_sql "/sql/custom" | ||||
| fi | ||||
| @ -1,172 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| create_database() { | ||||
|   local db_name="$1" | ||||
|   local silent=${2:-false} | ||||
| 
 | ||||
|   if [ "$silent" = false ]; then | ||||
|     echo "[vmangos-deploy]: Creating database '$db_name'" | ||||
|   fi | ||||
| 
 | ||||
|   mariadb -u root -p"$MARIADB_ROOT_PASSWORD" -e \ | ||||
|     "CREATE DATABASE IF NOT EXISTS \`$db_name\` DEFAULT CHARSET utf8 COLLATE utf8_general_ci;" | ||||
| } | ||||
| 
 | ||||
| drop_database() { | ||||
|   local db_name="$1" | ||||
|   local silent=${2:-false} | ||||
| 
 | ||||
|   if [ "$silent" = false ]; then | ||||
|     echo "[vmangos-deploy]: Dropping database '$db_name'" | ||||
|   fi | ||||
| 
 | ||||
|   mariadb -u root -p"$MARIADB_ROOT_PASSWORD" -e \ | ||||
|     "DROP DATABASE IF EXISTS \`$db_name\`;" | ||||
| } | ||||
| 
 | ||||
| grant_permissions() { | ||||
|   local db_name="$1" | ||||
|   local silent=${2:-false} | ||||
| 
 | ||||
|   if [ "$silent" = false ]; then | ||||
|     echo "[vmangos-deploy]: Granting permissions to database user '$MARIADB_USER' for database '$db_name'" | ||||
|   fi | ||||
| 
 | ||||
|   mariadb -u root -p"$MARIADB_ROOT_PASSWORD" -e \ | ||||
|     "GRANT ALL ON \`$db_name\`.* TO '$MARIADB_USER'@'%'; \ | ||||
|     FLUSH PRIVILEGES;" | ||||
| } | ||||
| 
 | ||||
| import_data() { | ||||
|   local db_name="$1" | ||||
|   local file="$2" | ||||
| 
 | ||||
|   mariadb -u root -p"$MARIADB_ROOT_PASSWORD" "$db_name" < "$file" | ||||
|   return $? | ||||
| } | ||||
| 
 | ||||
| import_dump() { | ||||
|   local db_name="$1" | ||||
|   local dump_file="$2" | ||||
| 
 | ||||
|   echo "[vmangos-deploy]: Importing initial data for database '$db_name'" | ||||
| 
 | ||||
|   import_data "$db_name" "$dump_file" | ||||
|   return $? | ||||
| } | ||||
| 
 | ||||
| import_updates() { | ||||
|   local db_name="$1" | ||||
|   local update_file="$2" | ||||
| 
 | ||||
|   if [ ! -e "$update_file" ]; then | ||||
|     # The update file not existing is not an error, so we return 0 (success) | ||||
|     # here | ||||
|     return 0 | ||||
|   fi | ||||
| 
 | ||||
|   echo "[vmangos-deploy]: Importing potential updates for database '$db_name'" | ||||
| 
 | ||||
|   import_data "$db_name" "$update_file" | ||||
|   return $? | ||||
| } | ||||
| 
 | ||||
| configure_realm() { | ||||
|   echo "[vmangos-deploy]: Configuring realm '$VMANGOS_REALMLIST_NAME'" | ||||
| 
 | ||||
|   mariadb -u root -p"$MARIADB_ROOT_PASSWORD" "realmd" -e \ | ||||
|     "INSERT INTO \`realmlist\` (\`name\`, \`address\`, \`port\`, \`icon\`, \`timezone\`, \`allowedSecurityLevel\`) VALUES ('$VMANGOS_REALMLIST_NAME', '$VMANGOS_REALMLIST_ADDRESS', '$VMANGOS_REALMLIST_PORT', '$VMANGOS_REALMLIST_ICON', '$VMANGOS_REALMLIST_TIMEZONE', '$VMANGOS_REALMLIST_ALLOWED_SECURITY_LEVEL');" | ||||
| } | ||||
| 
 | ||||
| create_world_db_corrections_table() { | ||||
|   mariadb -u root -p"$MARIADB_ROOT_PASSWORD" "maintenance" -e \ | ||||
|     "CREATE TABLE IF NOT EXISTS \`world_db_corrections\` ( \ | ||||
|       \`id\` INT NOT NULL, \ | ||||
|       \`reason\` VARCHAR(255) NOT NULL, \ | ||||
|       \`date\` DATE NOT NULL, \ | ||||
|       \`is_applied\` BOOLEAN NOT NULL DEFAULT FALSE, \ | ||||
|       PRIMARY KEY (\`id\`) \ | ||||
|     );" | ||||
| } | ||||
| 
 | ||||
| populate_world_db_corrections_table() { | ||||
|   mariadb -u root -p"$MARIADB_ROOT_PASSWORD" "maintenance" -e \ | ||||
|     "INSERT INTO \`world_db_corrections\` (\`id\`, \`reason\`, \`date\`) \ | ||||
|     SELECT 1, 'migration edits in vmangos/core@fe6fcb4', '2025-02-22' \ | ||||
|     WHERE NOT EXISTS ( \ | ||||
|       SELECT 1 FROM \`world_db_corrections\` WHERE \`id\` = 1 \ | ||||
|     ); \ | ||||
|     INSERT INTO \`world_db_corrections\` (\`id\`, \`reason\`, \`date\`) \ | ||||
|     SELECT 2, 'migration edits in vmangos/core@9e6d4ac', '2025-02-23' \ | ||||
|     WHERE NOT EXISTS ( \ | ||||
|       SELECT 2 FROM \`world_db_corrections\` WHERE \`id\` = 2 \ | ||||
|     ); \ | ||||
|     INSERT INTO \`world_db_corrections\` (\`id\`, \`reason\`, \`date\`) \ | ||||
|     SELECT 3, 'migration edits in vmangos/core@07c7832', '2025-02-25' \ | ||||
|     WHERE NOT EXISTS ( \ | ||||
|       SELECT 3 FROM \`world_db_corrections\` WHERE \`id\` = 3 \ | ||||
|     ); \ | ||||
|     INSERT INTO \`world_db_corrections\` (\`id\`, \`reason\`, \`date\`) \ | ||||
|     SELECT 4, 'migration edits in vmangos/core@f485dfa', '2025-03-22' \ | ||||
|     WHERE NOT EXISTS ( \ | ||||
|       SELECT 4 FROM \`world_db_corrections\` WHERE \`id\` = 4 \ | ||||
|     ); \ | ||||
|     INSERT INTO \`world_db_corrections\` (\`id\`, \`reason\`, \`date\`) \ | ||||
|     SELECT 5, 'migration edits in vmangos/core@33fcf97', '2025-07-05' \ | ||||
|     WHERE NOT EXISTS ( \ | ||||
|       SELECT 5 FROM \`world_db_corrections\` WHERE \`id\` = 5 \ | ||||
|     );" | ||||
| } | ||||
| 
 | ||||
| check_if_world_db_correction_is_required() { | ||||
|   local result=$(mariadb -u root -p"$MARIADB_ROOT_PASSWORD" "maintenance" -N -s -e \ | ||||
|     "WITH | ||||
|       db_creation AS ( | ||||
|         SELECT DATE(CONVERT_TZ(MIN(\`CREATE_TIME\`), @@session.time_zone, '+00:00')) as world_db_created_at | ||||
|         FROM \`INFORMATION_SCHEMA\`.\`TABLES\` | ||||
|         WHERE \`TABLE_SCHEMA\` = 'mangos' | ||||
|       ), | ||||
|       latest_correction AS ( | ||||
|         SELECT DATE(\`date\`) as correction_date, \`reason\`, \`is_applied\` | ||||
|         FROM \`world_db_corrections\` | ||||
|         WHERE \`id\` = (SELECT MAX(\`id\`) FROM \`world_db_corrections\`) | ||||
|       ) | ||||
|     SELECT CONCAT_WS('|', | ||||
|       IF( | ||||
|         NOT \`is_applied\` AND correction_date >= world_db_created_at, | ||||
|         'true', | ||||
|         'false' | ||||
|       ), | ||||
|       \`reason\` | ||||
|     ) | ||||
|     FROM latest_correction, db_creation;") | ||||
|   echo "$result" | ||||
| } | ||||
| 
 | ||||
| mark_world_db_corrections_as_applied() { | ||||
|   mariadb -u root -p"$MARIADB_ROOT_PASSWORD" "maintenance" -e \ | ||||
|     "UPDATE \`world_db_corrections\` SET \`is_applied\` = true;" | ||||
| } | ||||
| 
 | ||||
| process_custom_sql() { | ||||
|   local file_directory="$1" | ||||
| 
 | ||||
|   if [ ! -d "$file_directory" ]; then | ||||
|     echo "[vmangos-deploy]: WARNING: Custom SQL file directory '$file_directory' does not exist" >&2 | ||||
|     return 0 | ||||
|   fi | ||||
| 
 | ||||
|   file_count=$(find "$file_directory" -name "*.sql" -type f | wc -l) | ||||
|   echo "[vmangos-deploy]: Found $file_count custom SQL file(s) to process" | ||||
| 
 | ||||
|   if [ "$file_count" -gt 0 ]; then | ||||
|     find "$file_directory" -name "*.sql" -type f | sort | while read -r sql_file; do | ||||
|       echo "[vmangos-deploy]: Processing custom SQL file '$(basename "$sql_file")'" | ||||
| 
 | ||||
|       import_data "mangos" "$sql_file" | ||||
|       if [ $? -ne 0 ]; then | ||||
|         echo "[vmangos-deploy]: ERROR: Failed to process custom SQL file '$(basename "$sql_file")'" >&2 | ||||
|       fi | ||||
|     done | ||||
|   fi | ||||
| } | ||||
| @ -1,100 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| set -eo pipefail | ||||
| 
 | ||||
| source "$(which docker-entrypoint.sh)" | ||||
| 
 | ||||
| docker_mariadb_upgrade_including_user_tables() { | ||||
|   if [ -z "$MARIADB_AUTO_UPGRADE" ] \ | ||||
|     || [ "$MARIADB_AUTO_UPGRADE" = 0 ]; then | ||||
|     mysql_note "MariaDB upgrade (mariadb-upgrade or creating healthcheck users) required, but skipped due to \$MARIADB_AUTO_UPGRADE setting" | ||||
|     return | ||||
|   fi | ||||
|   mysql_note "Starting temporary server" | ||||
|   docker_temp_server_start "$@" --skip-grant-tables \ | ||||
|     --loose-innodb_buffer_pool_dump_at_shutdown=0 | ||||
|   mysql_note "Temporary server started." | ||||
| 
 | ||||
|   docker_mariadb_backup_system | ||||
| 
 | ||||
|   if [ ! -f "$DATADIR"/.my-healthcheck.cnf ]; then | ||||
|     mysql_note "Creating healthcheck users" | ||||
|     local createHealthCheckUsers | ||||
|     createHealthCheckUsers=$(create_healthcheck_users) | ||||
|     docker_process_sql --dont-use-mysql-root-password --binary-mode <<-EOSQL | ||||
|     -- Healthcheck users shouldn't be replicated | ||||
|     SET @@SESSION.SQL_LOG_BIN=0; | ||||
|                 -- we need the SQL_MODE NO_BACKSLASH_ESCAPES mode to be clear for the password to be set | ||||
|     SET @@SESSION.SQL_MODE=REPLACE(@@SESSION.SQL_MODE, 'NO_BACKSLASH_ESCAPES', ''); | ||||
|     FLUSH PRIVILEGES; | ||||
|     $createHealthCheckUsers | ||||
| EOSQL | ||||
|     mysql_note "Stopping temporary server" | ||||
|     docker_temp_server_stop | ||||
|     mysql_note "Temporary server stopped" | ||||
| 
 | ||||
|     if _check_if_upgrade_is_needed; then | ||||
|       # need a restart as FLUSH PRIVILEGES isn't reversable | ||||
|       mysql_note "Restarting temporary server for upgrade" | ||||
|       docker_temp_server_start "$@" --skip-grant-tables \ | ||||
|         --loose-innodb_buffer_pool_dump_at_shutdown=0 | ||||
|     else | ||||
|       return 0 | ||||
|     fi | ||||
|   fi | ||||
| 
 | ||||
|   mysql_note "Starting mariadb-upgrade" | ||||
|   mariadb-upgrade | ||||
|   mysql_note "Finished mariadb-upgrade" | ||||
| 
 | ||||
|   mysql_note "Stopping temporary server" | ||||
|   docker_temp_server_stop | ||||
|   mysql_note "Temporary server stopped" | ||||
| } | ||||
| 
 | ||||
| mysql_note "Custom entrypoint script for MariaDB Server ${MARIADB_VERSION} started." | ||||
| 
 | ||||
| mysql_check_config "$@" | ||||
| # Load various environment variables | ||||
| docker_setup_env "$@" | ||||
| docker_create_db_directories | ||||
| 
 | ||||
| # If container is started as root user, restart as dedicated mysql user | ||||
| if [ "$(id -u)" = "0" ]; then | ||||
|   mysql_note "Switching to dedicated user 'mysql'" | ||||
|   exec gosu mysql "${BASH_SOURCE[0]}" "$@" | ||||
| fi | ||||
| 
 | ||||
| # there's no database, so it needs to be initialized | ||||
| if [ -z "$DATABASE_ALREADY_EXISTS" ]; then | ||||
|   docker_verify_minimum_env | ||||
| 
 | ||||
|   docker_mariadb_init "$@" | ||||
| # run always-run hooks if they exist | ||||
| elif test -n "$(shopt -s nullglob; echo /always-initdb.d/*)"; then | ||||
|   # MDEV-27636 mariadb_upgrade --check-if-upgrade-is-needed cannot be run offline | ||||
|   #if mariadb-upgrade --check-if-upgrade-is-needed; then | ||||
|   if _check_if_upgrade_is_needed; then | ||||
|     docker_mariadb_upgrade_including_user_tables "$@" | ||||
|   fi | ||||
| 
 | ||||
|   mysql_note "Starting temporary server" | ||||
|   docker_temp_server_start "$@" | ||||
|   mysql_note "Temporary server started." | ||||
| 
 | ||||
|   docker_process_init_files /always-initdb.d/* | ||||
| 
 | ||||
|   mysql_note "Stopping temporary server" | ||||
|   docker_temp_server_stop | ||||
|   mysql_note "Temporary server stopped" | ||||
| 
 | ||||
|   echo | ||||
|   mysql_note "MariaDB init process done. Ready for start up." | ||||
|   echo | ||||
| # MDEV-27636 mariadb_upgrade --check-if-upgrade-is-needed cannot be run offline | ||||
| #elif mariadb-upgrade --check-if-upgrade-is-needed; then | ||||
| elif _check_if_upgrade_is_needed; then | ||||
|   docker_mariadb_upgrade_including_user_tables "$@" | ||||
| fi | ||||
| 
 | ||||
| exec "$@" | ||||
| @ -1,74 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| # vmangos-deploy | ||||
| # Copyright (C) 2023-2025  Michael Serajnik  https://github.com/mserajnik | ||||
| 
 | ||||
| # This program is free software: you can redistribute it and/or modify | ||||
| # it under the terms of the GNU Affero 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 Affero General Public License for more details. | ||||
| 
 | ||||
| # You should have received a copy of the GNU Affero General Public License | ||||
| # along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||
| 
 | ||||
| . "/opt/scripts/db-functions.sh" | ||||
| 
 | ||||
| if [ "${VMANGOS_ENABLE_AUTOMATIC_WORLD_DB_CORRECTIONS:-0}" = "1" ]; then | ||||
|   echo "[vmangos-deploy]: [x] Automatic world database corrections are enabled" | ||||
| else | ||||
|   echo "[vmangos-deploy]: [ ] Automatic world database corrections are disabled" | ||||
| fi | ||||
| 
 | ||||
| if [ "${VMANGOS_PROCESS_CUSTOM_SQL:-0}" = "1" ]; then | ||||
|   echo "[vmangos-deploy]: [x] Custom SQL processing is enabled" | ||||
| else | ||||
|   echo "[vmangos-deploy]: [ ] Custom SQL processing is disabled" | ||||
| fi | ||||
| 
 | ||||
| if [ "${VMANGOS_ENABLE_AUTOMATIC_WORLD_DB_CORRECTIONS:-0}" = "1" ]; then | ||||
|   create_database "maintenance" true | ||||
|   grant_permissions "maintenance" true | ||||
|   create_world_db_corrections_table | ||||
|   populate_world_db_corrections_table | ||||
| 
 | ||||
|   result=$(check_if_world_db_correction_is_required) | ||||
|   requires_correction=$(echo "$result" | cut -d'|' -f1) | ||||
|   reason=$(echo "$result" | cut -d'|' -f2) | ||||
| 
 | ||||
|   if [ "$requires_correction" = "true" ]; then | ||||
|     echo "[vmangos-deploy]: World database correction required because of $reason, re-creating world database" | ||||
| 
 | ||||
|     drop_database "mangos" | ||||
|     create_database "mangos" | ||||
|     grant_permissions "mangos" | ||||
|     import_dump "mangos" "/sql/world.sql" | ||||
|     mark_world_db_corrections_as_applied | ||||
|   fi | ||||
| else | ||||
|   echo "[vmangos-deploy]: Automatic world database corrections are disabled" | ||||
| 
 | ||||
|   drop_database "maintenance" true | ||||
| fi | ||||
| 
 | ||||
| if [ -e "$VMANGOS_WORLD_DB_DUMP_NEW_FILE" ]; then | ||||
|   echo "[vmangos-deploy]: '$VMANGOS_WORLD_DB_DUMP_NEW_FILE' exists, re-creating world database" | ||||
| 
 | ||||
|   drop_database "mangos" | ||||
|   create_database "mangos" | ||||
|   grant_permissions "mangos" | ||||
|   import_dump "mangos" "$VMANGOS_WORLD_DB_DUMP_NEW_FILE" | ||||
| fi | ||||
| 
 | ||||
| import_updates "mangos" "/sql/migrations/world_db_updates.sql" | ||||
| import_updates "characters" "/sql/migrations/characters_db_updates.sql" | ||||
| import_updates "realmd" "/sql/migrations/logon_db_updates.sql" | ||||
| import_updates "logs" "/sql/migrations/logs_db_updates.sql" | ||||
| 
 | ||||
| if [ "${VMANGOS_PROCESS_CUSTOM_SQL:-0}" = "1" ]; then | ||||
|   process_custom_sql "/sql/custom" | ||||
| fi | ||||
							
								
								
									
										130
									
								
								docker/entrypoint.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										130
									
								
								docker/entrypoint.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,130 @@ | ||||
| #!/usr/bin/env bash | ||||
| # | ||||
| 
 | ||||
| set -e | ||||
| 
 | ||||
| # Utils: | ||||
| # | ||||
| function _replace_conf() | ||||
| { | ||||
|     local SEARCH_FOR="${1}" | ||||
|     local REPLACE_WITH="${2}" | ||||
|     local FILENAME="${3}" | ||||
| 
 | ||||
|     sed -i "/^${SEARCH_FOR}/c\\${SEARCH_FOR} = ${REPLACE_WITH}" "${FILENAME}" | ||||
| } | ||||
| function _merge_confs() | ||||
| { | ||||
|     local FILENAME="${1}" | ||||
|     local CONFIG_FILE="${2}" | ||||
| 
 | ||||
|     while IFS='' read -r LINE || [[ -n "${LINE}" ]] | ||||
|     do | ||||
|         PROPERTY="$(echo "${LINE}" | cut -d '#' -f 1 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" | ||||
| 
 | ||||
|         if [[ -n "${PROPERTY}" ]] | ||||
|         then | ||||
|             local SEARCH_FOR="$(echo "${PROPERTY}" | cut -d '=' -f 1 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" | ||||
|             local REPLACE_WITH="$(echo "${PROPERTY}" | cut -d '=' -f 2- | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" | ||||
| 
 | ||||
|             _replace_conf "${SEARCH_FOR}" "${REPLACE_WITH}" "${FILENAME}" | ||||
|         fi | ||||
| 
 | ||||
|     done < "${CONFIG_FILE}" | ||||
| } | ||||
| 
 | ||||
| # Sub-functions: | ||||
| # | ||||
| function compose_mangosd_conf() | ||||
| { | ||||
|     local MANGOS_DBCONN="${MANGOS_DBHOST};${MANGOS_DBPORT};${MANGOS_DBUSER};${MANGOS_DBPASS}" | ||||
| 
 | ||||
|     cd "${MANGOS_DIR}/etc" | ||||
|     cp mangosd.conf.dist mangosd.conf | ||||
| 
 | ||||
|     _replace_conf "LoginDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_REALMD_DBNAME}\"" mangosd.conf | ||||
|     _replace_conf "WorldDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_WORLD_DBNAME}\"" mangosd.conf | ||||
|     _replace_conf "CharacterDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_CHARACTERS_DBNAME}\"" mangosd.conf | ||||
|     _replace_conf "LogsDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_LOGS_DBNAME}\"" mangosd.conf | ||||
| 
 | ||||
|     if [[ -f "/opt/mangos/conf/mangosd.conf" ]] | ||||
|     then | ||||
|         _merge_confs mangosd.conf "/opt/mangos/conf/mangosd.conf" | ||||
|     fi | ||||
| } | ||||
| function compose_realmd_conf() | ||||
| { | ||||
|     local MANGOS_DBCONN="${MANGOS_DBHOST};${MANGOS_DBPORT};${MANGOS_DBUSER};${MANGOS_DBPASS}" | ||||
| 
 | ||||
|     cd "${MANGOS_DIR}/etc" | ||||
|     cp realmd.conf.dist realmd.conf | ||||
| 
 | ||||
|     _replace_conf "LoginDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_REALMD_DBNAME}\"" realmd.conf | ||||
| 
 | ||||
|     if [[ -f "/opt/mangos/conf/realmd.conf" ]] | ||||
|     then | ||||
|         _merge_confs realmd.conf "/opt/mangos/conf/realmd.conf" | ||||
|     fi | ||||
| } | ||||
| 
 | ||||
| function set_timezone() | ||||
| { | ||||
|     ln -snf "/usr/share/zoneinfo/${TZ}" /etc/localtime | ||||
|     echo "${TZ}" > /etc/timezone | ||||
| 
 | ||||
|     dpkg-reconfigure --frontend noninteractive tzdata &> /dev/null | ||||
| } | ||||
| 
 | ||||
| function wait_for_database() | ||||
| { | ||||
|     wait-for-it -h "${MANGOS_DBHOST}" -p "${MANGOS_DBPORT}" | ||||
| } | ||||
| 
 | ||||
| # Main functions: | ||||
| # | ||||
| function init_runner() | ||||
| { | ||||
|     set_timezone | ||||
| 
 | ||||
|     compose_mangosd_conf | ||||
|     compose_realmd_conf | ||||
| } | ||||
| 
 | ||||
| function run_mangosd() | ||||
| { | ||||
|     cd "${MANGOS_DIR}/bin" | ||||
| 
 | ||||
|     gosu mangos ./mangosd | ||||
| } | ||||
| function run_realmd() | ||||
| { | ||||
|     cd "${MANGOS_DIR}/bin" | ||||
| 
 | ||||
|     gosu mangos ./realmd | ||||
| } | ||||
| 
 | ||||
| # Execution: | ||||
| # | ||||
| init_runner | ||||
| 
 | ||||
| case "${1}" in | ||||
|     mangosd) | ||||
|         shift | ||||
| 
 | ||||
|         wait_for_database | ||||
|         run_mangosd ${@} | ||||
|         ;; | ||||
|     realmd) | ||||
|         shift | ||||
| 
 | ||||
|         wait_for_database | ||||
|         run_realmd ${@} | ||||
|         ;; | ||||
|     *) | ||||
|         cd "${HOME_DIR}" | ||||
| 
 | ||||
|         exec ${@} | ||||
|         ;; | ||||
| esac | ||||
| 
 | ||||
| exit 1 | ||||
							
								
								
									
										38
									
								
								docker/run.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										38
									
								
								docker/run.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,38 @@ | ||||
| #!/usr/bin/env bash | ||||
| # | ||||
| 
 | ||||
| set -e | ||||
| 
 | ||||
| readonly BASE_DIR="$(realpath "$(dirname "${0}")/..")" | ||||
| source "${BASE_DIR}/.env" | ||||
| 
 | ||||
| readonly NAME="cmangos-runner" | ||||
| readonly IMAGE="ghcr.io/byloth/cmangos/${WOW_VERSION}" | ||||
| readonly VERSION="latest" | ||||
| 
 | ||||
| readonly DATA_VOLUME="cmangos_mangosd_data" | ||||
| readonly NETWORK="cmangos_default" | ||||
| 
 | ||||
| if [[ -t 0 ]] && [[ -t 1 ]] | ||||
| then | ||||
|     readonly TTY="-it" | ||||
| else | ||||
|     readonly TTY="-i" | ||||
| fi | ||||
| 
 | ||||
| docker run ${TTY} \ | ||||
|            --name "${NAME}" \ | ||||
|            --network "${NETWORK}" \ | ||||
|            --rm \ | ||||
|            -e MANGOS_DBHOST="mariadb" \ | ||||
|            -e MANGOS_DBUSER="${MANGOS_DBUSER}" \ | ||||
|            -e MANGOS_DBPASS="${MANGOS_DBPASS}" \ | ||||
|            -p 3443:3443 \ | ||||
|            -p 3724:3724 \ | ||||
|            -p 7878:7878 \ | ||||
|            -p 8085:8085 \ | ||||
|            -p 8086:8086 \ | ||||
|            -v "${PWD}/config":/opt/mangos/conf:ro \ | ||||
|            -v "${DATA_VOLUME}":/var/lib/mangos:ro \ | ||||
|     \ | ||||
|     "${IMAGE}:${VERSION}" ${@} | ||||
| @ -1,142 +0,0 @@ | ||||
| ARG DEBIAN_FRONTEND=noninteractive | ||||
| ARG VMANGOS_CLIENT_VERSION=5875 | ||||
| ARG VMANGOS_REPOSITORY_URL=https://github.com/vmangos/core.git | ||||
| ARG VMANGOS_REVISION=development | ||||
| ARG VMANGOS_PATCHES_REPOSITORY_URL | ||||
| ARG VMANGOS_USER_ID=1000 | ||||
| ARG VMANGOS_GROUP_ID=1000 | ||||
| ARG VMANGOS_USER_NAME=vmangos | ||||
| ARG VMANGOS_GROUP_NAME=vmangos | ||||
| 
 | ||||
| FROM ubuntu:24.04 AS build | ||||
| 
 | ||||
| ARG DEBIAN_FRONTEND | ||||
| ARG VMANGOS_CLIENT_VERSION | ||||
| ARG VMANGOS_REPOSITORY_URL | ||||
| ARG VMANGOS_REVISION | ||||
| ARG VMANGOS_PATCHES_REPOSITORY_URL | ||||
| 
 | ||||
| RUN \ | ||||
|   apt update -y && \ | ||||
|   apt install -y \ | ||||
|     build-essential \ | ||||
|     cmake \ | ||||
|     git \ | ||||
|     libace-dev \ | ||||
|     libcurl4-openssl-dev \ | ||||
|     libmysqlclient-dev \ | ||||
|     libssl-dev \ | ||||
|     libtbb-dev \ | ||||
|     zlib1g-dev && \ | ||||
|   git clone "${VMANGOS_REPOSITORY_URL}" /core && \ | ||||
|   cd /core && \ | ||||
|   git checkout "${VMANGOS_REVISION}" && \ | ||||
|   if [ -n "${VMANGOS_PATCHES_REPOSITORY_URL}" ]; then \ | ||||
|     echo "Cloning and applying patches from ${VMANGOS_PATCHES_REPOSITORY_URL}"; \ | ||||
|     git clone "${VMANGOS_PATCHES_REPOSITORY_URL}" /tmp/patches && \ | ||||
|     for patch in /tmp/patches/*.patch; do \ | ||||
|       if [ -f "${patch}" ]; then \ | ||||
|         echo "Applying patch ${patch}"; \ | ||||
|         git apply "${patch}"; \ | ||||
|       fi; \ | ||||
|     done; \ | ||||
|     rm -rf /tmp/patches; \ | ||||
|   else \ | ||||
|     echo "No repository to apply patches from provided."; \ | ||||
|   fi && \ | ||||
|   mkdir -p \ | ||||
|     /opt/vmangos/config \ | ||||
|     /opt/vmangos/storage/data \ | ||||
|     /opt/vmangos/storage/honor \ | ||||
|     /opt/vmangos/storage/logs && \ | ||||
|   mkdir /core/build && \ | ||||
|   cd /core/build && \ | ||||
|   cmake \ | ||||
|     -DCMAKE_INSTALL_PREFIX=/opt/vmangos ../ \ | ||||
|     -DUSE_PCH=1 \ | ||||
|     -DUSE_STD_MALLOC=0 \ | ||||
|     -DBUILD_FOR_HOST_CPU=0 \ | ||||
|     -DTBB_DEBUG=0 \ | ||||
|     -DUSE_SCRIPTS=1 \ | ||||
|     -DUSE_EXTRACTORS=1 \ | ||||
|     -DUSE_REALMMERGE=0 \ | ||||
|     -DENABLE_MAILSENDER=1 \ | ||||
|     -DSUPPORTED_CLIENT_BUILD=${VMANGOS_CLIENT_VERSION} \ | ||||
|     -DDEBUG_SYMBOLS=0 && \ | ||||
|   make -j$(nproc) && \ | ||||
|   make install && \ | ||||
|   rm -rf /core && \ | ||||
|   apt clean -y && \ | ||||
|   rm -rf /var/lib/apt/lists/* | ||||
| 
 | ||||
| FROM ubuntu:24.04 | ||||
| 
 | ||||
| ARG DEBIAN_FRONTEND | ||||
| ARG TARGETARCH | ||||
| ARG VMANGOS_CLIENT_VERSION | ||||
| ARG VMANGOS_USER_ID | ||||
| ARG VMANGOS_GROUP_ID | ||||
| ARG VMANGOS_USER_NAME | ||||
| ARG VMANGOS_GROUP_NAME | ||||
| 
 | ||||
| ENV PYTHONUNBUFFERED=1 | ||||
| ENV VMANGOS_CLIENT_VERSION=${VMANGOS_CLIENT_VERSION} | ||||
| 
 | ||||
| RUN \ | ||||
|   apt update -y && \ | ||||
|   apt install -y \ | ||||
|     curl \ | ||||
|     libace-7.1.2 \ | ||||
|     libcurl4 \ | ||||
|     libmysqlclient21 \ | ||||
|     libssl3 \ | ||||
|     libtbb12 \ | ||||
|     netcat-openbsd \ | ||||
|     python3 \ | ||||
|     python-is-python3 \ | ||||
|     zlib1g && \ | ||||
|   existing_group=$(getent group "${VMANGOS_GROUP_ID}") || true && \ | ||||
|   existing_user=$(getent passwd "${VMANGOS_USER_ID}") || true && \ | ||||
|   if [ -n "${existing_group}" ]; then \ | ||||
|     old_groupname=$(echo "${existing_group}" | cut -d: -f1) && \ | ||||
|     groupmod -n "${VMANGOS_GROUP_NAME}" "${old_groupname}"; \ | ||||
|   else \ | ||||
|     groupadd -g "${VMANGOS_GROUP_ID}" "${VMANGOS_GROUP_NAME}"; \ | ||||
|   fi && \ | ||||
|   if [ -n "${existing_user}" ]; then \ | ||||
|     old_username=$(echo "${existing_user}" | cut -d: -f1) && \ | ||||
|     usermod -l "${VMANGOS_USER_NAME}" -d "/home/${VMANGOS_USER_NAME}" "${old_username}" && \ | ||||
|     mv "/home/${old_username}" "/home/${VMANGOS_USER_NAME}"; \ | ||||
|   else \ | ||||
|     useradd -u "${VMANGOS_USER_ID}" -g "${VMANGOS_GROUP_NAME}" -d "/home/${VMANGOS_USER_NAME}" -s /bin/sh -m "${VMANGOS_USER_NAME}"; \ | ||||
|   fi && \ | ||||
|   # See https://github.com/boxboat/fixuid | ||||
|   curl -SsL https://github.com/boxboat/fixuid/releases/download/v0.6.0/fixuid-0.6.0-linux-${TARGETARCH}.tar.gz | tar -C /usr/local/bin -xzf - && \ | ||||
|   chown root:root /usr/local/bin/fixuid && \ | ||||
|   chmod 4755 /usr/local/bin/fixuid && \ | ||||
|   mkdir -p /etc/fixuid && \ | ||||
|   printf "user: ${VMANGOS_USER_NAME}\ngroup: ${VMANGOS_GROUP_NAME}\n" > /etc/fixuid/config.yml && \ | ||||
|   apt remove -y curl && \ | ||||
|   apt autoremove -y && \ | ||||
|   apt clean -y && \ | ||||
|   rm -rf /var/lib/apt/lists/* | ||||
| 
 | ||||
| COPY --from=build --chown=${VMANGOS_USER_NAME}:${VMANGOS_GROUP_NAME} /opt /opt | ||||
| 
 | ||||
| # See https://github.com/ufoscout/docker-compose-wait | ||||
| COPY --from=ghcr.io/ufoscout/docker-compose-wait:latest /wait /usr/local/bin/wait-for-db | ||||
| 
 | ||||
| COPY ./docker/server/docker-cmd-mangosd.sh /usr/local/bin/mangosd | ||||
| COPY ./docker/server/docker-cmd-realmd.sh /usr/local/bin/realmd | ||||
| COPY ./docker/server/docker-cmd-extract-client-data.sh /usr/local/bin/extract-client-data | ||||
| 
 | ||||
| RUN \ | ||||
|   chmod +x /opt/vmangos/bin/* && \ | ||||
|   find /opt/vmangos/bin/Extractors/ -type f ! -regex ".*\.\(json\|txt\)$" -exec chmod +x {} + && \ | ||||
|   chmod +x /usr/local/bin/mangosd && \ | ||||
|   chmod +x /usr/local/bin/realmd && \ | ||||
|   chmod +x /usr/local/bin/extract-client-data | ||||
| 
 | ||||
| USER ${VMANGOS_USER_NAME}:${VMANGOS_GROUP_NAME} | ||||
| 
 | ||||
| CMD ["mangosd"] | ||||
| @ -1,73 +0,0 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| eval $(fixuid -q) | ||||
| 
 | ||||
| client_data_dir="/opt/vmangos/storage/client-data" | ||||
| extracted_data_dir="/opt/vmangos/storage/extracted-data" | ||||
| extractors_dir="/opt/vmangos/bin/Extractors" | ||||
| client_version_dir="$extracted_data_dir/$VMANGOS_CLIENT_VERSION" | ||||
| 
 | ||||
| # The `--force` flag can be used to skip the confirmation prompt when | ||||
| # previously extracted data is found. This is particularly useful for | ||||
| # automation where the user is not able to interact with the prompt. | ||||
| force=false | ||||
| 
 | ||||
| while [ "$#" -gt 0 ]; do | ||||
|   case "$1" in | ||||
|     -f|--force) | ||||
|       # If user passes `-f` or `--force`, set 'force' to true | ||||
|       force=true | ||||
|       shift | ||||
|       ;; | ||||
|     *) | ||||
|       shift | ||||
|       ;; | ||||
|   esac | ||||
| done | ||||
| 
 | ||||
| if [ ! -d "$client_data_dir" ] || [ ! -d "$client_data_dir/Data" ]; then | ||||
|   echo "[vmangos-deploy]: ERROR: Client data not found in '$client_data_dir', aborting extraction" >&2 | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| if [ ! -d "$extracted_data_dir" ]; then | ||||
|   echo "[vmangos-deploy]: ERROR: Extracted data target directory '$extracted_data_dir' doesn't exist, aborting extraction" >&2 | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| cd "$client_data_dir" | ||||
| 
 | ||||
| if [ "$force" = false ]; then | ||||
|   if [ -d "$extracted_data_dir/maps" ] || [ -d "$extracted_data_dir/mmaps" ] || [ -d "$extracted_data_dir/vmaps" ] || [ -d "$client_version_dir" ]; then | ||||
|     echo "[vmangos-deploy]: Previously extracted data has been found in '$extracted_data_dir'; continue with the extraction (which will overwrite the old data)? [Y/n]" | ||||
| 
 | ||||
|     read -r choice | ||||
|     choice=$(echo "${choice:-y}" | tr -d '[:space:]') | ||||
|     if [ "$choice" = "n" ] || [ "$choice" = "N" ]; then | ||||
|       echo "[vmangos-deploy]: Aborting extraction" | ||||
|       exit 1 | ||||
|     fi | ||||
|   fi | ||||
| fi | ||||
| 
 | ||||
| # Remove any potentially previously extracted data from the client directory | ||||
| rm -rf ./Buildings ./Cameras ./dbc ./maps ./mmaps ./vmaps | ||||
| 
 | ||||
| "$extractors_dir/MapExtractor" | ||||
| "$extractors_dir/VMapExtractor" | ||||
| "$extractors_dir/VMapAssembler" | ||||
| "$extractors_dir/mmap_extract.py" \ | ||||
|   --configInputPath "$extractors_dir/config.json" \ | ||||
|   --offMeshInput "$extractors_dir/offmesh.txt" | ||||
| 
 | ||||
| # Delete extracted data that is no longer needed after processing it to avoid | ||||
| # confusion | ||||
| rm -rf ./Buildings ./Cameras | ||||
| 
 | ||||
| # Remove any potentially already existing data from the extracted data | ||||
| # directory before moving the new data there | ||||
| rm -rf "$extracted_data_dir"/* | ||||
| 
 | ||||
| mkdir -p "$client_version_dir" | ||||
| mv ./dbc "$client_version_dir/" | ||||
| mv ./maps ./mmaps ./vmaps "$extracted_data_dir/" | ||||
| @ -1,12 +0,0 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| eval $(fixuid -q) | ||||
| 
 | ||||
| config_file="/opt/vmangos/config/mangosd.conf" | ||||
| 
 | ||||
| if [ ! -f "$config_file" ]; then | ||||
|   echo "[vmangos-deploy]: ERROR: Configuration file '$config_file' is missing, exiting" >&2 | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| WAIT_LOGGER_LEVEL=error wait-for-db && exec /opt/vmangos/bin/mangosd -c $config_file | ||||
| @ -1,12 +0,0 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| eval $(fixuid -q) | ||||
| 
 | ||||
| config_file="/opt/vmangos/config/realmd.conf" | ||||
| 
 | ||||
| if [ ! -f "$config_file" ]; then | ||||
|   echo "[vmangos-deploy]: ERROR: Configuration file '$config_file' is missing, exiting" >&2 | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| WAIT_LOGGER_LEVEL=error wait-for-db && exec /opt/vmangos/bin/realmd -c $config_file | ||||
| @ -1,91 +0,0 @@ | ||||
| -- Start a transaction to ensure that all changes are applied atomically | ||||
| START TRANSACTION; | ||||
| 
 | ||||
| -- Truncate the table to make these changes idempotent | ||||
| TRUNCATE `auctionhousebot`; | ||||
| 
 | ||||
| -- Insert all the default rows for the `auctionhousebot` table (to not cause | ||||
| -- issues if this example is accidentally enabled by removing the `.example` | ||||
| -- suffix from the file name) | ||||
| INSERT INTO `auctionhousebot` (`item`, `stack`, `bid`, `buyout`) VALUES | ||||
| (4687, 1, 1500, 5000),       -- https://www.wowhead.com/classic/item=4687/barbaric-cloth-belt | ||||
| (2770, 20, 25000, 75000),    -- https://www.wowhead.com/classic/item=2770/copper-ore | ||||
| (2881, 1, 5000, 150000),     -- https://www.wowhead.com/classic/item=2881/plans-runed-copper-breastplate | ||||
| (2589, 20, 37500, 50000),    -- https://www.wowhead.com/classic/item=2589/linen-cloth | ||||
| (2592, 20, 100000, 150000),  -- https://www.wowhead.com/classic/item=2592/wool-cloth | ||||
| (4306, 20, 37500, 50000),    -- https://www.wowhead.com/classic/item=4306/silk-cloth | ||||
| (4338, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=4338/mageweave-cloth | ||||
| (14047, 20, 100000, 150000), -- https://www.wowhead.com/classic/item=14047/runecloth | ||||
| (2318, 20, 30000, 200000),   -- https://www.wowhead.com/classic/item=2318/light-leather | ||||
| (2319, 20, 30000, 200000),   -- https://www.wowhead.com/classic/item=2319/medium-leather | ||||
| (4234, 20, 100000, 150000),  -- https://www.wowhead.com/classic/item=4234/heavy-leather | ||||
| (4304, 20, 50000, 75000),    -- https://www.wowhead.com/classic/item=4304/thick-leather | ||||
| (8170, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=8170/rugged-leather | ||||
| (2835, 20, 3750, 5000),      -- https://www.wowhead.com/classic/item=2835/rough-stone | ||||
| (2836, 20, 5000, 15000),     -- https://www.wowhead.com/classic/item=2836/coarse-stone | ||||
| (2838, 20, 50000, 75000),    -- https://www.wowhead.com/classic/item=2838/heavy-stone | ||||
| (7912, 20, 10000, 15000),    -- https://www.wowhead.com/classic/item=7912/solid-stone | ||||
| (12365, 20, 10000, 15000),   -- https://www.wowhead.com/classic/item=12365/dense-stone | ||||
| (2770, 20, 50000, 75000),    -- https://www.wowhead.com/classic/item=2770/copper-ore (this is a duplicate in the default data) | ||||
| (2775, 1, 50000, 75000),     -- https://www.wowhead.com/classic/item=2775/silver-ore | ||||
| (2771, 20, 100000, 150000),  -- https://www.wowhead.com/classic/item=2771/tin-ore | ||||
| (2776, 1, 37500, 50000),     -- https://www.wowhead.com/classic/item=2776/gold-ore | ||||
| (2772, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=2772/iron-ore | ||||
| (7911, 1, 50000, 75000),     -- https://www.wowhead.com/classic/item=7911/truesilver-ore | ||||
| (3858, 20, 400000, 600000),  -- https://www.wowhead.com/classic/item=3858/mithril-ore | ||||
| (10620, 20, 400000, 600000), -- https://www.wowhead.com/classic/item=10620/thorium-ore | ||||
| (765, 20, 10000, 15000),     -- https://www.wowhead.com/classic/item=765/silverleaf | ||||
| (2447, 20, 20000, 30000),    -- https://www.wowhead.com/classic/item=2447/peacebloom | ||||
| (785, 20, 100000, 150000),   -- https://www.wowhead.com/classic/item=785/mageroyal | ||||
| (2449, 20, 20000, 30000),    -- https://www.wowhead.com/classic/item=2449/earthroot | ||||
| (2452, 20, 100000, 150000),  -- https://www.wowhead.com/classic/item=2452/swiftthistle | ||||
| (2450, 20, 100000, 150000),  -- https://www.wowhead.com/classic/item=2450/briarthorn | ||||
| (2453, 20, 100000, 150000),  -- https://www.wowhead.com/classic/item=2453/bruiseweed | ||||
| (3820, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=3820/stranglekelp | ||||
| (3355, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=3355/wild-steelbloom | ||||
| (3369, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=3369/grave-moss | ||||
| (3356, 20, 100000, 150000),  -- https://www.wowhead.com/classic/item=3356/kingsblood | ||||
| (3357, 20, 100000, 150000),  -- https://www.wowhead.com/classic/item=3357/liferoot | ||||
| (3818, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=3818/fadeleaf | ||||
| (3821, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=3821/goldthorn | ||||
| (3358, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=3358/khadgars-whisker | ||||
| (3819, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=3819/wintersbite | ||||
| (8153, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=8153/wildvine | ||||
| (4625, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=4625/firebloom | ||||
| (8831, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=8831/purple-lotus | ||||
| (8836, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=8836/arthas-tears | ||||
| (8838, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=8838/sungrass | ||||
| (8839, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=8839/blindweed | ||||
| (8845, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=8845/ghost-mushroom | ||||
| (8846, 20, 200000, 300000),  -- https://www.wowhead.com/classic/item=8846/gromsblood | ||||
| (13463, 20, 200000, 300000), -- https://www.wowhead.com/classic/item=13463/dreamfoil | ||||
| (13464, 20, 200000, 300000), -- https://www.wowhead.com/classic/item=13464/golden-sansam | ||||
| (13465, 20, 200000, 300000), -- https://www.wowhead.com/classic/item=13465/mountain-silversage | ||||
| (13466, 20, 200000, 300000), -- https://www.wowhead.com/classic/item=13466/plaguebloom | ||||
| (13467, 20, 200000, 300000), -- https://www.wowhead.com/classic/item=13467/icecap | ||||
| (13468, 1, 100000, 150000),  -- https://www.wowhead.com/classic/item=13468/black-lotus | ||||
| (6338, 1, 10000, 15000),     -- https://www.wowhead.com/classic/item=6338/silver-rod | ||||
| (11128, 1, 20000, 30000),    -- https://www.wowhead.com/classic/item=11128/golden-rod | ||||
| (11144, 1, 100000, 150000),  -- https://www.wowhead.com/classic/item=11144/truesilver-rod | ||||
| (16206, 1, 500000, 750000),  -- https://www.wowhead.com/classic/item=16206/arcanite-rod | ||||
| (10978, 1, 3750, 5000),      -- https://www.wowhead.com/classic/item=10978/small-glimmering-shard | ||||
| (11084, 1, 3750, 5000),      -- https://www.wowhead.com/classic/item=11084/large-glimmering-shard | ||||
| (11138, 1, 3750, 5000),      -- https://www.wowhead.com/classic/item=11138/small-glowing-shard | ||||
| (11139, 1, 3750, 5000),      -- https://www.wowhead.com/classic/item=11139/large-glowing-shard | ||||
| (11177, 1, 50000, 75000),    -- https://www.wowhead.com/classic/item=11177/small-radiant-shard | ||||
| (11178, 1, 100000, 150000),  -- https://www.wowhead.com/classic/item=11178/large-radiant-shard | ||||
| (14343, 1, 10000, 15000),    -- https://www.wowhead.com/classic/item=14343/small-brilliant-shard | ||||
| (14344, 1, 50000, 75000),    -- https://www.wowhead.com/classic/item=14344/large-brilliant-shard | ||||
| (20725, 1, 10000, 15000),    -- https://www.wowhead.com/classic/item=20725/nexus-crystal | ||||
| (10938, 10, 15000, 25000),   -- https://www.wowhead.com/classic/item=10938/lesser-magic-essence | ||||
| (10998, 10, 20000, 30000),   -- https://www.wowhead.com/classic/item=10998/lesser-astral-essence | ||||
| (11134, 10, 22500, 35000),   -- https://www.wowhead.com/classic/item=11134/lesser-mystic-essence | ||||
| (11174, 10, 300000, 450000), -- https://www.wowhead.com/classic/item=11174/lesser-nether-essence | ||||
| (16202, 10, 400000, 600000), -- https://www.wowhead.com/classic/item=16202/lesser-eternal-essence | ||||
| (10940, 20, 50000, 75000),   -- https://www.wowhead.com/classic/item=10940/strange-dust | ||||
| (11083, 20, 50000, 75000),   -- https://www.wowhead.com/classic/item=11083/soul-dust | ||||
| (11137, 20, 200000, 300000), -- https://www.wowhead.com/classic/item=11137/vision-dust | ||||
| (11176, 20, 40000, 60000);   -- https://www.wowhead.com/classic/item=11176/dream-dust | ||||
| 
 | ||||
| -- End the transaction | ||||
| COMMIT; | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	