adding OpenNelManager on docker

This commit is contained in:
Jean Sorgemoel 2018-08-05 13:36:12 +02:00
parent cd60df3e13
commit 27f2c50323
12 changed files with 631 additions and 61 deletions

View file

@ -32,7 +32,7 @@ ENV HOSTNAME builder
RUN apt-get update ; \
apt-get dist-upgrade -y; \
DEBIAN_FRONTEND=noninteractive apt-get install -y apache2 apache2-utils autoconf autogen automake bison build-essential cmake cpputest default-libmysqlclient-dev fakeroot git libapache2-mod-php libboost-all-dev libfreetype6-dev libgif-dev libgl1-mesa-dev libjpeg62-turbo-dev liblua5.2-0 liblua5.2-dev liblzma-dev libogg-dev libopenal-dev libpng-dev libssh2-1-dev libssl-dev libtool libtool-bin libvorbis-dev libx11-dev libxml2-dev libxmu-dev libxrandr-dev libxrender-dev libxxf86vm-dev mercurial mysql-server php php-gd php-imagick php-mysql rrdtool unzip wget zlib1g-dev
DEBIAN_FRONTEND=noninteractive apt-get install -y apache2 apache2-utils autoconf autogen automake bison build-essential cmake cpputest default-libmysqlclient-dev fakeroot git libapache2-mod-php libboost-all-dev libfreetype6-dev libgif-dev libgl1-mesa-dev libjpeg62-turbo-dev liblua5.2-0 liblua5.2-dev liblzma-dev libogg-dev libopenal-dev libpng-dev libssh2-1-dev libssl-dev libtool libtool-bin libvorbis-dev libx11-dev libxml2-dev libxmu-dev libxrandr-dev libxrender-dev libxxf86vm-dev mercurial mysql-server php php-gd php-imagick php-mysql python3 python3-pip python3-bcrypt python3-venv rrdtool unzip wget zlib1g-dev python3-coverage python3-pep8
## Build & Install cpptest
# Impossible to build release 1.1.0, 1.1.1, 1.1.2

View file

