diff --git a/dist/docker/server/debian/common/autostart.sh b/dist/docker/server/debian/common/autostart.sh new file mode 100755 index 000000000..6b2af074c --- /dev/null +++ b/dist/docker/server/debian/common/autostart.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +declare METHOD_START=$1 + +/etc/init.d/mysql restart +/etc/init.d/apache2 restart +/etc/init.d/ssh restart +source /opt/shard.sh + +tmp=$(hostname -I) +export addressip=${tmp//[[:blank:]]/} +sed -i -r 's/(FSListenHost)(.*)(=)(.*)(;)/FSListenHost = "'"$addressip"'";/g' $KHANAT_PATH/server/frontend_service.cfg || exit 2 + +if [[ $METHOD_START -eq 1 ]] +then + export RYZOM_PATH=$KHANAT_PATH + /home/gameserver/khanat/tools/scripts/linux/shard start +elif [[ $METHOD_START -eq 2 ]] +then + bash /opt/launch_services.sh + sleep 10 + tail -f /home/gameserver/khanat/server/log/log.log +else + bash /opt/launch_services.sh + sleep 10 + watch cat /home/gameserver/khanat/server/aes_nagios_report.txt +fi diff --git a/dist/docker/server/debian/common/init-basic.sh b/dist/docker/server/debian/common/init-basic.sh index 50145ac64..125a239ff 100755 --- a/dist/docker/server/debian/common/init-basic.sh +++ b/dist/docker/server/debian/common/init-basic.sh @@ -133,6 +133,8 @@ like : --------------------------------------------------- mysql : account root (no password) +--------------------------------------------------- +log khanat server : /home/gameserver/khanat/server/log/log.log *************************************************** EOF diff --git a/dist/docker/server/debian/common/init-khanat.sh b/dist/docker/server/debian/common/init-khanat.sh index fb8b99235..81bcc0798 100755 --- a/dist/docker/server/debian/common/init-khanat.sh +++ b/dist/docker/server/debian/common/init-khanat.sh @@ -11,7 +11,7 @@ cd /opt; tar xzf ryzom-ressources.tar.gz || exit 2 cat << EOF > /opt/shard.sh export KHANAT_HOME=/home/gameserver export KHANAT_PATH=/home/gameserver/khanat -export PATH=\$PATH:/usr/local/bin:\$KHANAT_PATH/tools/scripts/linux +export PATH=\$PATH:/usr/local/bin:/usr/local/sbin:\$KHANAT_PATH/tools/scripts/linux export KHANAT_DATA=/home/gameserver/khanat-ressources export PATCH_HOME=/home/gameserver export PATCH_CLIENT_SYSTEM=\$PATCH_HOME/patch_service @@ -245,8 +245,7 @@ ln -s $KHANAT_DATA/shard/egs/named_items.txt $KHANAT_PATH/server/data_shard/name mkdir -p $KHANAT_DATA/mirror_sheets cp -r /opt/code/ryzom/server/data_shard/mirror_sheets/* $KHANAT_DATA/mirror_sheets - -# -c/usr/local/etc/nel/make_sheet_id.cfg <---- ne marche pas ! +# Generate data cd /usr/local; /usr/local/bin/make_sheet_id \ -o$KHANAT_DATA/leveldesign/game_elem/sheet_id.bin \ $KHANAT_DATA/leveldesign/game_elem \ @@ -280,7 +279,7 @@ EOF cp -r /opt/code/ryzom/common/* /opt/sheets_packer/common || exit 2 cp -r $KHANAT_DATA/* /opt/sheets_packer/khanat-ressources || exit 2 cp -r /opt/code/ryzom/client/* /opt/sheets_packer/client || exit 2 -cd /opt/sheets_packer; sheets_packer 1>/opt/sheets_packer/sheets_packer.log 2>/opt/sheets_packer/sheets_packer.err || exit 2 +cd /opt/sheets_packer; sheets_packer || exit 2 cp /opt/sheets_packer/visual_slot.tab $KHANAT_PATH/common/data_common/visual_slot.tab || exit 2 cp /opt/sheets_packer/visual_slot.tab $KHANAT_PATH/client/data/visual_slot.tab || exit 2 @@ -292,31 +291,10 @@ for var in $KHANAT_DATA/translation/translated/*_wk.txt; do nomfic=${var##*/}; cp /opt/code/ryzom/server/shard.screen.rc $KHANAT_PATH/server/shard.screen.rc ln -s /usr/local /home/gameserver/build +## Initialize ssh /etc/init.d/ssh restart -cp /usr/local/sbin/* /usr/local/bin -cat << EOF -source /opt/shard.sh -/home/gameserver/khanat/tools/scripts/linux/shard -EOF - -cat << EOF > /opt/autostart.sh -#!/bin/bash -/etc/init.d/mysql restart -/etc/init.d/apache2 restart -/etc/init.d/ssh restart -source /opt/shard.sh - -tmp=\$(hostname -I) -export addressip=\${tmp//[[:blank:]]/} -sed -i -r 's/(FSListenHost)(.*)(=)(.*)(;)/FSListenHost = "'"\$addressip"'";/g' \$KHANAT_PATH/server/frontend_service.cfg || exit 2 - -export RYZOM_PATH=\$KHANAT_PATH -/home/gameserver/khanat/tools/scripts/linux/shard start -EOF - -chmod +x /opt/autostart.sh - +# create default directory for rrd data mkdir -p $KHANAT_PATH/server/save_shard/rrd_graphs @@ -478,7 +456,7 @@ then fi # Generate patch -su -c "cd $PATCH_HOME/patch_service; patch_gen updateProduct patch_game/ryzom.xml > patch_game/generate.log 2>&1" gameserver || exit 2 +su -c "cd $PATCH_HOME/patch_service; patch_gen updateProduct patch_game/ryzom.xml" gameserver || exit 2 # Edit release note cat << EOF > $PATCH_HOME/patch_service/patch_game/patch/index.php diff --git a/dist/docker/server/debian/common/launch_services.sh b/dist/docker/server/debian/common/launch_services.sh new file mode 100755 index 000000000..78fdba425 --- /dev/null +++ b/dist/docker/server/debian/common/launch_services.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# +# Script to launch automatically khaganat +# +# +# ref : shard.screen.rc + +mkdir -p /home/gameserver/khanat/server/log +cd /home/gameserver/khanat/server/log + +function start_stop() +{ + nameservice=$1 + mkdir -p /home/gameserver/khanat/server/${nameservice} + printf RUNNING > /home/gameserver/khanat/server/${nameservice}/${nameservice}.state + nohup $2 + printf STOPPED > /home/gameserver/khanat/server/${nameservice}/${nameservice}.state +} + +function launch_service() +{ + nameservice=$1 + start_stop "$1" "$2" 1>/dev/null 2>&1 & + #nohup $2 1>/dev/null 2>&1 & + #echo "$!" > /home/gameserver/khanat/server/$1.pid + #printf RUNNING > /home/gameserver/khanat/server/${nameservice}/${nameservice}.state +} + +# aes : admin_executor_service.log +launch_service 'aes' 'ryzom_admin_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --fulladminname=admin_executor_service --shortadminname=AES' + +# bms_master : backup_service.log +launch_service 'bms_master' 'ryzom_backup_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid -P49990' + +# bms_pd_master +# launch_service 'bms_pd_master' 'ryzom_backup_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid -P49992' + +# egs : entities_game_service.log +launch_service 'egs' 'ryzom_entities_game_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + +# gpms : gpm_service.log +launch_service 'gpms' 'ryzom_gpm_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + +# ios : input_output_service.log +launch_service 'ios' 'ryzom_ios_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + +# rns : naming_service.log +launch_service 'rns' 'ryzom_naming_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + +# rws : welcome_service.log +launch_service 'rws' 'ryzom_welcome_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + +# ts : tick_service.log +launch_service 'ts' 'ryzom_tick_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + +# ms : mirror_service.log +launch_service 'ms' 'ryzom_mirror_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + +# ais_newbyland : ai_service.log +launch_service 'ais_newbyland' 'ryzom_ai_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid -mCommon:Newbieland:Post' + +# mfs : mail_forum_service.log +launch_service 'mfs' 'ryzom_mail_forum_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + +# su : shard_unifier_service.log +launch_service 'su' 'ryzom_shard_unifier_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + +# fes : frontend_service.log +launch_service 'fes' 'ryzom_frontend_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + +# sbs : session_browser_server.log +launch_service 'sbs' 'ryzom_session_browser_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + +# lgs : logger_service.log +launch_service 'lgs' 'ryzom_logger_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + +# mos +# launch_service 'mos' 'ryzom_monitor_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + +# pdss +#launch_service 'pdss' 'ryzom_pd_support_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + +# ras : admin_service.log +launch_service 'ras' 'ryzom_admin_service --fulladminname=admin_service --shortadminname=AS -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid' + + diff --git a/dist/docker/server/debian/jessie/x86_64/Dockerfile.khanat b/dist/docker/server/debian/jessie/x86_64/Dockerfile.khanat index a52a925ab..b907e3bae 100644 --- a/dist/docker/server/debian/jessie/x86_64/Dockerfile.khanat +++ b/dist/docker/server/debian/jessie/x86_64/Dockerfile.khanat @@ -13,6 +13,8 @@ ENV HOSTNAME khanat_server COPY todelete.sh /opt/khanat_config.sh COPY dist/docker/server/debian/common/init-khanat.sh /opt/ +COPY dist/docker/server/debian/common/autostart.sh /opt/ +COPY dist/docker/server/debian/common/launch_services.sh /opt/ COPY ryzomcore.tar.gz /opt/ COPY ryzom-ressources.tar.gz /opt/ COPY khanat-ressources.tar.gz /opt/ diff --git a/dist/docker/server/debian/jessie/x86_64/server.sh b/dist/docker/server/debian/jessie/x86_64/server.sh index e26c27faf..2be65e1df 100755 --- a/dist/docker/server/debian/jessie/x86_64/server.sh +++ b/dist/docker/server/debian/jessie/x86_64/server.sh @@ -21,6 +21,7 @@ declare -i CLEANCONTAINERKHANAT=0 declare -i CONNECTSSHKHANAT=0 declare -i KHANAT_CLIENT_VERSION=1 declare -i SHOWIPKHANATSERVER=0 +declare -i METHODSTARTSERVER=1 declare IMAGEGENERICSERVER="server_generic_debian_jessie_x86_64" declare IMAGEKHANATSERVER="server_khanat_debian_jessie_x86_64" @@ -51,6 +52,9 @@ options: -s, --stop-server : Stop server khanat -c, --clean-container-khanat : Remove old server khanat (stopped) -i, --show-ip-khanat-server : show ip address for khanat server (launch under docker) + --start-khanat-with-screen : [default] start khanat with screen + --start-khanat-with-full-log : start server khanat and show full log + --start-khanat-with-watch-state : start server khanat and show state (loop) --ssh : connect on khanat server (with ssh) [Exclusive action, can't execute other action] --client-version=[INTEGER] : version client khanat (we need to communicate with our server) @@ -143,6 +147,18 @@ do SHOWIPKHANATSERVER=1 shift ;; + --start-khanat-with-screen) + METHODSTARTSERVER=1 + shift + ;; + --start-khanat-with-full-log) + METHODSTARTSERVER=2 + shift + ;; + --start-khanat-with-watch-state) + METHODSTARTSERVER=3 + shift + ;; --client-version*) KHANAT_CLIENT_VERSION="${1#*=}" shift @@ -352,7 +368,7 @@ fi if [[ $LAUNCHKHANAT -ne 0 ]] then msg_info "START KHANAT SERVER" - cd $rootdir; docker run -it --hostname=khanat ${IMAGEKHANATSERVER} /opt/autostart.sh + cd $rootdir; docker run -it --hostname=khanat ${IMAGEKHANATSERVER} /opt/autostart.sh $METHODSTARTSERVER clear fi