adding default web page to show some information, adding option to disable copy binary, change image docker

This commit is contained in:
AleaJactaEst 2018-06-28 10:45:45 +02:00
parent f1cf31924e
commit c552aa5fd7
15 changed files with 302 additions and 61 deletions

View file

@ -48,6 +48,8 @@ Linux server build:
- cp $WORKDIR/server/debian/common/servercontainer_function.sh /opt/ - cp $WORKDIR/server/debian/common/servercontainer_function.sh /opt/
- cp $WORKDIR/server/debian/common/* /opt/ext - cp $WORKDIR/server/debian/common/* /opt/ext
- cp $WORKDIR/server/debian/common/khaganat.cfg /opt/ext - cp $WORKDIR/server/debian/common/khaganat.cfg /opt/ext
- mkdir -p /opt/rootweb
- cp $WORKDIR/server/common/rootweb/* /opt/rootweb/
- echo -e 'export KHANAT_CLIENT_VERSION="1"\nexport UIDGAMESERVER=1000\nexport GIDGAMESERVER=1000\nexport DIRCLIENT="/opt/opennel_data"\nexport PACKAGECLIENT="smokey_linux64"' > /opt/khanat_config.sh - echo -e 'export KHANAT_CLIENT_VERSION="1"\nexport UIDGAMESERVER=1000\nexport GIDGAMESERVER=1000\nexport DIRCLIENT="/opt/opennel_data"\nexport PACKAGECLIENT="smokey_linux64"' > /opt/khanat_config.sh
- /opt/servercontainer_init_create_account.sh - /opt/servercontainer_init_create_account.sh
- mkdir -p /var/run/mysqld - mkdir -p /var/run/mysqld

View file

@ -18,8 +18,10 @@
# #
declare DIRBUILD="/opt/build/" declare DIRBUILD="/opt/build/"
declare DIRCODEUSE="/opt/build/opennel-code"
declare DIRCODE="/opt/ref/opennel-code" declare DIRCODE="/opt/ref/opennel-code"
declare CXXFLAGS="" declare CXXFLAGS=""
declare -i DONTCOPYSOURCE=0
function usage() function usage()
{ {
@ -35,15 +37,17 @@ options:
--add-opts-cmake="string" : add option use on command cmake (generate Makefile) --add-opts-cmake="string" : add option use on command cmake (generate Makefile)
--add-opts-make="string" : add option use on command make --add-opts-make="string" : add option use on command make
--cxxflags=[String] : adding cxx flags when generate Makefile (and build) --cxxflags=[String] : adding cxx flags when generate Makefile (and build)
--dont-copy-source : disable copy source, work directly on source (apply patch)
EOF EOF
} }
function chrashed() function chrashed()
{ {
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - BUILD FAILED (code:$?)" local code=$?
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - BUILD (under docker) FAILED (code:$code)"
if [ -n "$LOGFILE" ] if [ -n "$LOGFILE" ]
then then
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - BUILD FAILED (code:$?)" >> $LOGFILE echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - BUILD (under docker) FAILED (code:$code)" >> $LOGFILE
fi fi
exit 2 exit 2
} }
@ -78,6 +82,17 @@ function msg_debug()
fi fi
} }
function patch_onlyifnotapply()
{
# Check path is apply or not (if not apply patch)
msg_debug "check patch $1"
if ! patch -Z -t -R -s -f --dry-run -p 1 -i $1 1>/dev/null
then
msg_debug "patch $1"
patch -f -Z -t -p 1 -i $1 || exit 2
fi
}
# #
# MAIN # MAIN
# #
@ -115,6 +130,11 @@ do
CXXFLAGS="$CXXFLAGS ${1#*=}" CXXFLAGS="$CXXFLAGS ${1#*=}"
shift shift
;; ;;
--dont-copy-source)
DONTCOPYSOURCE=1
DIRCODEUSE="$DIRCODE"
shift
;;
*) *)
msg_error "options '$1' not recognize" msg_error "options '$1' not recognize"
usage usage
@ -131,19 +151,24 @@ msg_debug "CMAKEOPTS:$CMAKEOPTS"
msg_debug "MAKEOPTS:$MAKEOPTS" msg_debug "MAKEOPTS:$MAKEOPTS"
msg_debug "LOGFILE:$LOGFILE" msg_debug "LOGFILE:$LOGFILE"
msg_debug "CXXFLAGS:$CXXFLAGS" msg_debug "CXXFLAGS:$CXXFLAGS"
msg_debug "DONTCOPYSOURCE:$DONTCOPYSOURCE"
msg_info "CREATE BUILD DIRECTORY" msg_info "CREATE BUILD DIRECTORY"
mkdir -p ${DIRBUILD}/ || exit 2 mkdir -p ${DIRBUILD}/ || exit 2
if [[ $DONTCOPYSOURCE -eq 0 ]]
then
msg_info "COPY CODE" msg_info "COPY CODE"
mkdir -p ${DIRBUILD}/opennel-code mkdir -p ${DIRBUILD}/opennel-code
cp -pr $DIRCODE/* ${DIRBUILD}/opennel-code cp -pr $DIRCODE/* ${DIRBUILD}/opennel-code
fi
msg_info "PATCH CODE" msg_info "PATCH CODE"
cd ${DIRBUILD}/opennel-code/code for patchfile in $(cat ${DIRCODEUSE}/patch/series)
patch -Z -t -i ${DIRBUILD}/opennel-code/patch/libcrypto.patch || exit 2 do
patch -Z -t -i ${DIRBUILD}/opennel-code/patch/libicuuc.patch || exit 2 cd ${DIRCODEUSE}
patch -Z -t -i ${DIRBUILD}/opennel-code/patch/01_ryzom_debug_callNativeCallBack.patch -p 1 || exit 2 patch_onlyifnotapply ${DIRCODEUSE}/patch/$patchfile
done
msg_info "PREPARE BUILD" msg_info "PREPARE BUILD"
msg_debug "cmake option : -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_SYMBOLS=ON -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=ON -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON ${CMAKEOPTS}" msg_debug "cmake option : -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_SYMBOLS=ON -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=ON -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON ${CMAKEOPTS}"
@ -156,14 +181,11 @@ cd ${DIRBUILD}; CXXFLAGS="$CXXFLAGS" cmake -DWITH_NEL=ON \
-DWITH_RYZOM_PATCH=ON \ -DWITH_RYZOM_PATCH=ON \
-DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON \ -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON \
${CMAKEOPTS} \ ${CMAKEOPTS} \
${DIRBUILD}/opennel-code/code 1>>$LOGFILE 2>&1 || exit 2 ${DIRCODEUSE}/code 1>>$LOGFILE 2>&1 || exit 2
msg_info "BUILD START" msg_info "BUILD START"
msg_debug "make option : $MAKEOPTS" msg_debug "make option : $MAKEOPTS"
cd ${DIRBUILD}; VERBOSE=1 make $MAKEOPTS 1>>$LOGFILE 2>&1 || exit 2 cd ${DIRBUILD}; VERBOSE=1 make $MAKEOPTS 1>>$LOGFILE 2>&1 || exit 2
msg_info "GENERATE PACKAGE"
cd ${DIRBUILD}; make package 1>>$LOGFILE 2>&1 || exit 2
trap '' EXIT trap '' EXIT
msg_info "BUILD END" msg_info "BUILD END"

View file

@ -31,8 +31,9 @@ declare -i CLEANIMAGENONE=0
declare -i AUTODETEC=1 declare -i AUTODETEC=1
declare DOCKERBUILDOPT="" declare DOCKERBUILDOPT=""
declare OPTION="" declare OPTION=""
declare -i DONTCOPYSOURCE=0
declare IMAGEDOCKER="builder_khanat_debian_stretch_x86_64" declare IMAGEDOCKER="opennel/builder_debian_stretch_x86_64"
declare LOCALBUILDDIR="build/$IMAGEDOCKER" declare LOCALBUILDDIR="build/$IMAGEDOCKER"
declare LOCALSRC="debian/stretch/x86_64" declare LOCALSRC="debian/stretch/x86_64"
declare DIRPACKAGE="output/opennel_debian_stretch_x86_64/package" declare DIRPACKAGE="output/opennel_debian_stretch_x86_64/package"
@ -66,11 +67,13 @@ options:
-m OPTS, --add-opts-docker=OPTS : Adding options on docker command (when build) -m OPTS, --add-opts-docker=OPTS : Adding options on docker command (when build)
--only-build-server : adding option to build only server --only-build-server : adding option to build only server
--opennel-code-dir=<Directory> : localization code khanat (khanat-opennel-code) --opennel-code-dir=<Directory> : localization code khanat (khanat-opennel-code)
--dont-copy-source : disable copy source, work directly on source (apply patch)
Example : Example :
cd [root Khanat directory] cd [root Khanat directory]
./build.sh -c -r -m '-m 20g' $0 -c -r -m '-m 20g'
./build.sh -c -r -j 4 -a '-DWITH_SYMBOLS=ON' -a '-DWITH_RYZOM_TOOLS=OFF' -a '-DWITH_NEL_TOOLS=OFF' -m '-m 20g' -d $0 -c -r -j 4 -a '-DWITH_SYMBOLS=ON' -a '-DWITH_RYZOM_TOOLS=OFF' -a '-DWITH_NEL_TOOLS=OFF' -m '-m 20g' -d
$0 -a '-DCMAKE_BUILD_TYPE=Debug -DWITH_SYMBOLS=ON -DFINAL_VERSION=OFF' -f
EOF EOF
} }
@ -190,6 +193,11 @@ do
CLEANIMAGENONE=1 CLEANIMAGENONE=1
shift shift
;; ;;
--dont-copy-source)
DONTCOPYSOURCE=1
OPTION="$OPTION --dont-copy-source"
shift
;;
*) *)
msg_error "options '$1' not recognize" msg_error "options '$1' not recognize"
usage usage
@ -288,7 +296,7 @@ then
--hostname=builder \ --hostname=builder \
-u "$(id -u $USERNAME):$(id -g $USERNAME)" \ -u "$(id -u $USERNAME):$(id -g $USERNAME)" \
-v $rootdir/builder:/opt/ref/builder:ro \ -v $rootdir/builder:/opt/ref/builder:ro \
-v $codedir:/opt/ref/opennel-code:ro \ -v $codedir:/opt/ref/opennel-code:rw \
-v $rootdir/build:/opt/build \ -v $rootdir/build:/opt/build \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
${DOCKEROPTS} \ ${DOCKEROPTS} \
@ -296,19 +304,6 @@ then
/opt/ref/builder/${LOCALSRC}/build-under-docker.sh --add-opts-make="$MAKEOPTS" --add-opts-cmake="$CMAKEOPTS" --build-dir="/opt/${LOCALBUILDDIR}" --code-dir="/opt/ref/opennel-code" $OPTION || exit 2 /opt/ref/builder/${LOCALSRC}/build-under-docker.sh --add-opts-make="$MAKEOPTS" --add-opts-cmake="$CMAKEOPTS" --build-dir="/opt/${LOCALBUILDDIR}" --code-dir="/opt/ref/opennel-code" $OPTION || exit 2
fi fi
if [[ $BUILD -ne 0 ]]
then
msg_info "COPY PACKAGES"
mkdir -p "$rootdir/$DIRPACKAGE"
cd ${rootdir}; tar czf ${PACKAGEREF} \
$codedir/code/ryzom/server/shard.screen.rc \
$codedir/code/ryzom/common/* \
$codedir/code/ryzom/client/* \
$codedir/code/ryzom/server/* \
$codedir/code/web/* || exit 2
cp ${rootdir}/${LOCALBUILDDIR}/ryzomcore-*.tar.gz ${PACKAGEBIN} || exit 2
fi
if [[ $CLEANDOCKER -ne 0 ]] if [[ $CLEANDOCKER -ne 0 ]]
then then
msg_info "CLEAN CONTAINER" msg_info "CLEAN CONTAINER"

View file

@ -0,0 +1,133 @@
<!DOCTYPE html>
<html>
<head>
<title>DOCKER KHANAT</title>
</head>
<style>
#command_shell{
background: #F3E2A9;
border:3px solid #151515;
color: #000000;
margin:10px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:left;
max-width:100vw;
}
#title_info{
background: #00FFFF;
border:3px solid #8A0808;
color: #000000;
font-size:20px;
font-weight:500;
margin:50px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:center;
}
#important_info{
background: #A9E2F3;
border:3px solid #088A08;
color: #000000;
font-size:15px;
font-weight:500;
margin:30px;
padding:3px;
top:40px;left:3%;right:3%;
text-align:left;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
#alert_javascript{
background: #F3F781;
border:3px solid #610B0B;
color: #DF0101;
font-size:20px;
font-weight:700;
margin:0;
padding:3px;
top:40px;left:3%;right:3%;
text-align:center;
max-width:100vw;
}
</style>
<script>
function setHref() {
document.getElementById('admin-href').href = window.location.protocol + "//" + window.location.hostname + ":40916/ams/";
}
</script>
<noscript>
<div id='alert_javascript'>
This website need Javascript.<br>
Could you please enable Javascript?
</div>
</noscript>
<body onload="setHref()">
<p>
<div id='title_info'>KHANAT DOCKER ENVIRONMENT (TEST)</div>
<div id='important_info'>
<?php
print "SERVER IP: ". getHostByName(gethostname());
?>
</div>
<a href="/EnableJavascript" id="admin-href" >Administration</a>
<br/>
<a href="/phpmyadmin/">phpmyadmin</a>
<br/>
<a href="/patch/">patch</a>
<br/>
<br/>
</div>
<div>
script to download and convert launcher on our instance:
<a href="/prepare_environment_container_64.sh">prepare_environment_container_64.sh</a>
</div>
<div>
Account / Password
<table>
<tr>
<th>Account</th>
<th>Password</th>
<th>Where</th>
<th>Comment</th>
</tr>
<tr>
<td>gameserver</td>
<td>khanat</td>
<td>ssh</td>
<td>server access</td>
</tr>
<tr>
<td>root</td>
<td></td>
<td>phpmyadmin</td>
<td>(no password)</td>
</tr>
<tr>
<td>admin</td>
<td>admin</td>
<td>khanat</td>
<td>account (administration)</td>
</tr>
<tr>
<td>tester</td>
<td>tester</td>
<td>khanat</td>
<td>account (player)</td>
</tr>
</table>
</div>
<div>
Command to connect on khanat 'server' :
<div id='command_shell'>ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@<?php print getHostByName(gethostname());?></div>
Use sudo to switch on root account
<div id='command_shell'>sudo bash</div>
</div>
<p>PHP : <?php echo 'PHP version : ' . phpversion(); ?></p>
</body>
</html>

View file

@ -0,0 +1,33 @@
#!/bin/bash
declare IMAGEKHANATSERVER="opennel/servercontainer_debian_stretch_x86_64"
mkdir -p $HOME/Public
echo "$(date "+%Y/%m/%d %H:%M:%S") Get ip address server khanat"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
if [[ ${#listcontainer[@]} -eq 1 ]]
then
ipaddress=$(docker inspect --format="{{ .NetworkSettings.IPAddress }}" ${listcontainer[@]})
fi
echo "$(date "+%Y/%m/%d %H:%M:%S") get client package"
wget http://$ipaddress/client/smokey_linux64.tar.gz -O smokey_linux64.tar.gz
echo "$(date "+%Y/%m/%d %H:%M:%S") clean old client"
if [[ -d Khanat_Linux64 ]]
then
rm -rf Khanat_Linux64 || exit 2
fi
echo "$(date "+%Y/%m/%d %H:%M:%S") install new client"
#7z x -y $SRCKHANATCLIENT || exit 2
#7z x -y -oKhanat_Linux64 $SRCKHANATCLIENTDEBUG || exit 2
tar xvzf smokey_linux64.tar.gz || exit 2
echo "$(date "+%Y/%m/%d %H:%M:%S") configure client"
sed -i 's/lirria.khaganat.net/'$ipaddress'/g' Khanat_Linux64/client_default.cfg
echo -en "Client khanat installed & configured\nGo to Khanat_Linux64 directory and launch client\n"
echo -en "(cd Khanat_Linux64;./khanat_client)\n"

View file

@ -97,7 +97,6 @@ chown_gameserver '/home/gameserver/log/apache2/error.log' || exit 2
touch /home/gameserver/log/apache2/other_vhosts_access.log || exit 2 touch /home/gameserver/log/apache2/other_vhosts_access.log || exit 2
chown_gameserver '/home/gameserver/log/apache2/other_vhosts_access.log' || exit 2 chown_gameserver '/home/gameserver/log/apache2/other_vhosts_access.log' || exit 2
##################### #####################
# Start & Stop apache2 # Start & Stop apache2
##################### #####################

View file

@ -237,6 +237,11 @@ wait_all_job || exit 2
#################################### ####################################
msg_info "[$(basename $0):$LINENO] Prepare Patch" msg_info "[$(basename $0):$LINENO] Prepare Patch"
# TODO - if ryzom.xml exist what's command to update (replace patch_gen createNewProduct)
if [ -f $PATCH_CLIENT_SYSTEM/patch_game/ryzom.xml ]
then
mv $PATCH_CLIENT_SYSTEM/patch_game/ryzom.xml $PATCH_CLIENT_SYSTEM/patch_game/ryzom.xml.old || exit 2
fi
cd $PATCH_CLIENT_SYSTEM;patch_gen createNewProduct patch_game/ryzom.xml 2>$KHANAT_HOME/log/configure/patch_createNewProduct.err 1>$KHANAT_HOME/log/configure/patch_createNewProduct.out || exit 2 cd $PATCH_CLIENT_SYSTEM;patch_gen createNewProduct patch_game/ryzom.xml 2>$KHANAT_HOME/log/configure/patch_createNewProduct.err 1>$KHANAT_HOME/log/configure/patch_createNewProduct.out || exit 2
cd $PATCH_CLIENT_SYSTEM;touch patch_game/Lirria.version || exit 2 cd $PATCH_CLIENT_SYSTEM;touch patch_game/Lirria.version || exit 2
sed -i -r 's/value="main"/value="khanat_lirria"/g' $PATCH_CLIENT_SYSTEM/patch_game/ryzom.xml || exit 2 sed -i -r 's/value="main"/value="khanat_lirria"/g' $PATCH_CLIENT_SYSTEM/patch_game/ryzom.xml || exit 2

View file

@ -86,6 +86,13 @@ cp /etc/phpmyadmin/config.inc.php /etc/phpmyadmin/config.inc.php.ref || exit 2
awk '{if($0 ~ /AllowNoPassword/){$1="";}; print $0;}' /etc/phpmyadmin/config.inc.php.ref > /etc/phpmyadmin/config.inc.php || exit 2 awk '{if($0 ~ /AllowNoPassword/){$1="";}; print $0;}' /etc/phpmyadmin/config.inc.php.ref > /etc/phpmyadmin/config.inc.php || exit 2
####################################
# Configure 1st page
####################################
msg_debug "Configure 1st page"
create_dir_gameserver '/home/gameserver/rootweb'
cp /opt/rootweb/* /home/gameserver/rootweb/ || exit 2
#################################### ####################################
# configure phpmyadmin # configure phpmyadmin
#################################### ####################################
@ -94,7 +101,7 @@ msg_debug "configure apache"
cat << EOF > /etc/apache2/sites-available/000-default.conf cat << EOF > /etc/apache2/sites-available/000-default.conf
# Default # Default
<VirtualHost *:80> <VirtualHost *:80>
<Directory "/home/gameserver/khanat/khanatweb/"> <Directory "/home/gameserver/rootweb/">
Options Indexes FollowSymLinks Options Indexes FollowSymLinks
AllowOverride None AllowOverride None
Require all granted Require all granted
@ -106,7 +113,7 @@ cat << EOF > /etc/apache2/sites-available/000-default.conf
ServerName lirria.khaganat.net ServerName lirria.khaganat.net
ServerAdmin webmaster@localhost ServerAdmin webmaster@localhost
DocumentRoot /home/gameserver/khanat/khanatweb/public_php/ DocumentRoot /home/gameserver/rootweb/
ErrorLog \${APACHE_LOG_DIR}/error.log ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined CustomLog \${APACHE_LOG_DIR}/access.log combined

View file

@ -124,9 +124,9 @@ alias l='ls \$LS_OPTIONS -lA'
# alias mv='mv -i' # alias mv='mv -i'
# Autocompletion # Autocompletion
if [ -f /etc/bash_completion ]; then #if [ -f /etc/bash_completion ]; then
. /etc/bash_completion # . /etc/bash_completion
fi #fi
export KHANAT_HOME=/home/gameserver export KHANAT_HOME=/home/gameserver
export KHANAT_PATH=/home/gameserver/khanat export KHANAT_PATH=/home/gameserver/khanat

View file

@ -75,6 +75,7 @@ msg_debug "group : $(id -g -n gameserver)"
create_dir_gameserver '/home/gameserver/ext' create_dir_gameserver '/home/gameserver/ext'
create_dir_gameserver '/home/gameserver/khanat' create_dir_gameserver '/home/gameserver/khanat'
create_dir_gameserver '/home/gameserver/khanat/rootweb'
#################################### ####################################
# End # End

View file

@ -34,7 +34,7 @@ function start_stop()
nameservice=$1 nameservice=$1
printf RUNNING > /home/gameserver/khanat/server/${nameservice}/${nameservice}.state printf RUNNING > /home/gameserver/khanat/server/${nameservice}/${nameservice}.state
chown_gameserver /home/gameserver/khanat/server/${nameservice}/${nameservice}.state chown_gameserver /home/gameserver/khanat/server/${nameservice}/${nameservice}.state
nohup $2 (cd $3; nohup $2)
printf STOPPED > /home/gameserver/khanat/server/${nameservice}/${nameservice}.state printf STOPPED > /home/gameserver/khanat/server/${nameservice}/${nameservice}.state
} }
@ -47,7 +47,7 @@ function launch_service()
create_file_gameserver "/home/gameserver/log/khanat/$nameservice.out" create_file_gameserver "/home/gameserver/log/khanat/$nameservice.out"
create_file_gameserver "/home/gameserver/log/khanat/$nameservice.err" create_file_gameserver "/home/gameserver/log/khanat/$nameservice.err"
start_stop "$1" "$2" 1>/home/gameserver/log/khanat/$nameservice.out 2>/home/gameserver/log/khanat/$nameservice.err & start_stop "$1" "$2" "/home/gameserver/khanat/server/$1" 1>/home/gameserver/log/khanat/$nameservice.out 2>/home/gameserver/log/khanat/$nameservice.err &
echo "$!" > /home/gameserver/khanat/server/$1/$1.pid echo "$!" > /home/gameserver/khanat/server/$1/$1.pid
#nohup $2 1>/dev/null 2>&1 & #nohup $2 1>/dev/null 2>&1 &
#echo "$!" > /home/gameserver/khanat/server/$1.pid #echo "$!" > /home/gameserver/khanat/server/$1.pid

View file

@ -16,12 +16,49 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
/opt/ext/servercontainer_configure_link.sh || exit 2 declare DIRFUNCTION="$(dirname $0)/servercontainer_function.sh"
usage()
{
cat << EOF
usage:$0 [options]
Launch update
options:
-h, --help : Show this help
-d, --debug : Show debug message
EOF
}
source $DIRFUNCTION
msg_info "[$(basename $0):$LINENO] => START"
while test $# -gt 0
do
case "$1" in
-h|--help)
usage
exit 1
;;
-d|--debug)
set_debug 1
shift
;;
*)
msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage
exit 1
;;
esac
done
/opt/ext/servercontainer_configure_link.sh $OPTION || msg_critical "[$(basename $0):$LINENO] Issue when create link"
#/opt/ext/servercontainer_configure_mysql.sh || exit 2 #/opt/ext/servercontainer_configure_mysql.sh || exit 2
#/opt/ext/servercontainer_configure_apache.sh || exit 2 #/opt/ext/servercontainer_configure_apache.sh || exit 2
#/opt/ext/servercontainer_configure_world.sh || exit 2 #/opt/ext/servercontainer_configure_world.sh || exit 2
su -c '/opt/ext/servercontainer_configure_khanat.sh' gameserver || exit 2 su -c "/opt/ext/servercontainer_configure_khanat.sh $OPTION" gameserver || msg_critical "[$(basename $0):$LINENO] Issue when configure khanat"
su -c '/opt/ext/servercontainer_configure_patch.sh -d' gameserver || exit 2 su -c "/opt/ext/servercontainer_configure_patch.sh $OPTION" gameserver || msg_critical "[$(basename $0):$LINENO] Issue when configure patch"
msg_info "[$(basename $0):$LINENO] => END"
exit 0 exit 0

View file

@ -23,7 +23,7 @@ ENV HOSTNAME basic_server
RUN apt-get update ; \ RUN apt-get update ; \
apt-get dist-upgrade -y ; \ apt-get dist-upgrade -y ; \
DEBIAN_FRONTEND=noninteractive apt-get install -y curl nano vim less bash-completion cron logrotate bsd-mailx openssh-server sudo net-tools lzma xdelta p7zip p7zip-full mysql-server apache2 php libapache2-mod-php php-mysql apache2-utils php-gd php-imagick rrdtool screen mcrypt php-mcrypt python3 phpmyadmin gdb DEBIAN_FRONTEND=noninteractive apt-get install -y curl nano vim less bash-completion cron logrotate bsd-mailx openssh-server sudo net-tools lzma xdelta p7zip p7zip-full mysql-server apache2 php libapache2-mod-php php-mysql apache2-utils php-gd php-imagick rrdtool screen mcrypt php-mcrypt python3 phpmyadmin gdb valgrind electric-fence

View file

@ -27,6 +27,7 @@ COPY server/debian/common/servercontainer_function.sh /opt/
COPY server/debian/common/servercontainer_init_* /opt/ COPY server/debian/common/servercontainer_init_* /opt/
COPY output/opennel_debian_stretch_x86_64/khanat_config.sh /opt/khanat_config.sh COPY output/opennel_debian_stretch_x86_64/khanat_config.sh /opt/khanat_config.sh
COPY server/common/rootweb/* /opt/rootweb/
RUN /opt/servercontainer_init_create_account.sh RUN /opt/servercontainer_init_create_account.sh
RUN /opt/servercontainer_init_mysql.sh RUN /opt/servercontainer_init_mysql.sh

View file

@ -36,10 +36,12 @@ declare -i SHOWIPKHANATSERVER=0
declare METHODSTARTSERVER="--start-khanat-with-screen" declare METHODSTARTSERVER="--start-khanat-with-screen"
declare -i CLEANIMAGENONE=0 declare -i CLEANIMAGENONE=0
declare DOCKERBUILDOPT="" declare DOCKERBUILDOPT=""
declare CONFIGUREAUTO=""
declare UPDATEAUTO=""
declare IMAGEGENERICSERVER="opennel/server_generic_debian_stretch_x86_64" declare IMAGEGENERICSERVER="opennel/server_generic_debian_stretch_x86_64"
declare IMAGEKHANATSERVER="opennel/servercontainer_debian_stretch_x86_64" declare IMAGEKHANATSERVER="opennel/servercontainer_debian_stretch_x86_64"
declare LOCALBUILDDIR="build/builder_khanat_debian_stretch_x86_64" declare LOCALBUILDDIR="build/opennel/builder_debian_stretch_x86_64"
declare DIROUTPUT="output/opennel_debian_stretch_x86_64" declare DIROUTPUT="output/opennel_debian_stretch_x86_64"
declare ROOTDATAKHANAT="$DIROUTPUT/gameserver" declare ROOTDATAKHANAT="$DIROUTPUT/gameserver"
declare DIRLOG="$ROOTDATAKHANAT/log" declare DIRLOG="$ROOTDATAKHANAT/log"
@ -139,6 +141,8 @@ do
;; ;;
-d|--debug) -d|--debug)
DEBUG=1 DEBUG=1
CONFIGUREAUTO="$CONFIGUREAUTO -d"
UPDATEAUTO="$UPDATEAUTO -d"
shift shift
;; ;;
--ssh) --ssh)
@ -230,7 +234,7 @@ do
UPDATEDATA=1 UPDATEDATA=1
shift shift
;; ;;
--option-docker-build) --option-docker-build=*)
DOCKERBUILDOPT="$DOCKERBUILDOPT ${1#*=}" DOCKERBUILDOPT="$DOCKERBUILDOPT ${1#*=}"
shift shift
;; ;;
@ -483,7 +487,7 @@ then
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \ -v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \ -v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \ -v ${rootdir}/server/debian/common/:/opt/ext:ro \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_configure_auto.sh || exit 2 ${IMAGEKHANATSERVER} /opt/ext/servercontainer_configure_auto.sh $CONFIGUREAUTO || exit 2
fi fi
if [[ $UPDATEDATA -ne 0 ]] if [[ $UPDATEDATA -ne 0 ]]
@ -500,7 +504,7 @@ then
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \ -v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \ -v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \ -v ${rootdir}/server/debian/common/:/opt/ext:ro \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_update_auto.sh" ${IMAGEKHANATSERVER} /opt/ext/servercontainer_update_auto.sh $UPDATEAUTO"
cd $rootdir; docker run -it --hostname=khanat \ cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \ -v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \ -v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
@ -512,7 +516,7 @@ then
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \ -v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \ -v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \ -v ${rootdir}/server/debian/common/:/opt/ext:ro \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_update_auto.sh ${IMAGEKHANATSERVER} /opt/ext/servercontainer_update_auto.sh $UPDATEAUTO || exit 2
fi fi
if [[ $LAUNCHKHANAT -ne 0 ]] if [[ $LAUNCHKHANAT -ne 0 ]]
@ -530,12 +534,14 @@ then
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \ -v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \ -v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \ -v ${rootdir}/server/debian/common/:/opt/ext:ro \
-v $rootdir/build:/opt/build:ro \
-v ${OPENNEL_CODE_DIR}:/opt/ref/opennel-code:ro \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_launch_auto.sh $METHODSTARTSERVER -d ${IMAGEKHANATSERVER} /opt/ext/servercontainer_launch_auto.sh $METHODSTARTSERVER -d
fi
trap '' EXIT
msg_info "[$(basename $0):$LINENO] CLEAR TERMINAL" msg_info "[$(basename $0):$LINENO] CLEAR TERMINAL"
clear clear
tput clear tput clear
fi
trap '' EXIT
msg_info "[$(basename $0):$LINENO] END" msg_info "[$(basename $0):$LINENO] END"