adding option on server to select verion client we need use, and correct some error to connect client on server khanat

This commit is contained in:
aleajactaest 2017-08-10 18:27:18 +02:00
parent 0545b0e760
commit 9485a8e519
4 changed files with 49 additions and 7 deletions

View file

@ -3,8 +3,9 @@
# /opt/dist/docker/server/init-khanat.sh
# install new package
cd /; tar xvzf /opt/ryzomcore.tar.gz --strip 1 || exit 2
cd /opt; tar xvzf ryzom-ressources.tar.gz || exit 2
cd /; tar xzf /opt/ryzomcore.tar.gz --strip 1 || exit 2
cd /opt; tar xzf ryzom-ressources.tar.gz || exit 2
# configure environment
cat << EOF > /opt/shard.sh
@ -26,10 +27,18 @@ EOF
# load environment
source /opt/shard.sh
if [[ -f /opt/khanat_config.sh ]]
then
echo "Configuration loaded"
source /opt/khanat_config.sh
echo "KHANAT_CLIENT_VERSION:$KHANAT_CLIENT_VERSION"
fi
mkdir -p $RYHOME $RYZOM_PATH $PATH || exit 2
mkdir -p $RYDATA/ressources
(cd $RYDATA; tar xvzf /opt/khanat-ressources.tar.gz) || exit 2
(cd $RYDATA; tar xzf /opt/khanat-ressources.tar.gz) || exit 2
#cp -r /opt/ressources $RYDATA || exit 2
mkdir -p $RYZOM_PATH/tools/scripts/linux
@ -155,9 +164,10 @@ curl 'http://localhost:40916/setup/install.php' \
grep "Domain role successfully installed" /opt/setup.log >/dev/null || exit 2
# configure domain
addressip=$(hostname -I)
tmp=$(hostname -I)
export addressip=${tmp//[[:blank:]]/}
mysql -u root -e "use nel;
INSERT INTO nel.domain (domain_id, domain_name, status, patch_version, backup_patch_url, patch_urls, login_address, session_manager_address, ring_db_name, web_host, web_host_php, description) VALUES ('12', 'Lirria', 'ds_open', '0', '$addressip:23001', '$addressip/patch', '$addressip:49998', '$addressip:49999', 'ring_mini01', '$addressip:30000', '$addressip:40916', NULL);" || exit 2
INSERT INTO nel.domain (domain_id, domain_name, status, patch_version, backup_patch_url, patch_urls, login_address, session_manager_address, ring_db_name, web_host, web_host_php, description) VALUES ('12', 'Lirria', 'ds_open', '$KHANAT_CLIENT_VERSION', '$addressip:23001', '$addressip/patch', '$addressip:49998', '$addressip:49999', 'ring_mini01', '$addressip:30000', '$addressip:40916', NULL);" || exit 2
mysql -u root -e "use nel;
INSERT INTO nel.shard (ShardId, domain_id, WsAddr, NbPlayers, Name, Online, Version, FixedSessionId, State, MOTD) VALUES ('302', '12', '$addressip:', '0', 'Lirria shard', '0', '', '0', 'ds_open', '');" || exit 2
@ -282,6 +292,11 @@ cat << EOF > /opt/autostart.sh
/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' \$RYZOM_PATH/server/frontend_service.cfg || exit 2
/home/compil/ryzom/tools/scripts/linux/shard start
EOF
@ -299,7 +314,17 @@ mkdir -p $RYZOM_PATH/server/save_shard/rrd_graphs
#mkdir -p $RYZOM_PATH/tools/server/ryzom_ams/www/html/templates_c
#shard
#
# Serveur Patch
# TODO - need add other step to initialize patch server
# Account use : gameserver
su -c "mkdir -p /home/gameserver/patch_service/" gameserver || exit 2
su -c "cd /home/gameserver/patch_service; patch_gen createNewProduct patch_game/ryzom.xml" gameserver || exit 2
/etc/init.d/ssh stop || exit 2
#
# Stop All
#
service ssh stop || exit 2
service apache2 stop|| exit 2
service mysql stop || exit 2

View file

@ -16,8 +16,11 @@ RUN apt-get dist-upgrade -y
RUN apt-get install -y curl nano vim less bash-completion cron logrotate bsd-mailx
RUN apt-get install -y openssh-server sudo net-tools
RUN apt-get install -y lzma xdelta
# adding account compil, password compil
RUN useradd -G sudo,www-data -c /home -d /home/gameserver -c "Khanat account GAME" -m -p '$6$4a/ofDWe$Bh16Bi.fWHF2dkerY6f0fKLspYKfjsaZvvQ3Hqycoye0JV1KLS4SAm/FEtIx1MzwqkgQnnPgNFZRZwPIebnL01' -s /bin/bash -U gameserver
RUN useradd -G sudo,www-data -c /home -d /home/compil -c "Khanat account" -m -p '$6$cQrN51jJ$eP/whHzKesStKm8KgQwZMb.kYdPzJm2RtG7FcESQtrrioyOiDslE4jxnuz4WieMIvW8saPdnj3vOy1s/cnfVy.' -s /bin/bash -U compil

View file

@ -11,6 +11,7 @@ MAINTAINER AleaJactaEst
ENV HOSTNAME khanat_server
COPY todelete.sh /opt/khanat_config.sh
COPY dist/docker/server/debian/init-khanat.sh /opt/
COPY ryzomcore.tar.gz /opt/
COPY ryzom-ressources.tar.gz /opt/

View file

@ -18,6 +18,7 @@ declare -i AUTODETEC=1
declare -i STOPKHANAT=0
declare -i CLEANCONTAINERKHANAT=0
declare -i CONNECTSSHKHANAT=0
declare -i KHANAT_CLIENT_VERSION=0
declare IMAGEGENERICSERVER="server_generic_debian_jessie_x86_64"
declare IMAGEKHANATSERVER="server_khanat_debian_jessie_x86_64"
@ -47,6 +48,7 @@ options:
-s, --stop-server : Stop server khanat
-c, --clean-container-khanat : Remove old server khanat (stopped)
--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)
Example :
cd [root Khanat directory]
@ -126,6 +128,10 @@ do
KHANATSERVER=1
shift
;;
--client-version*)
KHANAT_CLIENT_VERSION="${1#*=}"
shift
;;
*)
msg_error "options '$1' not recoginze"
usage
@ -281,14 +287,21 @@ fi
if [[ $KHANATSERVER -ne 0 ]]
then
msg_info "GENERATE DOCKER IMAGE KHANAT SERVER"
cat << EOF > $rootdir/todelete.sh
#!/bin/bash
# Temporary file, use only to send some information on build docker
export KHANAT_CLIENT_VERSION=$KHANAT_CLIENT_VERSION
EOF
cd $rootdir; docker build . -t ${IMAGEKHANATSERVER} \
--file "${basedir}/Dockerfile.khanat" || exit 2
rm $rootdir/todelete.sh
fi
if [[ $LAUNCHKHANAT -ne 0 ]]
then
msg_info "START KHANAT SERVER"
cd $rootdir; docker run -it --hostname=khanat ${IMAGEKHANATSERVER} /opt/autostart.sh
clear
fi
trap '' EXIT