@ -20,8 +20,11 @@
declare DIRBUILD="/opt/build/"
declare DIRCODEUSE="/opt/build/opennel-code"
declare DIRCODE="/opt/ref/opennel-code"
declare DIRPYMANAGER="/opt/ref/opennel-pymanager"
declare CXXFLAGS=""
declare -i DONTCOPYSOURCE=0
declare -i BUILD_OPENNEL_CODE=1
declare -i PACKAGE_OPENNEL_PYMANAGER=1
function usage()
{
@ -126,6 +129,10 @@ do
DIRCODE="${1#*=}"
shift
;;
--opennel-pymanager-dir=*)
DIRPYMANAGER="${1#*=}"
shift
;;
--cxxflags=*)
CXXFLAGS="$CXXFLAGS ${1#*=}"
shift
@ -135,6 +142,14 @@ do
DIRCODEUSE="$DIRCODE"
shift
;;
--disable-build-opennel-code)
BUILD_OPENNEL_CODE=0
shift
;;
--disable-package-opennel-pymanager)
PACKAGE_OPENNEL_PYMANAGER=0
shift
;;
*)
msg_error "options '$1' not recognize"
usage
@ -147,6 +162,7 @@ declare LOGFILE="${DIRBUILD}/build.log"
msg_debug "DIRBUILD:$DIRBUILD"
msg_debug "DIRCODE:$DIRCODE"
msg_debug "DIRPYMANAGER:$DIRPYMANAGER"
msg_debug "CMAKEOPTS:$CMAKEOPTS"
msg_debug "MAKEOPTS:$MAKEOPTS"
msg_debug "LOGFILE:$LOGFILE"
@ -156,23 +172,35 @@ msg_debug "DONTCOPYSOURCE:$DONTCOPYSOURCE"
msg_info "CREATE BUILD DIRECTORY"
mkdir -p ${DIRBUILD}/ || exit 2
if [[ $DONTCOPYSOURCE -eq 0 ]]
if [[ $PACKAGE_OPENNEL_PYMANAGER -ne 0 ]]
then
msg_info "COPY CODE"
mkdir -p ${DIRBUILD}/opennel-code
cp -pr $DIRCODE/* ${DIRBUILD}/opennel-code
msg_info "PACKAGE OPENNEL-PYMANAGER"
mkdir -p /tmp/pymanager/tmp || exit 2
cp -pr $DIRPYMANAGER/* /tmp/pymanager || exit 2
msg_debug "cd /tmp/pymanager; `which python3` setup.py bdist_wheel -d ${DIRBUILD} -b /tmp"
cd /tmp/pymanager; `which python3` setup.py bdist_wheel -d ${DIRBUILD} -b /tmp/pymanager/tmp || exit 2
fi
msg_info "PATCH CODE"
for patchfile in $(cat ${DIRCODEUSE}/patch/series)
do
cd ${DIRCODEUSE}
patch_onlyifnotapply ${DIRCODEUSE}/patch/$patchfile
done
if [[ $BUILD_OPENNEL_CODE -ne 0 ]]
then
if [[ $DONTCOPYSOURCE -eq 0 ]]
then
msg_info "COPY CODE"
DIRCODEUSE="$DIRBUILD/opennel-code"
mkdir -p ${DIRBUILD}/opennel-code || exit 2
cp -pr $DIRCODE/* ${DIRBUILD}/opennel-code || exit 2
fi
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}"
cd ${DIRBUILD}; CXXFLAGS="$CXXFLAGS" cmake -DWITH_NEL=ON \
msg_info "PATCH CODE"
for patchfile in $(cat ${DIRCODE}/patch/series)
do
cd ${DIRCODEUSE}
patch_onlyifnotapply ${DIRCODE}/patch/$patchfile || exit 2
done
msg_info "PREPARE BUILD"
msg_debug "cd ${DIRBUILD}; CXXFLAGS="$CXXFLAGS" cmake -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} ${DIRCODEUSE}/code 1>>$LOGFILE 2>&1 "
cd ${DIRBUILD}; CXXFLAGS="$CXXFLAGS" cmake -DWITH_NEL=ON \
-DWITH_STATIC=ON \
-DWITH_STATIC_DRIVERS=ON \
-DWITH_STATIC_EXTERNAL=ON \
@ -183,9 +211,10 @@ cd ${DIRBUILD}; CXXFLAGS="$CXXFLAGS" cmake -DWITH_NEL=ON \
${CMAKEOPTS} \
${DIRCODEUSE}/code 1>>$LOGFILE 2>&1 || exit 2
msg_info "BUILD START"
msg_debug "make option : $MAKEOPTS"
cd ${DIRBUILD}; VERBOSE=1 make $MAKEOPTS 1>>$LOGFILE 2>&1 || exit 2
msg_info "BUILD START"
msg_debug "make option : $MAKEOPTS"
cd ${DIRBUILD}; VERBOSE=1 make $MAKEOPTS 1>>$LOGFILE 2>&1 || exit 2
fi
trap '' EXIT
msg_info "BUILD END"

View file

@ -67,6 +67,9 @@ options:
-m OPTS, --add-opts-docker=OPTS : Adding options on docker command (when build)
--only-build-server : adding option to build only server
--opennel-code-dir=<Directory> : localization code khanat (khanat-opennel-code)
--opennel-pymanager-dir=<Directory> : localization code khanat (opennel-pymanager)
--disable-build-opennel-code : Disable build on opennel-code
--disable-package-opennel-pymanager : Disable package on opennel-pymanager
--dont-copy-source : disable copy source, work directly on source (apply patch)
Example :
@ -104,6 +107,7 @@ calldir="$(dirname $0)"
basedir=$(cd $calldir; pwd)
rootdir="$(dirname $(dirname $(dirname $(dirname ${basedir}))))"
codedir="$(dirname $rootdir)/khanat-opennel-code"
pymanagerdir="$(dirname $rootdir)/opennel-pymanager"
while test $# -gt 0
do
@ -189,6 +193,10 @@ do
codedir="${1#*=}"
shift
;;
--opennel-pymanager-dir=*)
pymanagerdir="${1#*=}"
shift
;;
-w|--clean-images-none)
CLEANIMAGENONE=1
shift
@ -198,6 +206,14 @@ do
OPTION="$OPTION --dont-copy-source"
shift
;;
--disable-build-opennel-code)
OPTION="$OPTION --disable-build-opennel-code"
shift
;;
--disable-package-opennel-pymanager)
OPTION="$OPTION --disable-package-opennel-pymanager"
shift
;;
*)
msg_error "options '$1' not recognize"
usage
@ -240,6 +256,7 @@ msg_debug "[$(basename $0):$LINENO] CMAKEOPTS: '$CMAKEOPTS'"
msg_debug "[$(basename $0):$LINENO] DOCKEROPTS: '$DOCKEROPTS'"
msg_debug "[$(basename $0):$LINENO] DOCKERBUILDOPT: '$DOCKERBUILDOPT'"
msg_debug "[$(basename $0):$LINENO] codedir: '$codedir'"
msg_debug "[$(basename $0):$LINENO] pymanagerdir: '$pymanagerdir'"
msg_debug "[$(basename $0):$LINENO] OPTION: '$OPTION'"
msg_info "[$(basename $0):$LINENO] check khanat-opennel-code"
@ -286,7 +303,8 @@ then
--hostname=builder \
-u "$(id -u $USERNAME):$(id -g $USERNAME)" \
-v $rootdir/builder:/opt/ref/builder:ro \
-v $codedir:/opt/ref/opennel-code:ro \
-v $codedir:/opt/ref/opennel-code:rw \
-v $pymanagerdir:/opt/ref/opennel-pymanager:rw \
-v $rootdir/build:/opt/build \
-v /etc/localtime:/etc/localtime:ro \
${DOCKEROPTS} \
@ -297,11 +315,12 @@ then
-u "$(id -u $USERNAME):$(id -g $USERNAME)" \
-v $rootdir/builder:/opt/ref/builder:ro \
-v $codedir:/opt/ref/opennel-code:rw \
-v $pymanagerdir:/opt/ref/opennel-pymanager:ro \
-v $rootdir/build:/opt/build \
-v /etc/localtime:/etc/localtime:ro \
${DOCKEROPTS} \
${IMAGEDOCKER} \
/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" --opennel-pymanager-dir="/opt/ref/opennel-pymanager" $OPTION || exit 2
fi
if [[ $CLEANDOCKER -ne 0 ]]

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>DOCKER KHANAT</title>
<title>Test Khanat</title>
</head>
<style>
@ -69,24 +69,30 @@ table, th, td {
<body onload="setHref()">
<p>
<div id='title_info'>KHANAT DOCKER ENVIRONMENT (TEST)</div>
<div id='important_info'>
<a>Home</a>
<?php
print "SERVER IP: ". getHostByName(gethostname());
if (file_exists('/home/gameserver/opennelmanager.flag')) {
echo "<a href=\"/opennelmanager.php\">OpenNelManager</a>";
} else {
echo "<a>OpenNelManager not used</a>";
}
?>
</div>
<a href="/EnableJavascript" id="admin-href" >Administration</a>
<br/>
<a href="/phpmyadmin/">phpmyadmin</a>
<br/>
<a href="/patch/">patch</a>
<br/>
<br/>
</div>
</p>
<div id='title_info'>KHANAT SERVER DOCKER (TEST ENVIRONMENT)</div>
<div id='important_info'><?php print "SERVER IP: ". getHostByName(gethostname()); ?> </div>
<br/>
<div>
script to download and convert launcher on our instance:
<a href="/prepare_environment_container_64.sh">prepare_environment_container_64.sh</a>
and after execute it.
<div id='command_shell'>
wget <?php print getHostByName(gethostname());?>/prepare_environment_container_64.sh<br>
bash prepare_environment_container_64.sh<br>
(cd Khanat_Linux64;./khanat_client)
</div>
</div>
<div>
Account / Password
@ -129,6 +135,6 @@ print "SERVER IP: ". getHostByName(gethostname());
Use sudo to switch on root account
<div id='command_shell'>sudo bash</div>
</div>
<p>PHP : <?php echo 'PHP version : ' . phpversion(); ?></p>
<p>Khanat Server Docker</p>
</body>
</html>

View file

@ -0,0 +1,223 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Khanat States</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 type="text/javascript">
function setHref() {
document.getElementById('admin-href').href = window.location.protocol + "//" + window.location.hostname + ":40916/ams/";
}
function start(rooturl, cmd) {
//document.getElementById("info").innerHTML = "Start " + rooturl + " " + cmd;
var xhr = new XMLHttpRequest();
var url = rooturl + "/START";
//console.log(url);
xhr.open("POST", url, true);
xhr.setRequestHeader("content-type", "application/json");
xhr.onreadystatechange = function () {
console.log(xhr.readyState);
console.log(xhr.status);
if (xhr.readyState === 4 && xhr.status === 200) {
//var json = JSON.parse(xhr.responseText);
console.log(xhr.responseText);
}
};
var data = JSON.stringify({"name": cmd});
//console.log(data);
xhr.send(data);
}
function stop(rooturl, cmd) {
//document.getElementById("info").innerHTML = "Stop " + rooturl + " " + cmd;
var xhr = new XMLHttpRequest();
var url = rooturl + "/STOP";
//console.log(url);
xhr.open("POST", url, true);
xhr.setRequestHeader("content-type", "application/json");
xhr.onreadystatechange = function () {
console.log(xhr.readyState);
console.log(xhr.status);
if (xhr.readyState === 4 && xhr.status === 200) {
//var json = JSON.parse(xhr.responseText);
console.log(xhr.responseText);
}
};
var data = JSON.stringify({"name": cmd});
//console.log(data);
xhr.send(data);
}
var timeout = setTimeout("updateRefresh();",1000);
var enable = true;
var timer = 10;
function updateRefresh() {
//clearTimeout(timeout);
//timeout = setTimeout("updateRefresh();",10000);
//document.getElementById("refreshMsg").value = "Refresh";
timer = timer - 1;
if ( timer > 0 ) {
clearTimeout(timeout);
document.getElementById("refreshMsg").lastChild.textContent = timer + "s" ;
timeout = setTimeout("updateRefresh();",1000);
} else {
timer = 10;
location.reload(true);
}
}
function toggleRefresh()
{
if ( enable ) {
enable = false;
document.getElementById("refreshMsg").lastChild.textContent = "Off";
clearTimeout(timeout);
} else {
enable = true;
timer = 10;
document.getElementById("refreshMsg").lastChild.textContent = "10s";
clearTimeout(timeout);
timeout = setTimeout("updateRefresh();",1000);
}
}
</script>
<noscript>
<div id='alert_javascript'>
This website need Javascript.<br>
Could you please enable Javascript?
</div>
</noscript>
<body onload="setHref()">
<p>
<a href="/" id="home" >Home</a>
<a>OpenNelManager</a>
<a href="/EnableJavascript" id="admin-href" >Administration</a>
<a href="/phpmyadmin/">phpmyadmin</a>
<a href="/patch/">patch</a>
</p>
<div id='title_info'>KHANAT SERVER DOCKER (TEST ENVIRONMENT - STATES)</div>
<?php
function get_port($filecfg)
{
// $ini_array = parse_ini_file($filecfg);
// return "${ini_array['port']}";
$fp = fopen($filecfg, "r");
if ($fp) {
while (($line = fgets($fp)) !== false) {
list($data, $comment) = explode('#', $line, 2);
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
if ( $key == "port" ) {
return trim($value);
}
}
fclose($fp);
}
return "8000";
}
if (file_exists('/home/gameserver/opennelmanager.flag')) {
$cfgfile = "/home/gameserver/khanat/khaganat.cfg";
if (file_exists($cfgfile)) {
$info = get_port($cfgfile);
$rooturl = "http://" . getHostByName(gethostname()) . ":" . $info ;
$url = $rooturl . "/STATUSALL";
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);
$data = json_decode($result,true);
///Count
$total=count($data);
echo '<div>Number command:'.$total.'<br/>';
echo "<table>";
echo "<tr><th>Command</th><th>Start</th><th>Stop</th><th>State</th><th>Log</th></tr>";
ksort($data);
foreach ($data as $key => $value)
{
if ( $value == 'started' ) {
$fond = "bgcolor=\"SpringGreen \"";
} else {
$fond = "bgcolor=\"Tomato\"";
}
list($type, $command) = explode(':', $key, 2);
echo "<tr><td>$command</td><td><button onclick=\"start('$rooturl', '$key')\">Start</button></td><td><button onclick=\"stop('$rooturl', '$key')\">Stop</button></td><td $fond>$value</td><td><a href=\"/opennelmanager_log.php?command=$key\">log</a></td></tr>";
}
echo "</table></div>";
} else {
echo "<a>OpenNelManager not used</a>";
}
} else {
echo "<a>OpenNelManager not actiavted</a>";
}
?>
</p>
<div>
Command line :
<div id='command_shell'>
curl -XGET <?php print $url;?>
</div>
</div>
<p id="info"></p>
<p>Refresh : <button id="refreshMsg" size="10" onclick="toggleRefresh();"/>10s</button></p>
</body>
</html>

View file

@ -0,0 +1,226 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Khanat Log</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/";
}
function send(rooturl, id) {
//document.getElementById("info").innerHTML = "send " + rooturl + ", " + document.getElementById(id).value;
var xhr = new XMLHttpRequest();
var url = rooturl + "/STDIN";
//console.log(url);
xhr.open("POST", url, true);
xhr.setRequestHeader("content-type", "application/json");
xhr.onreadystatechange = function () {
console.log(xhr.readyState);
console.log(xhr.status);
if (xhr.readyState === 4 && xhr.status === 200) {
//var json = JSON.parse(xhr.responseText);
console.log(xhr.responseText);
}
};
var data = JSON.stringify({"name": "<?php echo $_GET['command']; ?>", "action": document.getElementById(id).value});
//console.log(data);
xhr.send(data);
}
</script>
<noscript>
<div id='alert_javascript'>
This website need Javascript.<br>
Could you please enable Javascript?
</div>
</noscript>
<body onload="setHref()">
<p>
<a href="/" id="home" >Home</a>
<?php
if (file_exists('/home/gameserver/opennelmanager.flag')) {
echo "<a href=\"/opennelmanager.php\">OpenNelManager</a>";
} else {
echo "<a>opennelmanager not used</a>";
}
?>
<a href="/EnableJavascript" id="admin-href" >Administration</a>
<a href="/phpmyadmin/">phpmyadmin</a>
<a href="/patch/">patch</a>
</p>
<div id='title_info'>KHANAT SERVER DOCKER (TEST ENVIRONMENT - LOG)</div>
<div id='important_info'><?php echo $_GET['command']; ?></div>
<?php
function get_port($filecfg)
{
// $ini_array = parse_ini_file($filecfg);
// return "${ini_array['port']}";
$fp = fopen($filecfg, "r");
if ($fp) {
while (($line = fgets($fp)) !== false) {
list($data, $comment) = explode('#', $line, 2);
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
if ( $key == "port" ) {
return trim($value);
}
}
fclose($fp);
}
return "8000";
}
$cfgfile = "/home/gameserver/khanat/khaganat.cfg";
if (file_exists($cfgfile)) {
$info = get_port($cfgfile);
$rooturl = "http://" . getHostByName(gethostname()) . ":" . $info ;
$url = $rooturl . "/STDOUT";
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = "{\"name\": \"${_GET['command']}\", \"first-line\": 0}";
$headers = array(
"GET /STDOUT HTTP/1.0",
'Content-type: application/json',
'Content-Length: ' . strlen($data)
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);
// var_dump($result);
$data = json_decode($result,true);
// var_dump($data);
///Count
$total=count($data);
echo "<div>First line:${data['first-line']} Last line:${data['last-line']}<br/>";
echo "<table>";
echo "<tr><th>Pos</th><th>Date</th><th>Time</th><th>Zone</th><th>Type</th><th>Address</th><th>Program Line</th><th>Message</th></tr>";
ksort($data);
foreach ($data as $key => $value)
{
// 2018/08/03 10:45:36 CEST INF 442b0740 command.cpp 149
list($date, $hour, $timezone, $typesrc, $addr, $program, $line, $msg) = explode(' ', $value, 8);
if ( $key == "first-line" or $key == "last-line" )
continue;
$type = substr( $typesrc, strlen($typesrc) - 3 );
if ( $type == 'INF' ) {
$fond = "bgcolor=\"SpringGreen \"";
} else if ( $type == 'DBG') {
$fond = "bgcolor=\"AQUAMARINE\"";
} else if ( $type == 'WRN') {
$fond = "bgcolor=\"Yellow\"";
} else if ( $type == 'ERR') {
$fond = "bgcolor=\"Tomato\"";
} else if ( $type == 'STT') {
$fond = "bgcolor=\"Yellow\"";
} else if ( $type == 'AST') {
$fond = "bgcolor=\"Yellow\"";
} else if ( $type == 'UKN') {
$fond = "bgcolor=\"Tomato\"";
} else {
$msg = "$typesrc $addr $program $line $msg";
$type = "?";
$addr = "";
$program = "";
$line = "";
$fond = "bgcolor=\"Tomato\"";
}
if ( $program != "" && $line != "" )
{
if ( substr( $program, strlen($program) - 4 ) != ".cpp" and substr( $program, strlen($program) - 2 ) != ".h" )
{
$msg = "$program $line $msg";
$program = "";
$line = "";
}
}
echo "<tr><td>$key</td><td>$date</td><td>$hour</td><td>$timezone</td><td $fond>$type</td><td>$addr</td><td>$program $line</td><td $fond>$msg</td></tr>";
}
echo "</table></div>";
} else {
echo "<a>OpenNelManager not enabled</a>";
}
?>
<br>
Send to STDIN: <input type="text" id="command" value="command" size="100"/>
<input type="submit" value="Submit" onclick="send('<?php echo $rooturl; ?>', 'command');"/>
<br>
</p>
<div>
Command line :
<div id='command_shell'>
curl -XGET --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\", \"first-line\": 0}";?>' <?php print $url;?>
</div>
</div>
<p id="info"></p>
</body>
</html>

View file

@ -21,22 +21,24 @@
# Global parameter
##############################
##############################
[config]
[config:server]
# Define port listen (default 8000)
port = 8000
# key
keyfile = /home/gameserver/ca/appli/private/serverkey.pem
# certificate
certfile = /home/gameserver/ca/appli/certs/servercert.pem
# certification to check signature
ca_cert = /home/gameserver/ca/appli/certs/cachaincert.pem
# Method http or https
method = http
# address listen (default all port)
address =
[config:client]
# you can use curl as client
# like: curl -XGET http://127.0.0.1:8000/STATUSALL
# curl -XPOST http://127.0.0.1:8000/STARTALL
port = 8000
method = http
address = 127.0.0.1
##############################
##############################
# List all program we manage #
@ -46,7 +48,7 @@ address =
##############################
# Admin Executor Service
##############################
[aes]
[command:aes]
# command to launch the program
command = ryzom_admin_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --fulladminname=admin_executor_service --shortadminname=AES
# Path : where this program is launched
@ -59,7 +61,7 @@ bufsize = 100
##############################
# bms_master : backup_service
##############################
[bms_master]
[command:bms_master]
# command to launch the program
command = ryzom_backup_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid -P49990
# Path : where this program is launched
@ -67,7 +69,7 @@ path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)
logsize = 1000
#[bms_pd_master]
#[command:bms_pd_master]
# # command to launch the program
# command = ryzom_backup_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid -P49992
# # Path : where this program is launched
@ -78,7 +80,7 @@ logsize = 1000
##############################
# egs : entities_game_service
##############################
[egs]
[command:egs]
# command to launch the program
command = ryzom_entities_game_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid
# Path : where this program is launched
@ -89,7 +91,7 @@ logsize = 1000
##############################
# gpms : gpm_service
##############################
[gpms]
[command:gpms]
# command to launch the program
command = ryzom_gpm_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid
# Path : where this program is launched
@ -100,7 +102,7 @@ logsize = 1000
##############################
# ios : input_output_service
##############################
[ios]
[command:ios]
# command to launch the program
command = ryzom_ios_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid
# Path : where this program is launched
@ -111,7 +113,7 @@ logsize = 1000
##############################
# rns : naming_service
##############################
[rns]
[command:rns]
# command to launch the program
command = ryzom_naming_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid
# Path : where this program is launched
@ -122,7 +124,7 @@ logsize = 1000
##############################
# rws : welcome_service
##############################
[rws]
[command:rws]
# command to launch the program
command = ryzom_welcome_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid
# Path : where this program is launched
@ -133,7 +135,7 @@ logsize = 1000
##############################
# ts : tick_service
##############################
[ts]
[command:ts]
# command to launch the program
command = ryzom_tick_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid
# Path : where this program is launched
@ -144,7 +146,7 @@ logsize = 1000
##############################
# ms : mirror_service
##############################
[ms]
[command:ms]
# command to launch the program
command = ryzom_mirror_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid
# Path : where this program is launched
@ -155,7 +157,7 @@ logsize = 1000
##############################
# ais_newbyland : ai_service
##############################
[ais_newbyland]
[command:ais_newbyland]
# command to launch the program
command = ryzom_ai_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid -mCommon:Newbieland:Post
# Path : where this program is launched
@ -166,7 +168,7 @@ logsize = 1000
##############################
# mfs : mail_forum_service
##############################
[mfs]
[command:mfs]
# command to launch the program
command = ryzom_mail_forum_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid
# Path : where this program is launched
@ -177,7 +179,7 @@ logsize = 1000
##############################
# su : shard_unifier_service
##############################
[su]
[command:su]
# command to launch the program
command = ryzom_shard_unifier_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid
# Path : where this program is launched
@ -188,7 +190,7 @@ logsize = 1000
##############################
# fes : frontend_service
##############################
[fes]
[command:fes]
# command to launch the program
command = ryzom_frontend_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid
# Path : where this program is launched
@ -199,7 +201,7 @@ logsize = 1000
##############################
# sbs : session_browser_server
##############################
[sbs]
[command:sbs]
# command to launch the program
command = ryzom_session_browser_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid
# Path : where this program is launched
@ -210,7 +212,7 @@ logsize = 1000
##############################
# lgs : logger_service
##############################
[lgs]
[command:lgs]
# command to launch the program
command = ryzom_logger_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid
# Path : where this program is launched
@ -218,7 +220,7 @@ path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)
logsize = 1000
# [mos]
# [command:mos]
# # command to launch the program
# command = ryzom_monitor_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid
# # Path : where this program is launched
@ -226,7 +228,7 @@ logsize = 1000
# # size buffer log for each program launched (number line stdout)
# logsize = 1000
# [pdss]
# [command:pdss]
# # command to launch the program
# command = ryzom_pd_support_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/khanat/server/log --nobreak --writepid
# # Path : where this program is launched
@ -237,7 +239,7 @@ logsize = 1000
##############################
# ras : admin_service
##############################
[ras]
[command:ras]
# command to launch the program
command = 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
# Path : where this program is launched

View file

@ -72,6 +72,25 @@ fi
source /home/gameserver/.bashrc
####################################
# opennel-pymanager
####################################
msg_info "[$(basename $0):$LINENO] install/update opennel-pymanager"
last_pymanager_package=$(ls /opt/ref/pymanager/pymanager*.whl | head -n 1)
if [[ -n "$last_pymanager_package" ]]
then
pip3 show pymanager
if [[ $? -eq 0 ]]
then
msg_info "[$(basename $0):$LINENO] uninstall opennel-pymanager"
pip3 uninstall -y pymanager
fi
msg_info "[$(basename $0):$LINENO] install opennel-pymanager"
pip3 install $last_pymanager_package
else
msg_info "[$(basename $0):$LINENO] no package opennel-pymanager"
fi
####################################
# End
####################################

View file

@ -271,7 +271,7 @@ SSH : ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver
Use 'sudo bash' to connect on root (ssh/terminal)
---------------------------------------------------
log khanat server : /home/gameserver/khanat/server/log/log.log
log khanat server : /home/gameserver/khanat/server/log/log.log
***************************************************
ENDOFCOMMENT
EOF

View file

@ -190,6 +190,10 @@ do
METHOD_START=5
shift
;;
--start-with-manager)
METHOD_START=6
shift
;;
*)
msg_error "options '$1' not recognize"
usage
@ -282,34 +286,49 @@ WHERE domain_id = 12;" || exit 2
# Start khanat
#####################
msg_debug "Start khanat"
rm /home/gameserver/opennelmanager.flag || echo ""
if [[ $METHOD_START -eq 0 ]]
then
msg_debug "start with screen"
source /home/gameserver/.bashrc; export RYZOM_PATH=$KHANAT_PATH; cd "$RYZOM_PATH"; $KHANAT_HOME/khanat/tools/scripts/linux/shard start
elif [[ $METHOD_START -eq 1 ]]
then
msg_debug "start with show-khanat-log"
/opt/ext/servercontainer_launch_service.sh
sleep 10
tail -n+0 -f /home/gameserver/log/khanat/log.log
elif [[ $METHOD_START -eq 2 ]]
then
msg_debug "start with show-status-nagios"
/opt/ext/servercontainer_launch_service.sh
sleep 10
watch cat /home/gameserver/khanat/server/aes_nagios_report.txt
elif [[ $METHOD_START -eq 3 ]]
then
msg_debug "start with show-all-log"
/opt/ext/servercontainer_launch_service.sh
sleep 10
tail -n+0 -f /home/gameserver/log/apache2/* /home/gameserver/log/mysql/* /home/gameserver/log/khanat/*
elif [[ $METHOD_START -eq 4 ]]
then
msg_debug "start with "
/opt/ext/servercontainer_launch_service.sh
sleep 10
watch /opt/ext/servercontainer_launch_status.sh --no-color
elif [[ $METHOD_START -eq 5 ]]
then
msg_debug "start with show-status"
/opt/ext/servercontainer_launch_service.sh
#sleep 10
bash
elif [[ $METHOD_START -eq 6 ]]
then
msg_debug "start with OpenNelManager"
touch /home/gameserver/opennelmanager.flag
python3 -m pymanager.manager -c /home/gameserver/khanat/khaganat.cfg --log DEBUG --filelog /home/gameserver/log/khanat/OpenNelManager.log --launch-program &
#sleep 10
#screen -t terminal /bin/bash -l
/bin/bash -l
else
msg_error 'Bad option'
exit 2

View file

@ -58,6 +58,7 @@ done
#/opt/ext/servercontainer_configure_world.sh || 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 $OPTION" gameserver || msg_critical "[$(basename $0):$LINENO] Issue when configure patch"
su -c '/opt/ext/servercontainer_configure_launcher.sh' gameserver || exit 2
msg_info "[$(basename $0):$LINENO] => END"
exit 0

View file

@ -39,6 +39,7 @@ declare DOCKERBUILDOPT=""
declare DOCKERRUNOPT=""
declare CONFIGUREAUTO=""
declare UPDATEAUTO=""
declare -i CLEARTERMINAL=1
declare IMAGEGENERICSERVER="opennel/server_generic_debian_stretch_x86_64"
declare IMAGEKHANATSERVER="opennel/servercontainer_debian_stretch_x86_64"
@ -49,6 +50,7 @@ declare DIRLOG="$ROOTDATAKHANAT/log"
declare DIRDATABASE="$ROOTDATAKHANAT/database"
declare ENVIFILE="$DIROUTPUT/khanat_config.sh"
declare DIRKHANAT="$ROOTDATAKHANAT/khanat"
declare DIRLOCAL="$ROOTDATAKHANAT/.local"
declare KHANAT_RESSOURCES_DIR=""
declare KHANAT_CLIENT_DATA_DIR=""
declare OPENNEL_CODE_DIR=""
@ -188,30 +190,37 @@ do
;;
--start-khanat-with-screen)
METHODSTARTSERVER="--start-khanat-with-screen"
CLEARTERMINAL=1
shift
;;
--start-khanat-with-khanat-log)
METHODSTARTSERVER="--show-khanat-log"
CLEARTERMINAL=1
shift
;;
--start-khanat-with-full-log)
METHODSTARTSERVER="--show-all-log"
CLEARTERMINAL=1
shift
;;
--start-khanat-with-watch-state)
METHODSTARTSERVER="--show-status"
CLEARTERMINAL=1
shift
;;
--start-khanat-with-watch-state-nagios)
METHODSTARTSERVER="--show-status-nagios"
CLEARTERMINAL=1
shift
;;
--start-khanat-with-bash-after)
METHODSTARTSERVER="--bash-after-start"
CLEARTERMINAL=1
shift
;;
--start-with-manager)
METHODSTARTSERVER="--start-with-manager"
CLEARTERMINAL=0
shift
;;
--client-version*)
@ -481,6 +490,7 @@ then
msg_info "[$(basename $0):$LINENO] CONFIGURE KHANAT SERVER"
mkdir -p $DIRLOG || exit 2
mkdir -p $DIRDATABASE || exit 2
mkdir -p ${DIRLOCAL} || exit 2
msg_debug "[$(basename $0):$LINENO] command : cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
@ -492,6 +502,8 @@ then
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \
-v ${rootdir}/${LOCALBUILDDIR}:/opt/ref/pymanager:ro \
-v ${rootdir}/${DIRLOCAL}:/home/gameserver/.local:rw \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_configure_auto.sh"
cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \
@ -504,12 +516,17 @@ then
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \
-v ${rootdir}/${LOCALBUILDDIR}:/opt/ref/pymanager:ro \
-v ${rootdir}/${DIRLOCAL}:/home/gameserver/.local:rw \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_configure_auto.sh $CONFIGUREAUTO || exit 2
fi
if [[ $UPDATEDATA -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] UPDATE KHANAT SERVER"
mkdir -p $DIRLOG || exit 2
mkdir -p $DIRDATABASE || exit 2
mkdir -p ${DIRLOCAL} || exit 2
msg_debug "[$(basename $0):$LINENO] command: cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
@ -521,6 +538,8 @@ then
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \
-v ${rootdir}/${LOCALBUILDDIR}:/opt/ref/pymanager:ro \
-v ${rootdir}/${DIRLOCAL}:/home/gameserver/.local:rw \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_update_auto.sh $UPDATEAUTO"
cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \
@ -533,6 +552,8 @@ then
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \
-v ${rootdir}/${LOCALBUILDDIR}:/opt/ref/pymanager:ro \
-v ${rootdir}/${DIRLOCAL}:/home/gameserver/.local:rw \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_update_auto.sh $UPDATEAUTO || exit 2
fi
@ -553,10 +574,15 @@ then
-v ${rootdir}/server/debian/common/:/opt/ext:ro \
-v $rootdir/build:/opt/build:ro \
-v ${OPENNEL_CODE_DIR}:/opt/ref/opennel-code:ro \
-v ${rootdir}/${DIRLOCAL}:/home/gameserver/.local:rw \
-v ${rootdir}/server/common/rootweb/:/home/gameserver/rootweb:ro \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_launch_auto.sh $METHODSTARTSERVER -d
msg_info "[$(basename $0):$LINENO] CLEAR TERMINAL"
clear
tput clear
if [[ $CLEARTERMINAL -ne 0 ]]
then
clear
tput clear
fi
fi
trap '' EXIT