Compare commits

..

52 commits

Author SHA1 Message Date
8d0a6efba2 remove old option, and add option to clear terminal after use server-container.sh 2018-09-19 15:54:09 +02:00
d1417d7261 move log localization on khanat server 2018-09-19 15:53:40 +02:00
abf682eea1 disable color on strdout when managed by OpenNelManager 2018-09-19 10:14:16 +02:00
cf4d39dd48 adding comment 2018-09-19 10:13:44 +02:00
cea7f76ca4 extend size log for EGS module 2018-09-19 10:12:19 +02:00
893c14e6f4 remove expiration on artefact and concat apt-get install 2018-09-17 21:37:46 +02:00
3e865b20b8 start with opennel-manager 2018-09-17 20:37:42 +02:00
5d3961ae4f start in default with OpenNel-Manager, remove old option, create directory for gpms 2018-08-22 23:37:29 +02:00
bcbd34a4f5 Merge branch 'develop' of ssh://git.khaganat.net:3543/khaganat/mmorpg_khanat/khanat-server-docker into develop 2018-08-21 00:56:17 +02:00
c0e183d351 check flag before delete, adding pip in internal docker test 2018-08-21 00:55:57 +02:00
Jean Sorgemoel
577e7eb028 correct artefact server static 2018-08-16 21:38:43 +02:00
Jean Sorgemoel
7d3165c320 change default method (now start with opennel-manager) 2018-08-16 19:30:18 +02:00
Jean Sorgemoel
693067feec create default directory log 2018-08-06 23:15:08 +02:00
Jean Sorgemoel
25dee507bb adding message debug 2018-08-06 23:14:41 +02:00
Jean Sorgemoel
eac03fb61b correct color for AST message 2018-08-06 23:13:57 +02:00
Jean Sorgemoel
27f2c50323 adding OpenNelManager on docker 2018-08-05 13:36:12 +02:00
cd60df3e13 adding pymanager 2018-07-26 15:57:05 +02:00
d98324cabc install pip3 & bcrypt 2018-07-26 11:39:08 +02:00
b427d1be75 change method to load environment 2018-07-26 09:36:10 +02:00
f01002afda adding message 2018-07-26 09:35:31 +02:00
fa4301a6d9 adding option to start container docker 2018-07-26 09:35:11 +02:00
d607c736e0 adding update data 2018-07-10 22:27:24 +02:00
db40e5037d list all file in /opt 2018-07-10 21:18:20 +02:00
0a120502a3 update comment 2018-07-09 23:28:48 +02:00
031dac6f4e correct package client generated on 64bit 2018-07-09 22:00:05 +02:00
2fc85bbcf5 remove jessie builder/server, update script prepare_environment_container_64.sh 2018-07-09 21:48:03 +02:00
bda0ee307c update arteafact name 2018-07-07 00:26:53 +02:00
f7d69f9ba1 increase retention for artefact & add information version 2018-07-06 22:44:59 +02:00
Jean Sorgemoel
556b3ef43e Merge branch 'develop' of ssh://git.khaganat.net:3543/khaganat/mmorpg_khanat/khanat-server-docker into develop 2018-07-06 00:53:07 +02:00
Jean Sorgemoel
98e0583794 update banner, screen to see command 2018-07-06 00:52:57 +02:00
98956788d4 reactivate gzip 2018-07-05 21:52:39 +02:00
f958df068b update artefact name & update html help 2018-06-28 16:19:46 +02:00
a1e7125ad4 update extension image docker 2018-06-28 14:29:30 +02:00
647e9a2f3c remove verbose mode on tar 2018-06-28 12:46:01 +02:00
9c756304f6 use bzip2 for docker image 2018-06-28 12:13:47 +02:00
b1e8c96069 update referential artefact client 2018-06-28 11:32:39 +02:00
c552aa5fd7 adding default web page to show some information, adding option to disable copy binary, change image docker 2018-06-28 10:45:45 +02:00
Jean Sorgemoel
f1cf31924e adding patch to analyze crash on callNativeCallBack 2018-04-30 20:34:08 +02:00
Jean Sorgemoel
e6b4928491 adding function to start server (container) on debian strech 2018-04-22 21:12:51 +02:00
bdc7a60634 extract pymanager 2018-04-19 16:28:03 +02:00
db0c5adb48 update script to build localy (on docker for debian strech) 2018-04-19 15:55:56 +02:00
446eaa8b12 download opennel-pymanager & use global script to configure khanat 2018-04-11 22:55:54 +02:00
c8042df2fa change compress method for khanat image 2018-04-11 12:12:22 +02:00
24ced301ef compress artefacts 2018-04-07 12:37:29 +02:00
35d247f603 include data gameserver 2018-04-07 00:25:47 +02:00
e4e3bd2039 reduce size artefact 2018-04-06 22:47:55 +02:00
240f3f28ea update image generate 2018-04-06 22:17:22 +02:00
032336794f update artefacts data 2018-04-06 00:43:20 +02:00
899da57b87 remove query command 2018-04-05 22:56:33 +02:00
6eda63e517 update script mysql (to manage debian 8 or 9) 2018-04-05 22:34:26 +02:00
07e05605f6 adding script to download artefacts 2018-04-05 22:21:55 +02:00
f661343e0a update comment on .gitlab-ci.yml 2018-04-05 22:21:35 +02:00
41 changed files with 1615 additions and 2481 deletions

99
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,99 @@
# Configuration for Continous Integration
#
# Copyright (C) 2017 AleaJactaEst
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Example to execute locally:
# gitlab-runner exec docker --kubernetes-memory-limit="10g" --kubernetes-service-memory-limit="10g" --kubernetes-memory-request="10g" --kubernetes-helper-memory-limit="10g" 'Linux server build'
# gitlab-runner exec docker --timeout=3600 'Linux server build'
stages:
- build
Linux server build:
stage: build
tags:
- Docker
image: amd64/debian:9
script:
- export -p WORKDIR=$PWD
- apt-get update
- apt-get dist-upgrade -y
- DEBIAN_FRONTEND=noninteractive apt-get install -y bash-completion bsd-mailx cron curl debootstrap fakechroot fakeroot git jq less logrotate lzma nano net-tools openssh-server p7zip p7zip-full schroot sudo unzip vim wget xdelta python3-pip python3-bcrypt libxml2 libpng16-16 libjpeg62-turbo libxmu6 libgif7 libssl1.1 liblzma5 zlib1g libssh2-1 libtool libxml2 mysql-server apache2 apache2-utils libapache2-mod-php mcrypt php php-gd php-imagick php-mcrypt php-mysql python3 rrdtool screen phpmyadmin phpmyadmin
- mkdir -p /opt/download
- export -p DIR_ARTEFACTS="/opt/download"
- (cd /opt/download ; $WORKDIR/server/common/download_artefacts.sh 'https://git.khaganat.net' 'khaganat' 'mmorpg_khanat/khanat-opennel-code' $CI_COMMIT_REF_NAME 'develop' 'master')
- (cd /opt/download ; $WORKDIR/server/common/download_artefacts.sh 'https://git.khaganat.net' 'khaganat' 'mmorpg_khanat/opennel-pymanager' $CI_COMMIT_REF_NAME 'develop' 'master')
- ls -l /opt/download
- mkdir -p /opt/artefacts
- (cd /opt/artefacts ; for file in /opt/download/khanat-server_static-debian_amd64_strech*.zip ; do echo "extract $file"; unzip -q -o $file; done)
- (cd /opt/artefacts ; for file in /opt/download/khanat-client_static-debian_amd64_strech*.zip ; do echo "extract $file"; unzip -q -o $file; done)
- (cd /opt/artefacts ; for file in /opt/download/khanat-*pymanager*.zip ; do echo "extract $file"; unzip -q -o $file; done)
- mkdir -p /opt/ext
- cp $WORKDIR/server/debian/common/servercontainer_init_* /opt/
- cp $WORKDIR/server/debian/common/servercontainer_function.sh /opt/
- cp $WORKDIR/server/debian/common/* /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="Khanat_Linux64"\nexport PACKAGECLIENT="smokey_linux64"' > /opt/khanat_config.sh
- mkdir -p /var/run/mysqld
- /opt/servercontainer_init_create_account.sh
- /opt/servercontainer_init_mysql.sh
- /opt/servercontainer_init_apache.sh
- /opt/servercontainer_init_configure_envi.sh
- source /home/gameserver/.bashrc
# - export -p KHANAT_HOME=/home/gameserver
# - export -p KHANAT_PATH=/home/gameserver/khanat
# - export -p PATH=$PATH:/usr/local/bin
# - export -p PATCH_CLIENT_SYSTEM=$KHANAT_HOME/khanat/patch_service
# - export -p DIRCLIENT="Khanat_Linux64"
# - export -p PACKAGECLIENT="smokey_linux64"
# - export -p PREPARE_CLIENT_DIR="khanat/prepare_client/$DIRCLIENT"
# - export -p CLIENT_DIR="khanat/client_service"
# - export -p HOME_PREPARE_CLIENT="$KHANAT_HOME/$PREPARE_CLIENT_DIR"
# - export -p HOME_CLIENT="$KHANAT_HOME/$CLIENT_DIR"
- echo "KHANAT_PATH $KHANAT_PATH"
- mkdir -p $KHANAT_PATH
- mkdir -p /home/gameserver/ext
- ln -s /opt/artefacts/code/web /home/gameserver/ext/khanatweb
- ln -s /opt/artefacts/code/ryzom /home/gameserver/ext/ryzom-ressources
- (cd /home/gameserver/ext; git clone -q https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-ressources.git)
#- ln -s /opt/download/khanat-ressources /home/gameserver/ext/khanat-ressources
- (cd /home/gameserver/ext; git clone -q https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-client-data.git)
#- ln -s /opt/download/khanat-client-data /home/gameserver/ext/khanat-client-data
- for file in /opt/artefacts/code/build/bin/* ; do ln -s $file /usr/local/bin ; done
- for file in /opt/artefacts/code/build/lib/* ; do ln -s $file /usr/local/lib ; done
- ldconfig
- /opt/ext/servercontainer_configure_auto.sh
- /opt/ext/servercontainer_update_auto.sh
# Install pymanager
- pip3 install /opt/artefacts/dist/pymanager-1.0.0.tar.gz
# Clean
- rm -f /opt/servercontainer*
# Create image
- option=""
- echo "khanat-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID-server-debian-stretch" > /home/gameserver/version.txt
- for dir in /home/* ; do if [ $dir != '/home/gameserver' ] ; then option="$option --exclude=$dir" ; fi ; done
- echo "option '$option'"
#- find /home/gameserver -type d -exec du -sh {} \;
- find /opt -type d -exec du -sh {} \;
- tar --numeric-owner --exclude=.git --exclude=.dockerenv --exclude=/proc --exclude=/sys --exclude=/builds --exclude=/opt/download --exclude=khanat-debian-server.tar.gz $option -czf khanat-debian-server.tar.gz /
- ls -lh khanat-debian-server.*
artifacts:
name: "khanat-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID-server-debian-stretch"
paths:
- khanat-debian-server.tar.gz

View file

@ -1,101 +0,0 @@
# Dockerfile - Build environment to compile khanat server
#
# Copyright (C) 2017 AleaJactaEst
#
# 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 <https://www.gnu.org/licenses/>.
FROM i386/debian:8
MAINTAINER AleaJactaEst
ENV HOSTNAME builder
RUN apt-get update ; \
apt-get dist-upgrade -y ; \
DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server ; \
apt-get install -y apache2 \
php5 \
libapache2-mod-php5 \
php5-mysql \
apache2-utils \
php5-gd \
php5-imagick \
git \
libcurl4-openssl-dev \
libluabind-dev \
libfreetype6-dev \
libx11-dev \
libgl1-mesa-dev \
libxxf86vm-dev \
libxrandr-dev \
libxrender-dev \
libopenal-dev \
libogg-dev \
libvorbis-dev \
libxml2-dev \
cmake \
build-essential \
libpng12-dev \
libjpeg62-turbo-dev \
rrdtool \
bison \
libxmu-dev \
autoconf \
automake \
libmysqlclient-dev \
libgif-dev \
cpputest \
libssl-dev \
liblzma-dev \
unzip \
zlib1g-dev \
libssh-dev \
libboost-all-dev \
libopenal-dev \
libgl1-mesa-dev \
libogg-dev \
mercurial \
wget \
python3 \
python3-setuptools
## Build & Install cpptest
# Impossible to build release 1.1.0, 1.1.1, 1.1.2
RUN apt-get install -y wget autogen autoconf automake libtool libtool-bin
RUN mkdir -p /opt/src
RUN wget -q https://github.com/cpptest/cpptest/archive/1.0.5.tar.gz -O /opt/src/cpptest.tar.gz
RUN rm -rf /opt/src/cpptest
RUN tar xvf /opt/src/cpptest.tar.gz -C /opt/src --strip 1
RUN cd /opt/src/cpptest && ./autogen.sh && ./configure && make && make install
## Build & Install squish
RUN mkdir -p /opt/src
RUN cd /opt/src; wget -c https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/libsquish/squish-1.11.zip
RUN cd /opt/src; unzip squish-1.11.zip
COPY builder/common/squish-limit.patch /opt/squish-limit.patch
RUN cd /opt/src/squish-1.11; patch -i /opt/squish-limit.patch
RUN cd /opt/src/squish-1.11; make
RUN cd /opt/src/squish-1.11; make install
## Build & Install CURL - 7.46.0
#RUN hg clone http://hg.kervala.net/packaging/
#RUN mkdir -p packaging/curl/build
#RUN cd packaging/curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DBUILD_CURL_TESTS=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.a ..
#RUN cd packaging/curl/build; make
#RUN cd packaging/curl/build; make install
RUN wget -q https://curl.haxx.se/download/curl-7.46.0.tar.gz -O /opt/src/curl.tar.gz
RUN mkdir -p /opt/src/curl/build
RUN tar xvf /opt/src/curl.tar.gz -C /opt/src/curl --strip 1
RUN cd /opt/src/curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DBUILD_CURL_TESTS=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.a ..
RUN cd /opt/src/curl/build; make
RUN cd /opt/src/curl/build; make install

View file

@ -1,70 +0,0 @@
#!/bin/bash
# Script to build Khaganat binary (executed in docker)
#
# Copyright (C) 2017 AleaJactaEst
#
# 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 <https://www.gnu.org/licenses/>.
#
declare DIRBUILD="/opt/build/"
if [[ -n "$1" ]]
then
DIRBUILD="$1"
fi
declare LOGFILE="${DIRBUILD}/build.log"
function chrashed()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - BUILD FAILED (code:$?)" >> $LOGFILE
exit 2
}
function msg_info()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $1"
echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $1" >> $LOGFILE
}
trap chrashed EXIT
msg_info "CREATE BUILD DIRECTORY"
mkdir -p ${DIRBUILD}/ || exit 2
if [[ -f ${DIRBUILD}/envi.sh ]]
then
msg_info "LOAD ENVIRONMENT"
source ${DIRBUILD}/envi.sh
fi
msg_info "PREPARE BUILD"
# on 32bit, we need add option '-DWITH_SSE2=OFF'
cd ${DIRBUILD}; 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} \
/opt/code 1>>$LOGFILE 2>&1 || exit 2
msg_info "BUILD START"
cd ${DIRBUILD}; make $MAKEOPTS 1>>$LOGFILE 2>&1 || exit 2
msg_info "GENERATE PACKAGE"
cd ${DIRBUILD}; make package 1>>$LOGFILE 2>&1 || exit 2
trap '' EXIT
msg_info "BUILD END"

View file

@ -1,300 +0,0 @@
#!/bin/bash
#
# Script to build khaganat server
#
# Copyright (C) 2017 AleaJactaEst
#
# 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 <https://www.gnu.org/licenses/>.
#
declare -i REMOVE=0
declare -i IMAGE=0
declare -i BUILD=1
declare -i PACKAGE=0
declare -i DEBUG=0
declare JOBS=""
declare CMAKEOPTS=""
declare DOCKEROPTS=""
declare DIRBUILD=""
declare CLEANDOCKER=0
declare -i CLEANIMAGENONE=0
declare -i AUTODETEC=1
declare DOCKERBUILDOPT=""
declare IMAGEDOCKER="opennel/builder_debian_jessie_i686"
declare LOCALBUILDDIR="build/$IMAGEDOCKER"
declare LOCALSRC="debian/jessie/i686"
declare DIRPACKAGE="output/OpenNel_debian_jessie_i686/package"
declare PACKAGEBIN="$DIRPACKAGE/ryzomcore_jessie_i686.tar.gz"
declare PACKAGEREF="$DIRPACKAGE/khanat-ref-ressources.tar.gz"
usage()
{
cat << EOF
usage:$0 [options]
script to build under docker
Step:
1) clean old build directory
2) create image builder
3) launch build under docker (launch script build-under-docker.sh)
4) remove docker container with state exited and clean docker images NONE
options:
-h, --help : Show this help
-d, --debug : Show debug message
-r, --remove : Remove old build repository
-f, --force-create-image : force to create docker image (use to build khanat) - default autodetec.
-j [N], --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
-a OPTS, --add-opts-cmake=OPTS : Adding options on cmake command (before build)
-c, --clean-container : remove all container in state Exited
-w, --clean-images-none : Remove images docker (with name 'none')
-m OPTS, --add-opts-docker=OPTS : Adding options on docker command (when build)
--only-build-server : adding option to build only server
-p, --package : generate package
--code-source=[DIR] : localization source OpenNel code
Example :
cd [root Khanat directory]
./build.sh -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
EOF
}
function msg_debug()
{
if [[ $DEBUG -ne 0 ]]
then
echo "$(date "+%Y/%m/%d %H:%M:%S") DEBUG - $*"
fi
}
function msg_info()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $*"
}
function msg_error()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - $*" >&2
}
#
# MAIN
#
calldir="$(dirname $0)"
basedir=$(cd $calldir; pwd)
rootdir="$(dirname $(dirname $(dirname $(dirname ${basedir}))))"
codesource="$(dirname ${rootdir})/khanat-opennel-code"
while test $# -gt 0
do
case "$1" in
-h|--help)
usage
exit 1
;;
-d|--debug)
DEBUG=1
shift
;;
-c|--clean-container)
CLEANDOCKER=1
shift
;;
-r|--remove)
REMOVE=1
shift
;;
-f|--force-create-image)
IMAGE=1
shift
;;
-p|--package)
PACKAGE=1
shift
;;
-j)
shift
# search next argument is value or new argument
if [[ ${1:0:1} == "-" ]]
then
JOBS="-j"
else
JOBS="-j $1"
shift
fi
;;
--jobs*)
if [[ ${1#*=} == "" ]]
then
JOBS="-j"
else
JOBS="-j ${1#*=}"
fi
shift
;;
-a)
shift
CMAKEOPTS="$CMAKEOPTS $1"
shift
;;
--add-opts-cmake=*)
CMAKEOPTS="$CMAKEOPTS ${1#*=}"
shift
;;
-m)
shift
DOCKEROPTS="$DOCKEROPTS $1"
shift
;;
--add-opts-docker=*)
DOCKEROPTS="$DOCKEROPTS ${1#*=}"
shift
;;
--only-build-server)
CMAKEOPTS="$CMAKEOPTS -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_CLIENT=OFF -DWITH_DRIVER_OPENGL=OFF -DWITH_DRIVER_OPENAL=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_SOUND=OFF"
shift
;;
-w|--clean-images-none)
CLEANIMAGENONE=1
shift
;;
--code-source=*)
codesource="${1#*=}"
shift
;;
*)
msg_error "options '$1' not recognize"
usage
exit 1
;;
esac
done
function chrashed()
{
msg_error "BUILD FAILED (code:$?)"
exit 2
}
trap chrashed EXIT
msg_debug "prg: $0"
docker -v 1>/dev/null
if [[ $? -ne 0 ]]
then
echo "*** ERROR docker not installed"
exit 2
fi
if [[ $AUTODETEC -ne 0 ]]
then
if [[ $(docker images -f "reference=$IMAGEDOCKER" | wc -l) -lt 2 ]]
then
IMAGE=1
fi
fi
DIRBUILD="${rootdir}/${LOCALBUILDDIR}"
msg_debug "calldir: $calldir"
msg_debug "basedir: $basedir"
msg_debug "rootdir: $rootdir"
msg_debug "codesource: $codesource"
msg_debug "JOBS: '$JOBS'"
msg_debug "CMAKEOPTS: '$CMAKEOPTS'"
msg_debug "DOCKEROPTS: '$DOCKEROPTS'"
if [ ! -d "${codesource}/code" ]
then
msg_error "Missing OpenNel source (${codesource})"
exit 2
fi
mkdir -p "${DIRBUILD}"
if [[ $REMOVE -ne 0 ]]
then
msg_info "REMOVE OLD BUILD"
rm -rf ${DIRBUILD}/* || exit 2
fi
echo "$(date "+%Y/%m/%d %H:%M:%S") LAUNCH BUILD" > ${DIRBUILD}/build.log
cat << EOF > ${DIRBUILD}/envi.sh
#!/bin/bash
export MAKEOPTS="$JOBS"
export CMAKEOPTS="$CMAKEOPTS"
EOF
if [[ $IMAGE -ne 0 ]]
then
echo "$(date "+%Y/%m/%d %H:%M:%S") GENERATE DOCKER IMAGE" > ${DIRBUILD}/build.log
msg_info "GENERATE DOCKER IMAGE"
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t "${IMAGEDOCKER}" \
--file "${basedir}/Dockerfile" || exit 2
fi
if [[ $BUILD -ne 0 ]]
then
msg_info "BUILD"
cd $rootdir; docker run -it \
--hostname=builder \
-u "$(id -u $USERNAME):$(id -g $USERNAME)" \
-v ${rootdir}/builder:/opt/builder:ro \
-v ${codesource}/code:/opt/code:ro \
-v ${rootdir}/build:/opt/build \
-v /etc/localtime:/etc/localtime:ro \
${DOCKEROPTS} \
${IMAGEDOCKER} \
/opt/builder/${LOCALSRC}/build-under-docker.sh "/opt/${LOCALBUILDDIR}" || exit 2
fi
if [[ $PACKAGE -ne 0 ]]
then
msg_info "COPY PACKAGES"
mkdir -p "$rootdir/$DIRPACKAGE"
cd ${rootdir}; tar czf ${PACKAGEREF} \
${codesource}/code/ryzom/server/shard.screen.rc \
${codesource}/code/ryzom/common/* \
${codesource}/code/ryzom/client/* \
${codesource}/code/ryzom/server/* \
${codesource}/code/web/* || exit 2
cp ${rootdir}/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz ${PACKAGEBIN} || exit 2
fi
if [[ $CLEANDOCKER -ne 0 ]]
then
msg_info "CLEAN CONTAINER"
docker rm --force `docker ps -qf 'status=exited' -f "ancestor=${IMAGEDOCKER}"` || exit 2
fi
if [[ $CLEANIMAGENONE -ne 0 ]]
then
msg_info "CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]]
then
docker rmi --force "${listimages[@]}" || exit 2
fi
fi
trap '' EXIT
msg_info "END"

View file

@ -1,102 +0,0 @@
# Dockerfile - Build environment to compile khanat server
#
# Copyright (C) 2017 AleaJactaEst
#
# 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 <https://www.gnu.org/licenses/>.
#
FROM amd64/debian:8
MAINTAINER AleaJactaEst
ENV HOSTNAME builder
RUN apt-get update ; \
apt-get dist-upgrade -y ; \
DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server ; \
apt-get install -y apache2 \
php5 \
libapache2-mod-php5 \
php5-mysql \
apache2-utils \
php5-gd \
php5-imagick \
git \
libcurl4-openssl-dev \
libluabind-dev \
libfreetype6-dev \
libx11-dev \
libgl1-mesa-dev \
libxxf86vm-dev \
libxrandr-dev \
libxrender-dev \
libopenal-dev \
libogg-dev \
libvorbis-dev \
libxml2-dev \
cmake \
build-essential \
libpng12-dev \
libjpeg62-turbo-dev \
rrdtool \
bison \
libxmu-dev \
autoconf \
automake \
libmysqlclient-dev \
libgif-dev \
cpputest \
libssl-dev \
liblzma-dev \
unzip \
zlib1g-dev \
libssh-dev \
libboost-all-dev \
libopenal-dev \
libgl1-mesa-dev \
libogg-dev \
mercurial \
wget \
python3 \
python3-setuptools
## Build & Install cpptest
# Impossible to build release 1.1.0, 1.1.1, 1.1.2
RUN apt-get install -y wget autogen autoconf automake libtool libtool-bin
RUN mkdir -p /opt/src
RUN wget -q https://github.com/cpptest/cpptest/archive/1.0.5.tar.gz -O /opt/src/cpptest.tar.gz
RUN rm -rf /opt/src/cpptest
RUN tar xvf /opt/src/cpptest.tar.gz -C /opt/src --strip 1
RUN cd /opt/src/cpptest && ./autogen.sh && ./configure && make && make install
## Build & Install squish
RUN mkdir -p /opt/src
RUN cd /opt/src; wget -c https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/libsquish/squish-1.11.zip
RUN cd /opt/src; unzip squish-1.11.zip
COPY builder/common/squish-limit.patch /opt/squish-limit.patch
RUN cd /opt/src/squish-1.11; patch -i /opt/squish-limit.patch
RUN cd /opt/src/squish-1.11; make
RUN cd /opt/src/squish-1.11; make install
## Build & Install CURL - 7.46.0
#RUN hg clone http://hg.kervala.net/packaging/
#RUN mkdir -p packaging/curl/build
#RUN cd packaging/curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DBUILD_CURL_TESTS=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.a ..
#RUN cd packaging/curl/build; make
#RUN cd packaging/curl/build; make install
RUN wget -q https://curl.haxx.se/download/curl-7.46.0.tar.gz -O /opt/src/curl.tar.gz
RUN mkdir -p /opt/src/curl/build
RUN tar xvf /opt/src/curl.tar.gz -C /opt/src/curl --strip 1
RUN cd /opt/src/curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DBUILD_CURL_TESTS=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.a ..
RUN cd /opt/src/curl/build; make
RUN cd /opt/src/curl/build; make install

View file

@ -1,69 +0,0 @@
#!/bin/bash
# Script to build Khaganat binary (executed in docker)
#
# Copyright (C) 2017 AleaJactaEst
#
# 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 <https://www.gnu.org/licenses/>.
#
declare DIRBUILD="/opt/build/"
if [[ -n "$1" ]]
then
DIRBUILD="$1"
fi
declare LOGFILE="${DIRBUILD}/build.log"
function chrashed()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - BUILD FAILED (code:$?)" >> $LOGFILE
exit 2
}
function msg_info()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $1"
echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $1" >> $LOGFILE
}
trap chrashed EXIT
msg_info "CREATE BUILD DIRECTORY"
mkdir -p ${DIRBUILD}/ || exit 2
if [[ -f ${DIRBUILD}/envi.sh ]]
then
msg_info "LOAD ENVIRONMENT"
source ${DIRBUILD}/envi.sh
fi
msg_info "PREPARE BUILD"
cd ${DIRBUILD}; 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} \
/opt/code 1>>$LOGFILE 2>&1 || exit 2
msg_info "BUILD START"
cd ${DIRBUILD}; make $MAKEOPTS 1>>$LOGFILE 2>&1 || exit 2
msg_info "GENERATE PACKAGE"
cd ${DIRBUILD}; make package 1>>$LOGFILE 2>&1 || exit 2
trap '' EXIT
msg_info "BUILD END"

View file

@ -1,300 +0,0 @@
#!/bin/bash
#
# Script to build khaganat server
#
# Copyright (C) 2017 AleaJactaEst
#
# 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 <https://www.gnu.org/licenses/>.
#
declare -i REMOVE=0
declare -i IMAGE=0
declare -i BUILD=1
declare -i PACKAGE=0
declare -i DEBUG=0
declare JOBS=""
declare CMAKEOPTS=""
declare DOCKEROPTS=""
declare DIRBUILD=""
declare CLEANDOCKER=0
declare -i CLEANIMAGENONE=0
declare -i AUTODETEC=1
declare DOCKERBUILDOPT=""
declare IMAGEDOCKER="opennel/builder_debian_jessie_x86_64"
declare LOCALBUILDDIR="build/$IMAGEDOCKER"
declare LOCALSRC="debian/jessie/x86_64"
declare DIRPACKAGE="output/OpenNel_debian_jessie_x86_64/package"
declare PACKAGEBIN="$DIRPACKAGE/ryzomcore_jessie_x86_64.tar.gz"
declare PACKAGEREF="$DIRPACKAGE/khanat-ref-ressources.tar.gz"
usage()
{
cat << EOF
usage:$0 [options]
script to build under docker
Step:
1) clean old build directory
2) create image builder
3) launch build under docker (launch script build-under-docker.sh)
4) remove docker container with state exited and clean docker images NONE
options:
-h, --help : Show this help
-d, --debug : Show debug message
-r, --remove : Remove old build repository
-f, --force-create-image : force to create docker image (use to build khanat) - default autodetec.
-j [N], --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
-a OPTS, --add-opts-cmake=OPTS : Adding options on cmake command (before build)
-c, --clean-container : remove all container in state Exited
-w, --clean-images-none : Remove images docker (with name 'none')
-m OPTS, --add-opts-docker=OPTS : Adding options on docker command (when build)
--only-build-server : adding option to build only server
-p, --package : generate package
--code-source=[DIR] : localization source OpenNel code
Example :
cd [root Khanat directory]
./build.sh -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
EOF
}
function msg_debug()
{
if [[ $DEBUG -ne 0 ]]
then
echo "$(date "+%Y/%m/%d %H:%M:%S") DEBUG - $*"
fi
}
function msg_info()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $*"
}
function msg_error()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - $*" >&2
}
#
# MAIN
#
calldir="$(dirname $0)"
basedir=$(cd $calldir; pwd)
rootdir="$(dirname $(dirname $(dirname $(dirname ${basedir}))))"
codesource="$(dirname ${rootdir})/khanat-opennel-code"
while test $# -gt 0
do
case "$1" in
-h|--help)
usage
exit 1
;;
-d|--debug)
DEBUG=1
shift
;;
-c|--clean-container)
CLEANDOCKER=1
shift
;;
-r|--remove)
REMOVE=1
shift
;;
-f|--force-create-image)
IMAGE=1
shift
;;
-p|--package)
PACKAGE=1
shift
;;
-j)
shift
# search next argument is value or new argument
if [[ ${1:0:1} == "-" ]]
then
JOBS="-j"
else
JOBS="-j $1"
shift
fi
;;
--jobs*)
if [[ ${1#*=} == "" ]]
then
JOBS="-j"
else
JOBS="-j ${1#*=}"
fi
shift
;;
-a)
shift
CMAKEOPTS="$CMAKEOPTS $1"
shift
;;
--add-opts-cmake=*)
CMAKEOPTS="$CMAKEOPTS ${1#*=}"
shift
;;
-m)
shift
DOCKEROPTS="$DOCKEROPTS $1"
shift
;;
--add-opts-docker=*)
DOCKEROPTS="$DOCKEROPTS ${1#*=}"
shift
;;
--only-build-server)
CMAKEOPTS="$CMAKEOPTS -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_CLIENT=OFF -DWITH_DRIVER_OPENGL=OFF -DWITH_DRIVER_OPENAL=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_SOUND=OFF"
shift
;;
-w|--clean-images-none)
CLEANIMAGENONE=1
shift
;;
--code-source=*)
codesource="${1#*=}"
shift
;;
*)
msg_error "options '$1' not recognize"
usage
exit 1
;;
esac
done
function chrashed()
{
msg_error "BUILD FAILED (code:$?)"
exit 2
}
trap chrashed EXIT
msg_debug "prg: $0"
docker -v 1>/dev/null
if [[ $? -ne 0 ]]
then
echo "*** ERROR docker not installed"
exit 2
fi
if [[ $AUTODETEC -ne 0 ]]
then
if [[ $(docker images -f "reference=$IMAGEDOCKER" | wc -l) -lt 2 ]]
then
IMAGE=1
fi
fi
DIRBUILD="${rootdir}/${LOCALBUILDDIR}"
msg_debug "calldir: $calldir"
msg_debug "basedir: $basedir"
msg_debug "rootdir: $rootdir"
msg_debug "codesource: $codesource"
msg_debug "JOBS: '$JOBS'"
msg_debug "CMAKEOPTS: '$CMAKEOPTS'"
msg_debug "DOCKEROPTS: '$DOCKEROPTS'"
if [ ! -d "${codesource}/code" ]
then
msg_error "Missing OpenNel source (${codesource})"
exit 2
fi
mkdir -p "${DIRBUILD}"
if [[ $REMOVE -ne 0 ]]
then
msg_info "REMOVE OLD BUILD"
rm -rf ${DIRBUILD}/* || exit 2
fi
echo "$(date "+%Y/%m/%d %H:%M:%S") LAUNCH BUILD" > ${DIRBUILD}/build.log
cat << EOF > ${DIRBUILD}/envi.sh
#!/bin/bash
export MAKEOPTS="$JOBS"
export CMAKEOPTS="$CMAKEOPTS"
EOF
if [[ $IMAGE -ne 0 ]]
then
echo "$(date "+%Y/%m/%d %H:%M:%S") GENERATE DOCKER IMAGE" > ${DIRBUILD}/build.log
msg_info "GENERATE DOCKER IMAGE"
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t "${IMAGEDOCKER}" \
--file "${basedir}/Dockerfile" || exit 2
fi
if [[ $BUILD -ne 0 ]]
then
msg_info "BUILD"
cd $rootdir; docker run -it \
--hostname=builder \
-u "$(id -u $USERNAME):$(id -g $USERNAME)" \
-v ${rootdir}/builder:/opt/builder:ro \
-v ${codesource}/code:/opt/code:ro \
-v ${rootdir}/build:/opt/build \
-v /etc/localtime:/etc/localtime:ro \
${DOCKEROPTS} \
${IMAGEDOCKER} \
/opt/builder/${LOCALSRC}/build-under-docker.sh "/opt/${LOCALBUILDDIR}" || exit 2
fi
if [[ $PACKAGE -ne 0 ]]
then
msg_info "COPY PACKAGES"
mkdir -p "$rootdir/$DIRPACKAGE"
cd ${rootdir}; tar czf ${PACKAGEREF} \
${codesource}/code/ryzom/server/shard.screen.rc \
${codesource}/code/ryzom/common/* \
${codesource}/code/ryzom/client/* \
${codesource}/code/ryzom/server/* \
${codesource}/code/web/* || exit 2
cp ${rootdir}/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz ${PACKAGEBIN} || exit 2
fi
if [[ $CLEANDOCKER -ne 0 ]]
then
msg_info "CLEAN CONTAINER"
docker rm --force `docker ps -qf 'status=exited' -f "ancestor=${IMAGEDOCKER}"` || exit 2
fi
if [[ $CLEANIMAGENONE -ne 0 ]]
then
msg_info "CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]]
then
docker rmi --force "${listimages[@]}" || exit 2
fi
fi
trap '' EXIT
msg_info "END"

View file

@ -32,76 +32,69 @@ ENV HOSTNAME builder
RUN apt-get update ; \
apt-get dist-upgrade -y; \
DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server ; \
apt-get install -y apache2 \
php \
libapache2-mod-php \
php-mysql \
apache2-utils \
php-gd \
php-imagick ; \
apt-get install -y git \
libcurl4-openssl-dev \
libluabind-dev \
libfreetype6-dev \
libx11-dev \
libgl1-mesa-dev \
libxxf86vm-dev \
libxrandr-dev \
libxrender-dev \
libopenal-dev \
libogg-dev \
libvorbis-dev \
libxml2-dev \
cmake \
build-essential \
libpng-dev \
libjpeg62-turbo-dev \
rrdtool \
bison \
libxmu-dev \
autoconf \
automake \
default-libmysqlclient-dev \
libgif-dev \
cpputest \
libssl-dev \
liblzma-dev \
unzip \
zlib1g-dev \
libssh2-1-dev \
libboost-all-dev \
libopenal-dev \
libgl1-mesa-dev \
libogg-dev \
mercurial \
wget \
autogen \
libtool \
libtool-bin
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
RUN mkdir -p /opt/src
RUN mkdir -p /opt/src/cpptest
RUN wget -q https://github.com/cpptest/cpptest/archive/1.0.5.tar.gz -O /opt/src/cpptest.tar.gz || exit 2
RUN rm -rf /opt/src/cpptest
RUN tar xvf /opt/src/cpptest.tar.gz -C /opt/src --strip 1 || exit 2
RUN tar xf /opt/src/cpptest.tar.gz -C /opt/src --strip 1 || exit 2
RUN cd /opt/src/cpptest && ./autogen.sh && ./configure && make && make install || exit 2
# Build debug & install (cpptestd)
RUN cd /opt/src/cpptest && make clean && CXXFLAGS="-g -O0" ./configure && make && for file in src/.libs/lib*.so* src/.libs/lib*.a;do extension=${file##*/libcpptest} ; cp -L $file /usr/local/lib/libcpptestd${extension}; done
## Build & Install squish
RUN mkdir -p /opt/src
RUN cd /opt/src; wget -c https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/libsquish/squish-1.11.zip
RUN cd /opt/src; unzip squish-1.11.zip
COPY dist/docker/builder/common/squish-limit.patch /opt/squish-limit.patch
COPY common/squish-limit.patch /opt/squish-limit.patch
RUN cd /opt/src/squish-1.11; patch -i /opt/squish-limit.patch || exit 2
RUN cd /opt/src/squish-1.11; make || exit 2
RUN cd /opt/src/squish-1.11; make install || exit 2
## Build & Install CURL - 7.46.0
RUN wget -q https://curl.haxx.se/download/curl-7.55.1.tar.gz -O /opt/src/curl.tar.gz
## Build & Install CURL - 7.58.0
RUN wget -q https://curl.haxx.se/download/curl-7.58.0.tar.gz -O /opt/src/curl.tar.gz
RUN mkdir -p /opt/src/curl/build
RUN tar xvf /opt/src/curl.tar.gz -C /opt/src/curl --strip 1 || exit 2
RUN cd /opt/src/curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.a .. || exit 2
RUN tar xf /opt/src/curl.tar.gz -C /opt/src/curl --strip 1 || exit 2
RUN cd /opt/src/curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/x86_64-linux-gnu/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/x86_64-linux-gnu/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.a -DCMAKE_C_FLAGS='-fPIC' .. || exit 2
RUN cd /opt/src/curl/build; make || exit 2
RUN cd /opt/src/curl/build; make install || exit 2
## Build & Install luabind
RUN mkdir -p /opt/src/luabind
RUN wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg.orig.tar.gz -O /opt/src/luabind.tar.gz
RUN wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg-11.debian.tar.xz -O /opt/src/luabind-debian.tar.xz
RUN tar xf /opt/src/luabind.tar.gz -C /opt/src/luabind --strip 1 || exit 2
RUN tar xf /opt/src/luabind-debian.tar.xz -C /opt/src/luabind || exit 2
RUN cd /opt/src/luabind; for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file || exit 2; done
RUN cd /opt/src/luabind; DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH) bjam -d2 release debug install cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)"
RUN cd /opt/src/luabind; DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH) bjam -d2 release debug install link=static cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)"
# Build libogg
RUN mkdir -p /opt/src/libogg/build
RUN wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2.orig.tar.gz -O /opt/src/libogg.tar.gz
RUN wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2-1.diff.gz -O /opt/src/libogg.diff.gz
RUN tar xvf /opt/src/libogg.tar.gz -C /opt/src/libogg --strip 1 || exit 2
RUN gunzip /opt/src/libogg.diff.gz
RUN cd /opt/src/libogg/; patch -p1 < /opt/src/libogg.diff
RUN cd /opt/src/libogg/build; /opt/src/libogg/configure --disable-maintainer-mode --host=$(dpkg-architecture -qDEB_HOST_GNU_TYPE) --build=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) --libdir=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH) --enable-static --prefix=/usr CPPFLAGS="-D_FORTIFY_SOURCE=2" CFLAGS="-Wformat=2 -g -fPIC" CXXFLAGS="-Wformat=2 -g -fPIC" LDFLAGS="-Wl,-z,now"
RUN cd /opt/src/libogg/build; make
RUN cd /opt/src/libogg/build; make install
# Build libvorbis
RUN mkdir -p /opt/src/libvorbis
RUN wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/libvorbis_1.3.5.orig.tar.gz -O /opt/src/libvorbis.tar.gz
RUN tar xvf /opt/src/libvorbis.tar.gz -C /opt/src/libvorbis --strip 1 || exit 2
RUN wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis -O /opt/src/libvorbis/list_libvorbis
RUN line=$(egrep '(libvorbis_1.3.5)(.*)(tar[.]xz)' /opt/src/libvorbis/list_libvorbis | tail -n 1) ; tmp=${line#*href} ; tmp2=${tmp%%>*} ; tmp3=${tmp2#*\"} ; namepatch=${tmp3%\"*} ; wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/$namepatch -O /opt/src/libvorbis/libvorbis.debian.tar.xz
RUN tar xvf /opt/src/libvorbis/libvorbis.debian.tar.xz -C /opt/src/libvorbis || exit 2
RUN cd /opt/src/libvorbis/; for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file || exit 2; done
RUN cd /opt/src/libvorbis/; ./configure --enable-static --with-pic
RUN cd /opt/src/libvorbis/; make
RUN cd /opt/src/libvorbis/; make install
# Create directory
RUN mkdir -p /opt/ref ; chmod 777 /opt/ref
RUN ldconfig

View file

@ -18,37 +18,189 @@
#
declare DIRBUILD="/opt/build/"
if [[ -n "$1" ]]
then
DIRBUILD="$1"
fi
declare LOGFILE="${DIRBUILD}/build.log"
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()
{
cat << EOF
usage:$0 [options] <workdir>
internal script to build under docker
workdir: directory use to buid
options:
-h, --help : Show this help
-d, --debug : Show debug message
--add-opts-cmake="string" : add option use on command cmake (generate Makefile)
--add-opts-make="string" : add option use on command make
--cxxflags=[String] : adding cxx flags when generate Makefile (and build)
--dont-copy-source : disable copy source, work directly on source (apply patch)
EOF
}
function chrashed()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - BUILD FAILED (code:$?)" >> $LOGFILE
local code=$?
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - BUILD (under docker) FAILED (code:$code)"
if [ -n "$LOGFILE" ]
then
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - BUILD (under docker) FAILED (code:$code)" >> $LOGFILE
fi
exit 2
}
function msg_error()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - $1"
if [ -n "$LOGFILE" ]
then
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - $1" >> $LOGFILE
fi
}
function msg_info()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $1"
if [ -n "$LOGFILE" ]
then
echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $1" >> $LOGFILE
fi
}
function msg_debug()
{
if [[ $DEBUG -ne 0 ]]
then
echo "$(date "+%Y/%m/%d %H:%M:%S") DEBUG - $1"
if [ -n "$LOGFILE" ]
then
echo "$(date "+%Y/%m/%d %H:%M:%S") DEBUG - $1" >> $LOGFILE
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
#
trap chrashed EXIT
while test $# -gt 0
do
case "$1" in
-h|--help)
usage
exit 1
;;
-d|--debug)
DEBUG=1
shift
;;
--add-opts-cmake=*)
CMAKEOPTS="$CMAKEOPTS ${1#*=}"
shift
;;
--add-opts-make=*)
MAKEOPTS="$MAKEOPTS ${1#*=}"
shift
;;
--build-dir=*)
DIRBUILD="${1#*=}"
shift
;;
--code-dir=*)
DIRCODE="${1#*=}"
shift
;;
--opennel-pymanager-dir=*)
DIRPYMANAGER="${1#*=}"
shift
;;
--cxxflags=*)
CXXFLAGS="$CXXFLAGS ${1#*=}"
shift
;;
--dont-copy-source)
DONTCOPYSOURCE=1
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
exit 2
;;
esac
done
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"
msg_debug "CXXFLAGS:$CXXFLAGS"
msg_debug "DONTCOPYSOURCE:$DONTCOPYSOURCE"
msg_info "CREATE BUILD DIRECTORY"
mkdir -p ${DIRBUILD}/ || exit 2
if [[ -f ${DIRBUILD}/envi.sh ]]
if [[ $PACKAGE_OPENNEL_PYMANAGER -ne 0 ]]
then
msg_info "LOAD ENVIRONMENT"
source ${DIRBUILD}/envi.sh
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
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 "PATCH CODE"
for patchfile in $(cat ${DIRCODE}/patch/series)
do
cd ${DIRCODEUSE}
patch_onlyifnotapply ${DIRCODE}/patch/$patchfile || exit 2
done
msg_info "PREPARE BUILD"
cd ${DIRBUILD}; cmake -DWITH_NEL=ON \
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 \
@ -57,13 +209,12 @@ cd ${DIRBUILD}; cmake -DWITH_NEL=ON \
-DWITH_RYZOM_PATCH=ON \
-DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON \
${CMAKEOPTS} \
../../code 1>>$LOGFILE 2>&1 || exit 2
${DIRCODEUSE}/code 1>>$LOGFILE 2>&1 || exit 2
msg_info "BUILD START"
cd ${DIRBUILD}; make $MAKEOPTS 1>>$LOGFILE 2>&1 || exit 2
msg_info "GENERATE PACKAGE"
cd ${DIRBUILD}; make package 1>>$LOGFILE 2>&1 || exit 2
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

@ -22,7 +22,7 @@ declare -i REMOVE=0
declare -i IMAGE=0
declare -i BUILD=1
declare -i DEBUG=0
declare JOBS=""
declare MAKEOPTS=""
declare CMAKEOPTS=""
declare DOCKEROPTS=""
declare DIRBUILD=""
@ -30,11 +30,13 @@ declare CLEANDOCKER=0
declare -i CLEANIMAGENONE=0
declare -i AUTODETEC=1
declare DOCKERBUILDOPT=""
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 LOCALSRC="debian/stretch/x86_64"
declare DIRPACKAGE="output/khanat_debian_stretch_x86_64/package"
declare DIRPACKAGE="output/opennel_debian_stretch_x86_64/package"
declare PACKAGEBIN="$DIRPACKAGE/ryzomcore_stretch_x86_64.tar.gz"
declare PACKAGEREF="$DIRPACKAGE/khanat-ref-ressources.tar.gz"
@ -58,15 +60,23 @@ options:
-f, --force-create-image : force to create docker image (use to build khanat) - default autodetec.
-j [N], --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
-a OPTS, --add-opts-cmake=OPTS : Adding options on cmake command (before build)
-n OPTS, --add-opts-make=OPTS : Adding options on make command (build option)
--cxxflags=[String] : adding cxx flags when generate Makefile (and build)
-c, --clean-container : remove all container in state Exited
-w, --clean-images-none : Remove images docker (with name 'none')
-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 :
cd [root Khanat directory]
./build.sh -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 -m '-m 20g'
$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
}
@ -95,7 +105,9 @@ function msg_error()
calldir="$(dirname $0)"
basedir=$(cd $calldir; pwd)
rootdir="$(dirname $(dirname $(dirname $(dirname $(dirname $(dirname ${basedir}))))))"
rootdir="$(dirname $(dirname $(dirname $(dirname ${basedir}))))"
codedir="$(dirname $rootdir)/khanat-opennel-code"
pymanagerdir="$(dirname $rootdir)/opennel-pymanager"
while test $# -gt 0
do
@ -106,6 +118,7 @@ do
;;
-d|--debug)
DEBUG=1
OPTION="$OPTION -d"
shift
;;
-c|--clean-container)
@ -126,18 +139,18 @@ do
# search next argument is value or new argument
if [[ ${1:0:1} == "-" ]]
then
JOBS="-j"
MAKEOPTS="$MAKEOPTS -j"
else
JOBS="-j $1"
MAKEOPTS="$MAKEOPTS -j $1"
shift
fi
;;
--jobs*)
if [[ ${1#*=} == "" ]]
then
JOBS="-j"
MAKEOPTS="$MAKEOPTS -j"
else
JOBS="-j ${1#*=}"
MAKEOPTS="$MAKEOPTS -j ${1#*=}"
fi
shift
;;
@ -150,6 +163,15 @@ do
CMAKEOPTS="$CMAKEOPTS ${1#*=}"
shift
;;
-n)
shift
MAKEOPTS="$MAKEOPTS $1"
shift
;;
--add-opts-make=*)
MAKEOPTS="$MAKEOPTS ${1#*=}"
shift
;;
-m)
shift
DOCKEROPTS="$DOCKEROPTS $1"
@ -159,14 +181,39 @@ do
DOCKEROPTS="$DOCKEROPTS ${1#*=}"
shift
;;
--cxxflags=*)
OPTION="$OPTION --cxxflags=${1#*=}"
shift
;;
--only-build-server)
CMAKEOPTS="$CMAKEOPTS -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_CLIENT=OFF -DWITH_DRIVER_OPENGL=OFF -DWITH_DRIVER_OPENAL=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_SOUND=OFF"
shift
;;
--opennel-code-dir=*)
codedir="${1#*=}"
shift
;;
--opennel-pymanager-dir=*)
pymanagerdir="${1#*=}"
shift
;;
-w|--clean-images-none)
CLEANIMAGENONE=1
shift
;;
--dont-copy-source)
DONTCOPYSOURCE=1
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
@ -202,12 +249,29 @@ fi
DIRBUILD="${rootdir}/${LOCALBUILDDIR}"
msg_debug "calldir: $calldir"
msg_debug "basedir: $basedir"
msg_debug "rootdir: $rootdir"
msg_debug "JOBS: '$JOBS'"
msg_debug "CMAKEOPTS: '$CMAKEOPTS'"
msg_debug "DOCKEROPTS: '$DOCKEROPTS'"
msg_debug "[$(basename $0):$LINENO] calldir: $calldir"
msg_debug "[$(basename $0):$LINENO] basedir: $basedir"
msg_debug "[$(basename $0):$LINENO] rootdir: $rootdir"
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"
if [[ ! -d ${codedir} ]]
then
msg_error "[$(basename $0):$LINENO] Missing directory khanat-opennel-code [${codedir}]"
cat << EOF
You need clone repo khanat-opennel-code.
cd $(dirname ${rootdir})
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-opennel-code.git
EOF
exit 2
fi
mkdir -p "${DIRBUILD}"
if [[ $REMOVE -ne 0 ]]
@ -220,43 +284,43 @@ touch ${DIRBUILD}/build.log
cat << EOF > ${DIRBUILD}/envi.sh
#!/bin/bash
export MAKEOPTS="$JOBS"
export MAKEOPTS="$MAKEOPTS"
export CMAKEOPTS="$CMAKEOPTS"
EOF
if [[ $IMAGE -ne 0 ]]
then
msg_info "GENERATE DOCKER IMAGE"
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEDOCKER} \
msg_debug "cd $projectdir/builder; docker build . ${DOCKERBUILDOPT} -t ${IMAGEDOCKER} --file \"${basedir}/Dockerfile\""
cd $rootdir/builder; docker build . ${DOCKERBUILDOPT} -t ${IMAGEDOCKER} \
--file "${basedir}/Dockerfile" || exit 2
fi
if [[ $BUILD -ne 0 ]]
then
msg_info "BUILD"
cd $rootdir; docker run -it \
msg_debug "cd $rootdir; docker run -it \
--hostname=builder \
-u "$(id -u $USERNAME):$(id -g $USERNAME)" \
-v $rootdir/dist:/opt/dist:ro \
-v $rootdir/code:/opt/code:ro \
-v $rootdir/builder:/opt/ref/builder: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} \
${IMAGEDOCKER} \
/opt/dist/docker/builder/${LOCALSRC}/build-under-docker.sh "/opt/${LOCALBUILDDIR}" || exit 2
fi
if [[ $BUILD -ne 0 ]]
then
msg_info "COPY PACKAGES"
mkdir -p "$rootdir/$DIRPACKAGE"
cd ${rootdir}; tar czf ${PACKAGEREF} \
code/ryzom/server/shard.screen.rc \
code/ryzom/common/* \
code/ryzom/client/* \
code/ryzom/server/* \
code/web/* || exit 2
cp ${rootdir}/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz ${PACKAGEBIN} || 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"
cd $rootdir; docker run -it \
--hostname=builder \
-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" --opennel-pymanager-dir="/opt/ref/opennel-pymanager" $OPTION || exit 2
fi
if [[ $CLEANDOCKER -ne 0 ]]

View file

@ -0,0 +1,98 @@
#!/bin/bash
# Script to download artefact
#
# Copyright (C) 2017 AleaJactaEst
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# define project & branch
usage()
{
cat << EOF
usage:$0 url path project branch [branch]
url : define url gitlab (ex.: "https://git.khaganat.net")
path : define path you can access on your project (Ex.: "khaganat")
project : project name (ex.: "mmorpg_khanat/khanat-opennel-code")
branch : define branch (ex. "develop")
you can define other branch (script check 1st, 2nd, ... to find branch with success build)
EOF
exit 2
}
if [[ -z "$1" ]]
then
echo "*** ERROR : missing 1st argument (url root 'https://yoursite')" >&2
usage
fi
if [[ -z "$2" ]]
then
echo "*** ERROR : missing 2nd argument (path project)" >&2
usage
fi
if [[ -z "$3" ]]
then
echo "*** ERROR : missing 3th argument (project - define in url)" >&2
usage
fi
if [[ -z "$4" ]]
then
echo "*** ERROR : missing 4rd argument (branch)" >&2
usage
fi
# urlroot like "https://git.khaganat.net"
urlroot=$1
shift
# urlpath like "khaganat"
urlpath=$1
shift
# project like "mmorpg_khanat/khanat-opennel-code"
project=$1
shift
declare tempfile="/tmp/download_artefacts.$$"
# Get list build
wget -q -O $tempfile.json "$urlroot/$urlpath/"$project"/pipelines.json?scope=all&page=1"
# GET LAST ID
lastid=0
while [[ $lastid -eq 0 ]]
do
# get param branch (like "develop")
branch=$1
shift
echo "Search artefact on $branch"
lastid=$(jq -r '.pipelines[] | select (.details.status.group | contains("success")) | select ( .path | contains("'$project'")) | select ( .ref.name == "'$branch'") | .id as $ident | $ident ' $tempfile.json | awk 'BEGIN{ID=0;}{if($1 > ID) ID=$1;}END{print ID;}')
done
echo "Get artefacts from $branch #$lastid"
# Get end URL artefact for specific ID
jq -r '.pipelines[] | select ( .id == '$lastid' ) | .details.artifacts[] as $detail | [ {artifacts_path: $detail.path} ] | (.[0] | keys_unsorted) as $keys | ([$keys] + map([.[ $keys[] ]])) [1] | @tsv' $tempfile.json > $tempfile.tsv
# Download artefact
while read -r line
do
wget -q --content-disposition "$urlroot$line"
done < $tempfile.tsv
rm $tempfile.*
echo "END"

View file

@ -0,0 +1,140 @@
<!DOCTYPE html>
<html>
<head>
<title>Test 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>
<a>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)</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
<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>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)
{
if ( $key == "first-line" or $key == "last-line" )
continue;
// 2018/08/03 10:45:36 CEST INF 442b0740 command.cpp 149
list($date, $hour, $timezone, $typesrc, $addr, $program, $line, $msg) = explode(' ', $value, 8);
$type = substr( $typesrc, strlen($typesrc) - 3 );
if ( $type == 'INF' ) { // Information
$fond = "bgcolor=\"SpringGreen \"";
} else if ( $type == 'DBG') { // Information
$fond = "bgcolor=\"AQUAMARINE\"";
} else if ( $type == 'WRN') { // Warning
$fond = "bgcolor=\"Yellow\"";
} else if ( $type == 'ERR') { // Error
$fond = "bgcolor=\"Tomato\"";
} else if ( $type == 'STT') { // Statistic
$fond = "bgcolor=\"Yellow\"";
} else if ( $type == 'AST') { // Assert
$fond = "bgcolor=\"Tomato\"";
} else if ( $type == 'UKN') { // Unknown
$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

@ -0,0 +1,22 @@
#!/bin/bash
# Script to download khanat docker package
mkdir -p $HOME/Public
ipaddress="<?php print getHostByName(gethostname());?>"
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"
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

@ -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,17 +61,17 @@ 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
command = ryzom_backup_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid -P49990
# Path : where this program is launched
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
# command = ryzom_backup_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid -P49992
# # Path : where this program is launched
# path = /home/gameserver/khanat/server/
# # size buffer log for each program launched (number line stdout)
@ -78,20 +80,20 @@ 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
command = ryzom_entities_game_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# Path : where this program is launched
path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)
logsize = 1000
logsize = 3000
##############################
# 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
command = ryzom_gpm_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# Path : where this program is launched
path = /home/gameserver/khanat/server/gpms
# size buffer log for each program launched (number line stdout)
@ -100,9 +102,9 @@ 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
command = ryzom_ios_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# Path : where this program is launched
path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)
@ -111,9 +113,9 @@ 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
command = ryzom_naming_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# Path : where this program is launched
path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)
@ -122,9 +124,9 @@ 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
command = ryzom_welcome_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# Path : where this program is launched
path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)
@ -133,9 +135,9 @@ 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
command = ryzom_tick_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# Path : where this program is launched
path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)
@ -144,9 +146,9 @@ 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
command = ryzom_mirror_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# Path : where this program is launched
path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)
@ -155,9 +157,9 @@ 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
command = ryzom_ai_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid -mCommon:Newbieland:Post
# Path : where this program is launched
path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)
@ -166,9 +168,9 @@ 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
command = ryzom_mail_forum_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# Path : where this program is launched
path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)
@ -177,9 +179,9 @@ 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
command = ryzom_shard_unifier_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# Path : where this program is launched
path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)
@ -188,9 +190,9 @@ 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
command = ryzom_frontend_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# Path : where this program is launched
path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)
@ -199,9 +201,9 @@ 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
command = ryzom_session_browser_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# Path : where this program is launched
path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)
@ -210,25 +212,25 @@ 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
command = ryzom_logger_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# Path : where this program is launched
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
# command = ryzom_monitor_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# # Path : where this program is launched
# path = /home/gameserver/khanat/server/
# # 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
# command = ryzom_pd_support_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# # Path : where this program is launched
# path = /home/gameserver/khanat/server/
# # size buffer log for each program launched (number line stdout)
@ -237,9 +239,9 @@ 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
command = ryzom_admin_service --fulladminname=admin_service --shortadminname=AS -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat/ --nobreak --writepid
# Path : where this program is launched
path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)

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
chown_gameserver '/home/gameserver/log/apache2/other_vhosts_access.log' || exit 2
#####################
# Start & Stop apache2
#####################

View file

@ -20,7 +20,7 @@
/opt/ext/servercontainer_configure_mysql.sh || exit 2
sync
/opt/ext/servercontainer_configure_apache.sh || exit 2
/opt/ext/servercontainer_configure_world.sh || exit 2
/opt/ext/servercontainer_configure_world.sh -d || exit 2
su -c '/opt/ext/servercontainer_configure_khanat.sh' gameserver || exit 2
su -c '/opt/ext/servercontainer_configure_patch.sh' gameserver || exit 2
su -c '/opt/ext/servercontainer_configure_launcher.sh' gameserver || exit 2

View file

@ -139,12 +139,19 @@ for var in $KHANAT_PATH/server/translation/translated/*_wk.txt; do nomfic=${var#
msg_debug "[$(basename $0):$LINENO] screen configuration"
# Copy default screen configuration
cp $KHANAT_HOME/ext/ryzom-ressources/server/shard.screen.rc $KHANAT_PATH/server/shard.screen.rc || msg_critical "copy issue (file:shard.screen.rc)"
sed -i -r 's/\$RYZOM_PATH\/\.\.\/build\/bin\///g' $KHANAT_PATH/server/shard.screen.rc || msg_critical "replace param issue (file:shard.screen.rc, RYZOM_PATH)"
sed -i -r 's/[-]A[.]/ /g' $KHANAT_PATH/server/shard.screen.rc || msg_critical "replace param issue (file:shard.screen.rc, param -A)"
sed -i -r 's/[-]C[.]/ -A\/home\/gameserver\/khanat\/server -C\/home\/gameserver\/khanat\/server /g' $KHANAT_PATH/server/shard.screen.rc || msg_critical "replace param issue (file:shard.screen.rc, param -C)"
sed -i -r 's/[-]L[.]/ -L\/home\/gameserver\/log\/khanat /g' $KHANAT_PATH/server/shard.screen.rc || msg_critical "replace param issue (file:shard.screen.rc, param -L)"
sed -i -r 's/[.][.]\/tools\/scripts\/linux\//\/home\/gameserver\/khanat\/tools\/scripts\/linux\//g' $KHANAT_PATH/server/shard.screen.rc || msg_critical "replace param issue (file:shard.screen.rc, tools/script/linux)"
sed -i -r 's/chdir \$RYZOM_PATH\/server/chdir \$RYZOM_PATH\/server\\\nscreen -t terminal \/bin\/bash -l/g' $KHANAT_PATH/server/shard.screen.rc || msg_critical "replace param issue (file:shard.screen.rc, tools/script/linux)"
####################################
# End
####################################

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

@ -77,11 +77,11 @@ source /home/gameserver/.bashrc
msg_debug "create directory target"
create_dir_gameserver "$KHANAT_PATH" || exit 2
create_dir_gameserver "$KHANAT_PATH/server" || exit 2
create_dir_gameserver "$KHANAT_PATH/server/collisions" || exit 2
#create_dir_gameserver "$KHANAT_PATH/server/collisions" || exit 2
create_dir_gameserver "$KHANAT_PATH/server/leveldesign" || exit 2
create_dir_gameserver "$KHANAT_PATH/server/primitives" || exit 2
#create_dir_gameserver "$KHANAT_PATH/server/primitives" || exit 2
create_dir_gameserver "$KHANAT_PATH/server/translation" || exit 2
create_dir_gameserver "$KHANAT_PATH/server/continents" || exit 2
#create_dir_gameserver "$KHANAT_PATH/server/continents" || exit 2
create_dir_gameserver "$KHANAT_PATH/server/common" || exit 2
create_dir_gameserver "$KHANAT_PATH/server/data_shard" || exit 2
create_dir_gameserver "$KHANAT_PATH/server/sound" || exit 2
@ -140,11 +140,11 @@ create_recursive_link '/home/gameserver/ext/khanat-ressources/leveldesign' "$KHA
#create_recursive_link '/home/gameserver/ext/khanat-ressources/primitives' "$KHANAT_PATH/server/primitives" || exit 2
create_recursive_link '/home/gameserver/ext/khanat-ressources/translation' "$KHANAT_PATH/server/translation" || exit 2
#create_recursive_link '/home/gameserver/ext/khanat-ressources/continents' "$KHANAT_PATH/server/continents" || exit 2
create_link '/home/gameserver/ext/khanat-ressources/collisions' "$KHANAT_PATH/server/collisions" || exit 2
create_link '/home/gameserver/ext/khanat-ressources/collisions' "$KHANAT_PATH/server" || exit 2
#create_link '/home/gameserver/ext/khanat-ressources/leveldesign' "$KHANAT_PATH/server/leveldesign" || exit 2
create_link '/home/gameserver/ext/khanat-ressources/primitives' "$KHANAT_PATH/server/primitives" || exit 2
create_link '/home/gameserver/ext/khanat-ressources/primitives' "$KHANAT_PATH/server" || exit 2
#create_link '/home/gameserver/ext/khanat-ressources/translation' "$KHANAT_PATH/server/translation" || exit 2
create_link '/home/gameserver/ext/khanat-ressources/continents' "$KHANAT_PATH/server/continents" || exit 2
create_link '/home/gameserver/ext/khanat-ressources/continents' "$KHANAT_PATH/server" || exit 2
create_recursive_link '/home/gameserver/ext/khanat-ressources/common' "$KHANAT_PATH/server/common" || exit 2
#create_link_2nd_level "/home/gameserver/ext/khanat-ressources/common/*" "$KHANAT_PATH/server/common/" || exit 2
@ -156,7 +156,6 @@ create_link '/home/gameserver/ext/khanat-ressources/shard/egs/game_event.txt' "$
create_link '/home/gameserver/ext/khanat-ressources/shard/egs/mission_queues.txt' "$KHANAT_PATH/server/data_shard" || exit 2
create_link '/home/gameserver/ext/khanat-ressources/shard/egs/named_items.txt' "$KHANAT_PATH/server/data_shard" || exit 2
####################################
# Link configuration
####################################
@ -176,10 +175,10 @@ create_dir_gameserver "$KHANAT_PATH/tools/scripts" || exit 2
create_dir_gameserver "$KHANAT_PATH/tools/scripts/linux" || exit 2
create_recursive_link '/home/gameserver/ext/ryzom-ressources/tools/scripts/linux' "$KHANAT_PATH/tools/scripts/linux" || exit 2
####################################
# Link tools khaganat
####################################
msg_debug "[$(basename $0):$LINENO] Link tools khaganat"
create_link '/opt/ext/khaganat.cfg' "$KHANAT_PATH"
####################################

View file

@ -125,7 +125,13 @@ sleep 1
msg_debug "configure password root for database"
/usr/bin/mysqladmin -u root password '' || exit 2
if [ $(get_debian_version) -lt 9 ]
then
mysql -u root -e "GRANT ALL PRIVILEGES on *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '"$(awk '{if($1 == "password"){print $3;exit 0}}' /etc/mysql/debian.cnf)"' WITH GRANT OPTION; FLUSH PRIVILEGES;" || exit 2
else
msg_debug "nothing"
#mysql -u root -e "GRANT ALL PRIVILEGES on *.* TO 'debian-sys-maint'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES;"
fi
####################################
# Stop Database

View file

@ -50,6 +50,10 @@ do
set_debug 1
shift
;;
--client-dir=*)
DIRCLIENT="${1#*=}"
shift
;;
*)
msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage
@ -237,6 +241,11 @@ wait_all_job || exit 2
####################################
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;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

View file

@ -30,24 +30,6 @@ options:
EOF
}
function msg_debug()
{
if [[ $DEBUG -ne 0 ]]
then
echo "$(date "+%Y/%m/%d %H:%M:%S") DEBUG - $*"
fi
}
function msg_info()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $*"
}
function msg_error()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - $*" >&2
}
#####################
# MAIN
#####################
@ -79,15 +61,13 @@ done
msg_debug "[$(basename $0):$LINENO] Load environment"
if [[ ! -f /opt/khanat_config.sh ]]
then
echo "ERROR [$(basename $0):$LINENO] missing /opt/khanat_config.sh"
exit 2
msg_critical "[$(basename $0):$LINENO] missing /opt/khanat_config.sh"
fi
source /opt/khanat_config.sh
if [[ ! -f /home/gameserver/.bashrc ]]
then
msg_error "[$(basename $0):$LINENO] Missing /home/gameserver/.bashrc"
exit 2
msg_critical "[$(basename $0):$LINENO] Missing /home/gameserver/.bashrc"
fi
source /home/gameserver/.bashrc
@ -111,7 +91,7 @@ echo ""
sleep 1
msg_debug "start apache"
sudo service apache2 start || exit 2
sudo service apache2 start || msg_critical "[$(basename $0):$LINENO] Impossible to start apache"
####################################
@ -119,15 +99,16 @@ sudo service apache2 start || exit 2
####################################
msg_debug "[$(basename $0):$LINENO] Create account"
# Create account shard on MySQL
mysql -u root -e "CREATE USER 'shard'@'localhost' IDENTIFIED BY '';" || exit 2
mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'shard'@'localhost' WITH GRANT OPTION;" || exit 2
mysql -u root -e "CREATE USER IF NOT EXISTS 'shard'@'localhost' IDENTIFIED BY '';" || msg_critical "[$(basename $0):$LINENO] create use impossible"
mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'shard'@'localhost' WITH GRANT OPTION;" || msg_critical "[$(basename $0):$LINENO] update privileges impossible"
####################################
# launch web configuration for khanat
####################################
## TODO : check if database is installed before launch this command
msg_debug "[$(basename $0):$LINENO] launch web configuration for khanat"
curl 'http://localhost:40916/setup/install.php' \
httpcode=$(curl -L -w "%{http_code}" 'http://localhost:40916/setup/install.php' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
-H 'Accept-Language: en-US' \
-H 'Connection: keep-alive' \
@ -160,12 +141,17 @@ curl 'http://localhost:40916/setup/install.php' \
'&nelDomainName=Lirria'\
'&domainDatabase=ring_mini01'\
'&submit=Configure' \
-o $KHANAT_HOME/log/configure/world_setup.html || exit 2
-o $KHANAT_HOME/log/configure/world_setup.html || msg_critical "[$(basename $0):$LINENO] curl error (impossible to create world)")
if [[ $httpcode != "200" ]]
then
msg_critical "[$(basename $0):$LINENO] impossible to create world (http return:$httpcode)"
fi
chown_gameserver $KHANAT_HOME/log/configure/world_setup.html
# Check account is create
grep "Domain role successfully installed" $KHANAT_HOME/log/configure/world_setup.html >/dev/null || exit 2
grep "Domain role successfully installed" $KHANAT_HOME/log/configure/world_setup.html >/dev/null || msg_critical "[$(basename $0):$LINENO] Missing message 'Domain role successfully installed'"
####################################
@ -181,7 +167,7 @@ export addressip=${tmp//[[:blank:]]/}
####################################
msg_debug "[$(basename $0):$LINENO] Configure Domain"
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', '$KHANAT_CLIENT_VERSION', '$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);" || msg_critical "[$(basename $0):$LINENO] MYSQL - Configure Domain"
####################################
@ -189,14 +175,14 @@ INSERT INTO nel.domain (domain_id, domain_name, status, patch_version, backup_pa
####################################
msg_debug "[$(basename $0):$LINENO] Configure nel.shard"
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
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', '');" || msg_critical "[$(basename $0):$LINENO] MYSQL - Configure nel.shard"
####################################
# Configure nel_tool.neltool_domains
####################################
msg_debug "[$(basename $0):$LINENO] Configure nel_tool.neltool_domains"
mysql -u root -e "use nel;
INSERT INTO nel_tool.neltool_domains (domain_id, domain_name, domain_as_host, domain_as_port, domain_rrd_path, domain_las_admin_path, domain_las_local_path, domain_application, domain_sql_string, domain_hd_check, domain_mfs_web, domain_cs_sql_string) VALUES ('12', 'Lirria', '$addressip', '46700', '/home/gameserver/khanat/server/save_shard/rrd_graphs', '', '', 'ryzom_open', '', '0', NULL, NULL);" || exit 2
INSERT INTO nel_tool.neltool_domains (domain_id, domain_name, domain_as_host, domain_as_port, domain_rrd_path, domain_las_admin_path, domain_las_local_path, domain_application, domain_sql_string, domain_hd_check, domain_mfs_web, domain_cs_sql_string) VALUES ('12', 'Lirria', '$addressip', '46700', '/home/gameserver/khanat/server/save_shard/rrd_graphs', '', '', 'ryzom_open', '', '0', NULL, NULL);" || msg_critical "[$(basename $0):$LINENO] MYSQL - Configure nel_tool.neltool_domains"
####################################
@ -204,7 +190,7 @@ INSERT INTO nel_tool.neltool_domains (domain_id, domain_name, domain_as_host, do
####################################
msg_debug "[$(basename $0):$LINENO] Configure nel_tool.neltool_shards"
mysql -u root -e "use nel;
INSERT INTO nel_tool.neltool_shards (shard_id, shard_name, shard_as_id, shard_domain_id, shard_lang, shard_restart) VALUES ('302', 'open', 'open', '12', 'fr', '0');" || exit 2
INSERT INTO nel_tool.neltool_shards (shard_id, shard_name, shard_as_id, shard_domain_id, shard_lang, shard_restart) VALUES ('302', 'open', 'open', '12', 'fr', '0');" || msg_critical "[$(basename $0):$LINENO] MYSQL - Configure nel_tool.neltool_shards"
####################################
@ -212,7 +198,7 @@ INSERT INTO nel_tool.neltool_shards (shard_id, shard_name, shard_as_id, shard_do
####################################
msg_debug "[$(basename $0):$LINENO] Configure nel_tool.neltool_user_domains"
mysql -u root -e "use nel;
INSERT INTO nel_tool.neltool_user_domains (user_domain_id, user_domain_user_id, user_domain_domain_id) VALUES ('1', '1', '12');" || exit 2
INSERT INTO nel_tool.neltool_user_domains (user_domain_id, user_domain_user_id, user_domain_domain_id) VALUES ('1', '1', '12');" || msg_critical "[$(basename $0):$LINENO] MYSQL - Configure nel_tool.neltool_user_domains"
####################################
@ -220,7 +206,7 @@ INSERT INTO nel_tool.neltool_user_domains (user_domain_id, user_domain_user_id,
####################################
msg_debug "[$(basename $0):$LINENO] Configure nel_tool.neltool_user_shards"
mysql -u root -e "use nel;
INSERT INTO nel_tool.neltool_user_shards (user_shard_id, user_shard_user_id, user_shard_shard_id, user_shard_domain_id) VALUES ('1', '1', '302', '12');" || exit 2
INSERT INTO nel_tool.neltool_user_shards (user_shard_id, user_shard_user_id, user_shard_shard_id, user_shard_domain_id) VALUES ('1', '1', '302', '12');" || msg_critical "[$(basename $0):$LINENO] MYSQL - Configure nel_tool.neltool_user_shards"
####################################
@ -228,7 +214,7 @@ INSERT INTO nel_tool.neltool_user_shards (user_shard_id, user_shard_user_id, use
####################################
msg_debug "[$(basename $0):$LINENO] Configure ring_mini01.sessions"
mysql -u root -e "use ring_mini01;
INSERT INTO ring_mini01.sessions (session_id, session_type, title, owner, plan_date, start_date, description, orientation, level, rule_type, access_type, state, host_shard_id, subscription_slots, reserved_slots, free_slots, estimated_duration, final_duration, folder_id, lang, icone, anim_mode, race_filter, religion_filter, guild_filter, shard_filter, level_filter, subscription_closed, newcomer) VALUES ('302', 'st_mainland', '', '0', '2005-09-21 12:41:33.000000', '2005-08-31 00:00:00.000000', '', 'so_other', 'sl_a', 'rt_strict', 'at_private', 'ss_planned', '0', '0', '0', '0', 'et_short', '0', '0', '', '', 'am_dm', '', '', 'gf_only_my_guild', 'sf_shard00,sf_shard01,sf_shard02,sf_shard03,sf_shard04,sf_shard05,sf_shard06,sf_shard07,sf_shard08,sf_shard09,sf_shard10,sf_shard11,sf_shard12,sf_shard13,sf_shard14,sf_shard15,sf_shard16,sf_shard17,sf_shard18,sf_shard19,sf_shard20,sf_shard21,sf_shard22,sf_shard23,sf_shard24,sf_shard25,sf_shard26,sf_shard27,sf_shard28,sf_shard29,sf_shard30', 'lf_a,lf_b,lf_c,lf_d,lf_e,lf_f', '0', '0');" || exit 2
INSERT INTO ring_mini01.sessions (session_id, session_type, title, owner, plan_date, start_date, description, orientation, level, rule_type, access_type, state, host_shard_id, subscription_slots, reserved_slots, free_slots, estimated_duration, final_duration, folder_id, lang, icone, anim_mode, race_filter, religion_filter, guild_filter, shard_filter, level_filter, subscription_closed, newcomer) VALUES ('302', 'st_mainland', '', '0', '2005-09-21 12:41:33.000000', '2005-08-31 00:00:00.000000', '', 'so_other', 'sl_a', 'rt_strict', 'at_private', 'ss_planned', '0', '0', '0', '0', 'et_short', '0', '0', '', '', 'am_dm', '', '', 'gf_only_my_guild', 'sf_shard00,sf_shard01,sf_shard02,sf_shard03,sf_shard04,sf_shard05,sf_shard06,sf_shard07,sf_shard08,sf_shard09,sf_shard10,sf_shard11,sf_shard12,sf_shard13,sf_shard14,sf_shard15,sf_shard16,sf_shard17,sf_shard18,sf_shard19,sf_shard20,sf_shard21,sf_shard22,sf_shard23,sf_shard24,sf_shard25,sf_shard26,sf_shard27,sf_shard28,sf_shard29,sf_shard30', 'lf_a,lf_b,lf_c,lf_d,lf_e,lf_f', '0', '0');" || msg_critical "[$(basename $0):$LINENO] MYSQL - Configure ring_mini01.sessions"
####################################
@ -237,7 +223,7 @@ INSERT INTO ring_mini01.sessions (session_id, session_type, title, owner, plan_d
msg_debug "[$(basename $0):$LINENO] Create one user"
declare accountuser="tester"
declare passworduser="tester"
curl 'http://localhost:40916/ams/index.php' \
httpcode=$(curl -L -w "%{http_code}" 'http://localhost:40916/ams/index.php' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
-H 'Accept-Language: en-US' \
-H 'Connection: keep-alive' \
@ -248,8 +234,13 @@ curl 'http://localhost:40916/ams/index.php' \
-H 'Upgrade-Insecure-Requests: 1' \
-H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20100101 Firefox/6.0' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data 'Username='"$accountuser"'&Password='"$passworduser"'&ConfirmPass=tester&Email=tester%40khaganat.net&TaC=on&function=add_user' \
-o $KHANAT_HOME/log/configure/world_account_tester.log || exit 2
--data 'Username='"$accountuser"'&Password='"$passworduser"'&ConfirmPass='"$passworduser"'&Email=tester%40khaganat.net&TaC=on&function=add_user' \
-o $KHANAT_HOME/log/configure/world_account_tester.log || msg_critical "[$(basename $0):$LINENO] curl - Create one user")
if [[ $httpcode != "200" ]]
then
msg_critical "[$(basename $0):$LINENO] curl - Create one user"
fi
####################################
@ -258,7 +249,7 @@ curl 'http://localhost:40916/ams/index.php' \
msg_debug "[$(basename $0):$LINENO] Create nel.permission"
mysql -u root -e "use nel;
UPDATE nel.permission SET AccessPrivilege = 'OPEN,DEV,RESTRICTED';
" || exit 2
" || msg_critical "[$(basename $0):$LINENO] mysql - Create nel.permission"
####################################
@ -266,8 +257,8 @@ UPDATE nel.permission SET AccessPrivilege = 'OPEN,DEV,RESTRICTED';
####################################
msg_debug "[$(basename $0):$LINENO] Stop Database & apache"
# start/restart service mysql & apache
sudo service apache2 stop || exit 2
sudo service mysql stop || exit 2
sudo service apache2 stop || msg_critical "[$(basename $0):$LINENO] apache2 stop"
sudo service mysql stop || msg_critical "[$(basename $0):$LINENO] mysql stop"
# Change right for file mysql
# TODO - remove creation of this file

View file

@ -230,6 +230,26 @@ function wait_all_job()
return $code
}
######################
# Debian information
######################
function get_debian_info()
{
cat /etc/debian_version
}
function get_debian_version()
{
local DEBIAN_INFO=$(get_debian_info)
echo ${DEBIAN_INFO%%.*}
}
function get_debian_release()
{
local DEBIAN_INFO=$(get_debian_info)
echo ${DEBIAN_INFO#*.}
}
######################
#
######################

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
####################################
# Configure 1st page
####################################
msg_debug "Configure 1st page"
create_dir_gameserver '/home/gameserver/rootweb'
cp /opt/rootweb/* /home/gameserver/rootweb/ || exit 2
####################################
# configure phpmyadmin
####################################
@ -94,7 +101,7 @@ msg_debug "configure apache"
cat << EOF > /etc/apache2/sites-available/000-default.conf
# Default
<VirtualHost *:80>
<Directory "/home/gameserver/khanat/khanatweb/">
<Directory "/home/gameserver/rootweb/">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
@ -102,11 +109,12 @@ cat << EOF > /etc/apache2/sites-available/000-default.conf
AddType text/html .php .phps
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps
AddHandler application/x-httpd-php .sh
</Directory>
ServerName lirria.khaganat.net
ServerAdmin webmaster@localhost
DocumentRoot /home/gameserver/khanat/khanatweb/public_php/
DocumentRoot /home/gameserver/rootweb/
ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined

View file

@ -124,9 +124,9 @@ alias l='ls \$LS_OPTIONS -lA'
# alias mv='mv -i'
# Autocompletion
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
#if [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
#fi
export KHANAT_HOME=/home/gameserver
export KHANAT_PATH=/home/gameserver/khanat
@ -171,6 +171,41 @@ alias l='ls \$LS_OPTIONS -lA'
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
cat << ENDOFCOMMENT
+--------------------------+
| KHANAT SERVER DOCKER |
+--------------------------+
Version: \$(cat /home/gameserver/version.txt)
IP:\$(hostname -i)
WEB : http://\$(hostname -i)/
SSH : ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@\$(hostname -i)
+------------+----------+-------------------+
| Account | Password | Where |
+------------+----------+-------------------+
| gameserver | khanat | ssh/terminal |
| root | | mysql/phpmyadmin |
| admin | admin | khaganat (admin) |
| tester | tester | khaganat (player) |
+------------+----------+-------------------+
Use 'sudo bash' to connect on root (ssh/terminal)
-----------------------------------------
SCREEN
--------
<Control>+A+N : next windows
<Control>+A+P : previous windows
<Control>+A+0 : windows 0 (terminal)
<Control>+A+1 : windows 1 (AES)
-----------------------------------------
To launch server : go to windows AES and ENTER
-----------------------------------------
ENDOFCOMMENT
EOF
####################################
@ -192,12 +227,15 @@ EOF
# Before login
msg_debug "Configure message login"
cat << EOF > /etc/issue.net
*********************
* KHANAT SERVER DEV *
*********************
************************
* KHANAT SERVER DOCKER *
************************
account gameserver
password khanat
+------------+----------+-------------------+
| Account | Password | Where |
+------------+----------+-------------------+
| gameserver | khanat | ssh/terminal |
+------------+----------+-------------------+
EOF
@ -205,23 +243,50 @@ EOF
msg_debug "Configure banner"
cat << EOF > /etc/motd
***************************************************
connect to root use gameserver account and launch sudo command
like :
EOF
sudo bash
# After Login and on gameserver (can use bash and other command)
# Bash_profile
cat << EOF > /home/gameserver/.bash_profile
cat << ENDOFCOMMENT
+--------------------------+
| KHANAT SERVER DOCKER |
+--------------------------+
---------------------------------------------------
mysql : account root (no password)
Version: \$(cat /home/gameserver/version.txt)
IP:\$(hostname -i)
WEB : http://\$(hostname -i)/
SSH : ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@\$(hostname -i)
+------------+----------+-------------------+
| Account | Password | Where |
+------------+----------+-------------------+
| gameserver | khanat | ssh/terminal |
| root | | mysql/phpmyadmin |
| admin | admin | khaganat (admin) |
| tester | tester | khaganat (player) |
+------------+----------+-------------------+
Use 'sudo bash' to connect on root (ssh/terminal)
---------------------------------------------------
log khanat server : /home/gameserver/khanat/server/log/log.log
***************************************************
ENDOFCOMMENT
EOF
chown gameserver:gameserver /home/gameserver/.bash_profile
# Activate banner
msg_debug "Activate banner"
sed -i 's/#Banner/Banner/g' /etc/ssh/sshd_config
sed -i 's/^[#]*[[:space:]]*Banner.*$/Banner \/etc\/issue.net/g' /etc/ssh/sshd_config
# Define default version (empty)
touch /home/gameserver/version.txt
chown gameserver:gameserver /home/gameserver/version.txt
chmod uga+wr /home/gameserver/version.txt
# Initialize ssh
/etc/init.d/ssh restart

View file

@ -28,6 +28,30 @@ options:
EOF
}
update_mysql_config()
{
if [ -z "$1" ]
then
msg_error "missing configuration file"
return
fi
if [ -f "$1" ]
then
msg_debug "update configuration $1"
sed -i -r 's/^user[[:space:]]+=[[:space:]]+(.*)/user = gameserver/g' $1 || exit 2
sed -i -r 's/^datadir[[:space:]]+=[[:space:]]+(.*)/datadir = \/home\/gameserver\/database/g' $1 || exit 2
sed -i -r 's/^log_error[[:space:]]+=[[:space:]]+(.*)/log_error = \/home\/gameserver\/log\/mysql\/error\.log/g' $1 || exit 2
sed -i -r 's/^(#*)general_log_file[[:space:]]+=(.*)/general_log_file = \/home\/gameserver\/log\/mysql\/mysql\.log/g' $1 || exit 2
sed -i -r 's/^(#*)general_log[[:space:]]+=(.*)/general_log = 1/g' $1 || exit 2
sed -i -r 's/^(#*)slow_query_log_file[[:space:]]+=(.*)/slow_query_log_file = \/home\/gameserver\/log\/mysql\/mysql-slow\.log/g' $1 || exit 2
sed -i -r 's/^(#*)slow_query_log[[:space:]]+=(.*)/slow_query_log = 1/g' $1 || exit 2
sed -i -r 's/^(#*)long_query_time[[:space:]]+=(.*)/long_query_time = 2/g' $1 || exit 2
sed -i -r 's/^(#*)log_queries_not_using_indexes(.*)/log_queries_not_using_indexes/g' $1 || exit 2
else
msg_debug "nothing for $1"
fi
}
#####################
# MAIN
#####################
@ -66,15 +90,16 @@ source /opt/khanat_config.sh
msg_debug "Create database for account gameserver"
# Create database on gameserver account (and change directory database)
sed -i -r 's/^user[[:space:]]+=[[:space:]]+(.*)/user = gameserver/g' /etc/mysql/my.cnf || exit 2
sed -i -r 's/^datadir[[:space:]]+=[[:space:]]+(.*)/datadir = \/home\/gameserver\/database/g' /etc/mysql/my.cnf || exit 2
sed -i -r 's/^log_error[[:space:]]+=[[:space:]]+(.*)/log_error = \/home\/gameserver\/log\/mysql\/error\.log/g' /etc/mysql/my.cnf || exit 2
sed -i -r 's/^(#*)general_log_file[[:space:]]+=(.*)/general_log_file = \/home\/gameserver\/log\/mysql\/mysql\.log/g' /etc/mysql/my.cnf || exit 2
sed -i -r 's/^(#*)general_log[[:space:]]+=(.*)/general_log = 1/g' /etc/mysql/my.cnf || exit 2
sed -i -r 's/^(#*)slow_query_log_file[[:space:]]+=(.*)/slow_query_log_file = \/home\/gameserver\/log\/mysql\/mysql-slow\.log/g' /etc/mysql/my.cnf || exit 2
sed -i -r 's/^(#*)slow_query_log[[:space:]]+=(.*)/slow_query_log = 1/g' /etc/mysql/my.cnf || exit 2
sed -i -r 's/^(#*)long_query_time[[:space:]]+=(.*)/long_query_time = 2/g' /etc/mysql/my.cnf || exit 2
sed -i -r 's/^(#*)log_queries_not_using_indexes(.*)/log_queries_not_using_indexes/g' /etc/mysql/my.cnf || exit 2
if [ $(get_debian_version) -lt 9 ]
then
msg_info "[$(basename $0):$LINENO] update mysql configuration /etc/mysql/my.cnf"
# old configuration mysql (on debian 8-)
update_mysql_config '/etc/mysql/my.cnf'
else
msg_info "[$(basename $0):$LINENO] update mysql configuration /etc/mysql/mariadb.conf.d/50-server.cnf"
# For mariadb (on debian 9)
update_mysql_config '/etc/mysql/mariadb.conf.d/50-server.cnf'
fi
mkdir -p /home/gameserver/database/ || exit 2
chown gameserver:$(id -g -n gameserver) /home/gameserver/database/ || exit 2
@ -82,6 +107,7 @@ chown gameserver:$(id -g -n gameserver) /home/gameserver/database/ || exit 2
mkdir -p /home/gameserver/log/mysql || exit 2
chown -R gameserver:$(id -g -n gameserver) /home/gameserver/log || exit 2
mkdir -p /var/run/mysqld || exit 2
chown gameserver:$(id -g -n gameserver) /var/run/mysqld/ || exit 2
####################################

View file

@ -16,6 +16,8 @@
# 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/>.
declare -i METHOD_START=2
usage()
{
cat << EOF
@ -25,128 +27,57 @@ usage:$0 [options]
options:
-h, --help : Show this help
-d, --debug : Show debug message
--start-khanat-with-screen : start with screen
--show-khanat-log : Show khanat log (after start)
--show-all-log : Show all log (after start) [apache, mysql, khanat]
--show-status-nagios : show status (ater start)
--show-status : show status (ater start)
--bash-after-start : command bash after start
--screen : start khanat with screen
--opennel-manager : (default) start khanat with OpenNel-Manager
--bash : launch bash (doesn't start khanat)
EOF
}
status_program()
{
pid=$(cat /home/gameserver/khanat/server/$1/$1.pid)
ps -p $pid >/dev/null
if [[ $? -eq 0 ]]
then
pidstate="ok"
else
pidstate="ko"
fi
state=$(cat /home/gameserver/khanat/server/$1/$1.state)
echo "$1 $2 [$state] pid:$pid => $pidstate"
}
status_all()
{
# aes : admin_executor_service.log
status_program 'aes' 'ryzom_admin_service'
# bms_master : backup_service.log
status_program 'bms_master' 'ryzom_backup_service'
# bms_pd_master
# status_program 'bms_pd_master' 'ryzom_backup_service'
# egs : entities_game_service.log
status_program 'egs' 'ryzom_entities_game_service'
# gpms : gpm_service.log
status_program 'gpms' 'ryzom_gpm_service'
# ios : input_output_service.log
status_program 'ios' 'ryzom_ios_service'
# rns : naming_service.log
status_program 'rns' 'ryzom_naming_service'
# rws : welcome_service.log
status_program 'rws' 'ryzom_welcome_service'
# ts : tick_service.log
status_program 'ts' 'ryzom_tick_service'
# ms : mirror_service.log
status_program 'ms' 'ryzom_mirror_service'
# ais_newbyland : ai_service.log
status_program 'ais_newbyland' 'ryzom_ai_service'
# mfs : mail_forum_service.log
status_program 'mfs' 'ryzom_mail_forum_service'
# su : shard_unifier_service.log
status_program 'su' 'ryzom_shard_unifier_service'
# fes : frontend_service.log
status_program 'fes' 'ryzom_frontend_service'
# sbs : session_browser_server.log
status_program 'sbs' 'ryzom_session_browser_service'
# lgs : logger_service.log
status_program 'lgs' 'ryzom_logger_service'
# mos
# status_program 'mos' 'ryzom_monitor_service'
# pdss
#status_program 'pdss' 'ryzom_pd_support_service'
# ras : admin_service.log
status_program 'ras' 'ryzom_admin_service'
}
function create_default_file_for_screen()
{
# on scrren mode, we launch with root right
# on screen mode, we launch with root right
# But file are created on root, so , to solve that, we generate directory and file before
create_dir_gameserver '/home/gameserver/khanat/server/bms_master'
create_dir_gameserver '/home/gameserver/khanat/server/rws'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/characters_offline_commands'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/characters'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/characters/002'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/ai_script_data'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/sale_store'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/www'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/www/302'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/www/302/ke'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/www/302/ke/kem'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/totems'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/logs'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/sdb'
create_dir_gameserver '/home/gameserver/khanat/server/pds'
create_dir_gameserver '/home/gameserver/khanat/server/pds/00000000'
create_dir_gameserver '/home/gameserver/khanat/server/pds/00000000/logs'
create_dir_gameserver '/home/gameserver/khanat/server/gpms'
create_dir_gameserver '/home/gameserver/khanat/server/aes'
create_dir_gameserver '/home/gameserver/khanat/server/lgs'
create_dir_gameserver '/home/gameserver/khanat/server/data_shard/primitive_cache'
create_dir_gameserver '/home/gameserver/khanat/server/su'
create_dir_gameserver '/home/gameserver/khanat/server/ms'
create_dir_gameserver '/home/gameserver/khanat/server/egs'
create_dir_gameserver '/home/gameserver/khanat/server/data_shard_local'
create_dir_gameserver '/home/gameserver/khanat/server/data_shard_local/statistics'
create_dir_gameserver '/home/gameserver/khanat/server/fes'
create_dir_gameserver '/home/gameserver/khanat/server/mfs'
create_dir_gameserver '/home/gameserver/khanat/server/ras'
create_dir_gameserver '/home/gameserver/khanat/server/ios'
create_dir_gameserver '/home/gameserver/khanat/server/sbs'
create_dir_gameserver '/home/gameserver/khanat/server/ais_newbyland'
create_dir_gameserver '/home/gameserver/khanat/server/rns'
create_dir_gameserver '/home/gameserver/khanat/server/ts'
create_dir_gameserver '/home/gameserver/khanat/server/bms_master' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/rws' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/characters_offline_commands' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/characters' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/characters/002' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/ai_script_data' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/sale_store' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/www' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/www/302' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/www/302/ke' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/www/302/ke/kem' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/totems' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/logs' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/sdb' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/pds' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/pds/00000000' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/pds/00000000/logs' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/gpms' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/aes' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/lgs' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/data_shard/primitive_cache' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/su' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/ms' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/egs' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/data_shard_local' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/data_shard_local/statistics' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/fes' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/mfs' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/ras' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/ios' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/sbs' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/ais_newbyland' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/rns' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/ts' || exit 2
}
function create_default_file_for_opennel_manager()
{
create_dir_gameserver '/home/gameserver/log/khanat' || exit 2
create_dir_gameserver '/home/gameserver/khanat/server/gpms' || exit 2
}
#####################
@ -166,30 +97,18 @@ do
set_debug 1
shift
;;
--start-khanat-with-screen)
--screen)
METHOD_START=0
shift
;;
--show-khanat-log)
--bash)
METHOD_START=1
shift
;;
--show-all-log)
METHOD_START=3
shift
;;
--show-status-nagios)
--opennel-manager)
METHOD_START=2
shift
;;
--show-status)
METHOD_START=4
shift
;;
--bash-after-start)
METHOD_START=5
shift
;;
*)
msg_error "options '$1' not recognize"
usage
@ -270,36 +189,40 @@ WHERE domain_id = 12;" || exit 2
# Start khanat
#####################
msg_debug "Start khanat"
if [ -f /home/gameserver/opennelmanager.flag ]
then
rm /home/gameserver/opennelmanager.flag || exit 2
fi
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
/opt/ext/servercontainer_launch_service.sh
sleep 10
tail -n+0 -f /home/gameserver/log/khanat/log.log
msg_debug "launch bash"
bash
elif [[ $METHOD_START -eq 2 ]]
then
/opt/ext/servercontainer_launch_service.sh
sleep 10
watch cat /home/gameserver/khanat/server/aes_nagios_report.txt
elif [[ $METHOD_START -eq 3 ]]
msg_debug "start with OpenNelManager"
touch /home/gameserver/opennelmanager.flag
# Disable Color
grep -e '^StdDisplayerColor' /home/gameserver/khanat/server/common.cfg >/dev/null
if [[ $? -eq 0 ]]
then
/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
/opt/ext/servercontainer_launch_service.sh
sleep 10
watch /opt/ext/servercontainer_launch_status.sh --no-color
elif [[ $METHOD_START -eq 5 ]]
then
/opt/ext/servercontainer_launch_service.sh
#sleep 10
bash
sed -i 's/StdDisplayerColor.*/StdDisplayerColor = 0;/g' /home/gameserver/khanat/server/common.cfg
else
msg_error 'Bad option'
echo -en "\n// ---- Disable color\nStdDisplayerColor = 0;\n" >> /home/gameserver/khanat/server/common.cfg
fi
# Start OpenNelManager
create_default_file_for_opennel_manager
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 (METHOD_START:$METHOD_START)'
exit 2
fi

View file

@ -34,7 +34,7 @@ function start_stop()
nameservice=$1
printf RUNNING > /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
}
@ -47,7 +47,7 @@ function launch_service()
create_file_gameserver "/home/gameserver/log/khanat/$nameservice.out"
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
#nohup $2 1>/dev/null 2>&1 &
#echo "$!" > /home/gameserver/khanat/server/$1.pid

View file

@ -16,12 +16,50 @@
# 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/>.
/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_apache.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_patch.sh -d' 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 $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

@ -1,33 +0,0 @@
# Dockerfile - Build for server debian
#
# Copyright (C) 2017 AleaJactaEst
#
# 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 <https://www.gnu.org/licenses/>.
#
FROM opennel/server_generic_debian_jessie_i686
MAINTAINER AleaJactaEst
ENV HOSTNAME khanat_server
COPY server/debian/common/servercontainer_function.sh /opt/
COPY server/debian/common/servercontainer_init_* /opt/
COPY output/opennel_debian_jessie_i686/khanat_config.sh /opt/khanat_config.sh
RUN /opt/servercontainer_init_create_account.sh
RUN /opt/servercontainer_init_mysql.sh
RUN /opt/servercontainer_init_apache.sh
RUN /opt/servercontainer_init_configure_envi.sh

View file

@ -1,537 +0,0 @@
#!/bin/bash
#
# Script to start khanat server (with docker)
# All data are include on host
#
# Copyright (C) 2017 AleaJactaEst
#
# 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 <https://www.gnu.org/licenses/>.
declare -i REMOVE=0
declare -i IMAGE=1
declare -i BASICSERVER=0
declare -i KHANATSERVER=0
declare -i CONFIGUREKHANATSERVER=0
declare -i LAUNCHKHANAT=1
declare -i UPDATEDATA=0
declare -i DEBUG=0
declare -i AUTODETEC=1
declare -i STOPKHANAT=0
declare -i CLEANCONTAINERKHANAT=0
declare -i CONNECTSSHKHANAT=0
declare -i KHANAT_CLIENT_VERSION=1
declare -i SHOWIPKHANATSERVER=0
declare METHODSTARTSERVER="--start-khanat-with-screen"
declare -i CLEANIMAGENONE=0
declare DOCKERBUILDOPT=""
declare IMAGEGENERICSERVER="opennel/server_generic_debian_jessie_i686"
declare IMAGEKHANATSERVER="opennel/servercontainer_debian_jessie_i686"
declare LOCALBUILDDIR="build/opennel/builder_debian_jessie_i686"
declare DIROUTPUT="output/opennel_debian_jessie_i686"
declare ROOTDATAKHANAT="$DIROUTPUT/gameserver"
declare DIRLOG="$ROOTDATAKHANAT/log"
declare DIRDATABASE="$ROOTDATAKHANAT/database"
declare ENVIFILE="$DIROUTPUT/khanat_config.sh"
declare DIRKHANAT="$ROOTDATAKHANAT/khanat"
declare KHANAT_RESSOURCES_DIR=""
declare KHANAT_CLIENT_DATA_DIR=""
declare OPENNEL_CODE_DIR=""
declare STEP_CONFIGURE_OK="$ROOTDATAKHANAT/khanat/step_configure.ok"
declare DIRCLIENT="Khanat_Linux32"
declare PACKAGECLIENT="smokey_linux32"
usage()
{
cat << EOF
usage:$0 [options]
script to build under docker
Step:
1) create image basic server
2) create image khanat server
3) configure khagant server
4) launch khagant server
options:
-h, --help : Show this help
-d, --debug : Show debug message
-r, --remove : Remove directory data khanat
-b, --force-basic : Force create/recreate image basic server
-k, --force-khanat : Force create/recreate image khanat server
-u, --update-data : generate a new patch (client & update server)
-g, --configure-khanat : Force configure khanat server
-n, --no-launch-khanat : Doesn't launch khanat server
-s, --stop-server : Stop server khanat
-c, --clean-container-khanat : Remove old server khanat (stopped)
-w, --clean-images-none : Remove images docker (with name 'none')
-i, --show-ip-khanat-server : show ip address for khanat server (launch under docker)
--option-docker-build=[STRING] : you can add option in "docker build"
--khanat-ressources-dir=[DIR] : localization khanat-ressources
--khanat-client-data-dir=[DIR] : localization khanat-client-data
--opennel-code-dir=[DIR] : localization opennel-code
--start-khanat-with-screen : start with screen
--start-khanat-with-khanat-log : start server khanat and show khanat log
--start-khanat-with-full-log : start server khanat and show full log
--start-khanat-with-watch-state : start server khanat and show state (loop)
--start-khanat-with-watch-state-nagios : start server khanat and show state [nagios format] (loop)
--start-khanat-with-bash-after : start server khanat and launch bash
--start-with-manager : start khanat with manager
--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]
./server.sh
./server.sh -k
./server.sh --ssh
EOF
}
function msg_debug()
{
if [[ $DEBUG -ne 0 ]]
then
echo "$(date "+%Y/%m/%d %H:%M:%S") DEBUG - $*"
fi
}
function msg_info()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $*"
}
function msg_error()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - $*" >&2
}
#
# MAIN
#
#msg_info "START"
calldir="$(dirname $0)"
basedir=$(cd $calldir; pwd)
rootdir="$(dirname $(dirname $(dirname $(dirname ${basedir}))))"
ressourcedir="$(dirname ${rootdir})/khanat-ressources"
dataclientdir="$(dirname ${rootdir})/khanat-client-data"
while test $# -gt 0
do
case "$1" in
-h|--help)
usage
exit 1
;;
-d|--debug)
DEBUG=1
shift
;;
--ssh)
CONNECTSSHKHANAT=1
shift
;;
-r|--remove)
REMOVE=1
CONFIGUREKHANATSERVER=1
shift
;;
-c|--clean-container-khanat)
CLEANCONTAINERKHANAT=1
shift
;;
-s|--stop-server)
STOPKHANAT=1
shift
;;
-b|--force-basic)
BASICSERVER=1
shift
;;
-n|--no-launch-khanat)
LAUNCHKHANAT=0
shift
;;
-k|--force-khanat)
KHANATSERVER=1
shift
;;
-g|--configure-khanat)
CONFIGUREKHANATSERVER=1
shift
;;
-i|--show-ip-khanat-server)
SHOWIPKHANATSERVER=1
shift
;;
--start-khanat-with-screen)
METHODSTARTSERVER="--start-khanat-with-screen"
shift
;;
--start-khanat-with-khanat-log)
METHODSTARTSERVER="--show-khanat-log"
shift
;;
--start-khanat-with-full-log)
METHODSTARTSERVER="--show-all-log"
shift
;;
--start-khanat-with-watch-state)
METHODSTARTSERVER="--show-status"
shift
;;
--start-khanat-with-watch-state-nagios)
METHODSTARTSERVER="--show-status-nagios"
shift
;;
--start-khanat-with-bash-after)
METHODSTARTSERVER="--bash-after-start"
shift
;;
--start-with-manager)
METHODSTARTSERVER="--start-with-manager"
shift
;;
--client-version*)
KHANAT_CLIENT_VERSION="${1#*=}"
shift
;;
--khanat-ressources-dir=*)
KHANAT_RESSOURCES_DIR="${1#*=}"
shift
;;
--khanat-client-data-dir=*)
KHANAT_CLIENT_DATA_DIR="${1#*=}"
shift
;;
--opennel-code-dir=*)
OPENNEL_CODE_DIR="${1#*=}"
shift
;;
-w|--clean-images-none)
CLEANIMAGENONE=1
shift
;;
-u|--update-data)
UPDATEDATA=1
shift
;;
--option-docker-build)
DOCKERBUILDOPT="$DOCKERBUILDOPT ${1#*=}"
shift
;;
*)
msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage
exit 1
;;
esac
done
function chrashed()
{
msg_error "[$(basename $0):$LINENO] BUILD FAILED (code:$?)"
exit 2
}
trap chrashed EXIT
if [[ $SHOWIPKHANATSERVER -eq 0 ]]
then
msg_info "[$(basename $0):$LINENO] START"
fi
msg_debug "[$(basename $0):$LINENO] prg: $0"
docker -v 1>/dev/null
if [[ $? -ne 0 ]]
then
msg_error "[$(basename $0):$LINENO] docker not installed"
exit 2
fi
case "$(uname -m)" in
x86_64)
;;
i686)
;;
*)
msg_error "[$(basename $0):$LINENO] Unknown archi : $(uname -m)"
exit 2
;;
esac
if [[ $REMOVE -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] REMOVE DATA KHANAT : $ROOTDATAKHANAT"
if [[ -n "$ROOTDATAKHANAT" ]]
then
rm -rf ${ROOTDATAKHANAT}/* || exit 2
fi
fi
msg_debug "[$(basename $0):$LINENO] Create directory on host ($ROOTDATAKHANAT)"
mkdir -p $ROOTDATAKHANAT || exit 2
chmod g+s $ROOTDATAKHANAT
if [[ ($CONNECTSSHKHANAT -ne 0) || ($SHOWIPKHANATSERVER -ne 0) ]]
then
msg_debug "[$(basename $0):$LINENO] clean container"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
if [[ ${#listcontainer[@]} -eq 1 ]]
then
ipaddress=$(docker inspect --format="{{ .NetworkSettings.IPAddress }}" ${listcontainer[@]})
fi
fi
if [[ $SHOWIPKHANATSERVER -ne 0 ]]
then
trap '' EXIT
echo "$ipaddress"
exit 0
fi
if [[ $CONNECTSSHKHANAT -ne 0 ]]
then
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@$ipaddress
trap '' EXIT
msg_info "[$(basename $0):$LINENO] END SSH"
exit 0
fi
if [[ $AUTODETEC -ne 0 ]]
then
msg_debug "[$(basename $0):$LINENO] Autodetect state"
if [[ $(docker images -f "reference=$IMAGEGENERICSERVER" | wc -l) -lt 2 ]]
then
BASICSERVER=1
fi
if [[ $(docker images -f "reference=$IMAGEKHANATSERVER" | wc -l) -lt 2 ]]
then
KHANATSERVER=1
fi
if [[ -z "$KHANAT_RESSOURCES_DIR" ]]
then
KHANAT_RESSOURCES_DIR="$(dirname $rootdir)/khanat-ressources"
fi
if [[ -z "$KHANAT_CLIENT_DATA_DIR" ]]
then
KHANAT_CLIENT_DATA_DIR="$(dirname $rootdir)/khanat-client-data"
fi
if [[ -z "$OPENNEL_CODE_DIR" ]]
then
OPENNEL_CODE_DIR="$(dirname $rootdir)/khanat-opennel-code"
fi
if [[ ! (-f $rootdir/$STEP_CONFIGURE_OK) ]]
then
CONFIGUREKHANATSERVER=1
fi
fi
DIRBUILD="${rootdir}/${LOCALBUILDDIR}"
msg_debug "[$(basename $0):$LINENO] calldir: $calldir"
msg_debug "[$(basename $0):$LINENO] basedir: $basedir"
msg_debug "[$(basename $0):$LINENO] rootdir: $rootdir"
msg_debug "[$(basename $0):$LINENO] ressourcedir: $ressourcedir"
msg_debug "[$(basename $0):$LINENO] generate basic image: $BASICSERVER"
msg_debug "[$(basename $0):$LINENO] localization khanat-ressources : ${KHANAT_RESSOURCES_DIR}"
msg_debug "[$(basename $0):$LINENO] localization khanat-client-data: ${KHANAT_CLIENT_DATA_DIR}"
msg_debug "[$(basename $0):$LINENO] localization opennel-code-client : ${OPENNEL_CODE_DIR}"
msg_debug "[$(basename $0):$LINENO] generate khanat image: $KHANATSERVER"
msg_debug "[$(basename $0):$LINENO] launch khanat: $LAUNCHKHANAT"
msg_debug "[$(basename $0):$LINENO] stop khanat: $STOPKHANAT"
msg_info "[$(basename $0):$LINENO] check khanat-ressources"
if [[ ! -d ${KHANAT_RESSOURCES_DIR} ]]
then
msg_error "[$(basename $0):$LINENO] Missing directory khanat-ressources [${KHANAT_RESSOURCES_DIR}]"
cat << EOF
You need clone repo khanat-ressource.
cd $(dirname ${KHANAT_RESSOURCES_DIR})
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-ressources.git
EOF
exit 2
fi
msg_info "[$(basename $0):$LINENO] check khanat-client-data"
if [[ ! -d ${KHANAT_CLIENT_DATA_DIR} ]]
then
msg_error "[$(basename $0):$LINENO] Missing directory khanat-client-data [${KHANAT_CLIENT_DATA_DIR}]"
cat << EOF
You need clone repo khanat-client-data.
cd $(dirname ${KHANAT_CLIENT_DATA_DIR})
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-client-data.git
EOF
exit 2
fi
if [[ ! -d ${OPENNEL_CODE_DIR} ]]
then
msg_error "[$(basename $0):$LINENO] Missing directory opennel-code [${OPENNEL_CODE_DIR}]"
cat << EOF
You need clone repo khanat-opennel-code.
cd $(dirname ${KHANAT_RESSOURCES_DIR})
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-opennel-code.git
EOF
exit 2
fi
if [[ $STOPKHANAT -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] STOP SERVER KHANAT"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT UP : ${listcontainer[@]}"
if [[ -n "$listcontainer" ]]
then
docker stop "$listcontainer" || exit 2
fi
fi
if [[ $CLEANCONTAINERKHANAT -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] CLEAN CONTAINER KHANAT"
listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') )
msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT EXITED : ${listcontainer[@]}"
if [[ -n "${listcontainer[@]}" ]]
then
docker rm --force "${listcontainer[@]}" || exit 2
fi
fi
if [[ $CLEANIMAGENONE -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "[$(basename $0):$LINENO] IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]]
then
docker rmi --force "${listimages[@]}" || exit 2
fi
fi
if [[ $BASICSERVER -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE BASIC SERVER"
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \
--file "${basedir}/Dockerfile" || exit 2
fi
if [[ $KHANATSERVER -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE KHANAT SERVER"
cat << EOF > $rootdir/${ENVIFILE}
#!/bin/bash
# Temporary file, use only to send some information on build docker
export KHANAT_CLIENT_VERSION=$KHANAT_CLIENT_VERSION
export UIDGAMESERVER=$(id -u)
export GIDGAMESERVER=$(id -g)
export DIRCLIENT="$DIRCLIENT"
export PACKAGECLIENT="$PACKAGECLIENT"
EOF
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEKHANATSERVER} \
--file "${basedir}/Dockerfile.khanat.container" || exit 2
fi
if [[ $CONFIGUREKHANATSERVER -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] CONFIGURE KHANAT SERVER"
mkdir -p $DIRLOG || exit 2
mkdir -p $DIRDATABASE || 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 \
-v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \
-v ${OPENNEL_CODE_DIR}/code/ryzom:/home/gameserver/ext/ryzom-ressources:ro \
-v ${KHANAT_RESSOURCES_DIR}:/home/gameserver/ext/khanat-ressources:ro \
-v ${KHANAT_CLIENT_DATA_DIR}:/home/gameserver/ext/khanat-client-data:ro \
-v ${rootdir}/$DIRLOG:/home/gameserver/log:rw \
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_configure_auto.sh"
cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
-v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \
-v ${OPENNEL_CODE_DIR}/code/ryzom:/home/gameserver/ext/ryzom-ressources:ro \
-v ${KHANAT_RESSOURCES_DIR}:/home/gameserver/ext/khanat-ressources:ro \
-v ${KHANAT_CLIENT_DATA_DIR}:/home/gameserver/ext/khanat-client-data:ro \
-v ${rootdir}/$DIRLOG:/home/gameserver/log:rw \
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_configure_auto.sh || exit 2
fi
if [[ $UPDATEDATA -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] UPDATE KHANAT SERVER"
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 \
-v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \
-v ${OPENNEL_CODE_DIR}/code/ryzom:/home/gameserver/ext/ryzom-ressources:ro \
-v ${KHANAT_RESSOURCES_DIR}:/home/gameserver/ext/khanat-ressources:ro \
-v ${KHANAT_CLIENT_DATA_DIR}:/home/gameserver/ext/khanat-client-data:ro \
-v ${rootdir}/$DIRLOG:/home/gameserver/log:rw \
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_update_auto.sh"
cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
-v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \
-v ${OPENNEL_CODE_DIR}/code/ryzom:/home/gameserver/ext/ryzom-ressources:ro \
-v ${KHANAT_RESSOURCES_DIR}:/home/gameserver/ext/khanat-ressources:ro \
-v ${KHANAT_CLIENT_DATA_DIR}:/home/gameserver/ext/khanat-client-data:ro \
-v ${rootdir}/$DIRLOG:/home/gameserver/log:rw \
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_update_auto.sh
fi
if [[ $LAUNCHKHANAT -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] START KHANAT SERVER"
cd $rootdir; docker run -it --hostname=khanat \
-u "$(id -u $USERNAME):$(id -g $USERNAME)" \
-v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
-v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \
-v ${OPENNEL_CODE_DIR}/code/ryzom:/home/gameserver/ext/ryzom-ressources:ro \
-v ${KHANAT_RESSOURCES_DIR}:/home/gameserver/ext/khanat-ressources:ro \
-v ${KHANAT_CLIENT_DATA_DIR}:/home/gameserver/ext/khanat-client-data:ro \
-v ${rootdir}/$DIRLOG:/home/gameserver/log:rw \
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_launch_auto.sh $METHODSTARTSERVER -d
fi
trap '' EXIT
msg_info "[$(basename $0):$LINENO] END"

View file

@ -1,443 +0,0 @@
#!/bin/bash
#
# Script to start khanat server
#
# Copyright (C) 2017 AleaJactaEst
#
# 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 <https://www.gnu.org/licenses/>.
declare -i IMAGE=1
declare -i BASICSERVER=0
declare -i KHANATSERVER=0
declare -i KHANATRESSOURCES=0
declare -i KHANATDATACLIENT=0
declare -i RYZOMRESSOURCES=0
declare -i LAUNCHKHANAT=1
declare -i DEBUG=0
declare -i AUTODETEC=1
declare -i STOPKHANAT=0
declare -i CLEANCONTAINERKHANAT=0
declare -i CONNECTSSHKHANAT=0
declare -i KHANAT_CLIENT_VERSION=1
declare -i SHOWIPKHANATSERVER=0
declare -i METHODSTARTSERVER=1
declare -i CLEANIMAGENONE=0
declare DOCKERBUILDOPT=""
declare OPENNEL_CODE_DIR=""
declare IMAGEGENERICSERVER="opennel/server_generic_debian_jessie_i686"
declare IMAGEKHANATSERVER="opennel/serverimage_debian_jessie_i686"
declare LOCALBUILDDIR="build/opennel/builder_debian_jessie_i686"
declare DIRCLIENT="Khanat_Linux32"
declare PACKAGECLIENT="smokey_linux32"
declare DIROUTPUT="output/extra"
usage()
{
cat << EOF
usage:$0 [options]
script to build under docker
Step:
1) generate tar with khanat-ressources
2) generate tar with ryzom-ressources
3) create image basic server
4) create image khanat server
5) launch khanat server
options:
-h, --help : Show this help
-d, --debug : Show debug message
-b, --force-basic : Force create/recreate image basic server
-t, --force-tar-ressources : Generate TAR.GZ for khanat-ressources (look directory ../khanat-ressources)
-q, --force-tar-client-data : Generate TAR.GZ for khanat-client-data (look directory ../khanat-client-data)
-z, --force-tar-ryzom-ressources : Generate TAR.GZ in data khanat-code
-k, --force-khanat : Force create/recreate image khanat server
-n, --no-launch-khanat : Doesn't launch khanat server
-s, --stop-server : Stop server khanat
-c, --clean-container-khanat : Remove old server khanat (stopped)
-w, --clean-images-none : Remove images docker (with name 'none')
-i, --show-ip-khanat-server : show ip address for khanat server (launch under docker)
--option-docker-build=[STRING] : you can add option in "docker build"
--opennel-code-dir=[DIR] : localization opennel-code
--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)
Example :
cd [root Khanat directory]
./server.sh
./server.sh -k
./server.sh --ssh
EOF
}
function msg_debug()
{
if [[ $DEBUG -ne 0 ]]
then
echo "$(date "+%Y/%m/%d %H:%M:%S") DEBUG - $*"
fi
}
function msg_info()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $*"
}
function msg_error()
{
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - $*" >&2
}
#
# MAIN
#
#msg_info "START"
calldir="$(dirname $0)"
basedir=$(cd $calldir; pwd)
rootdir="$(dirname $(dirname $(dirname $(dirname ${basedir}))))"
ressourcedir="$(dirname ${rootdir})/khanat-ressources"
dataclientdir="$(dirname ${rootdir})/khanat-client-data"
while test $# -gt 0
do
case "$1" in
-h|--help)
usage
exit 1
;;
-d|--debug)
DEBUG=1
shift
;;
--ssh)
CONNECTSSHKHANAT=1
shift
;;
-c|--clean-container-khanat)
CLEANCONTAINERKHANAT=1
shift
;;
-s|--stop-server)
STOPKHANAT=1
shift
;;
-b|--force-basic)
BASICSERVER=1
shift
;;
-n|--no-launch-khanat)
LAUNCHKHANAT=0
shift
;;
-t|--force-tar-ressources)
KHANATRESSOURCES=1
shift
;;
-q|--force-tar-client-data)
KHANATDATACLIENT=1
shift
;;
-z|--force-tar-ryzom-ressources)
RYZOMRESSOURCES=1
shift
;;
-k|--force-khanat)
KHANATSERVER=1
shift
;;
-i|--show-ip-khanat-server)
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
;;
-w|--clean-images-none)
CLEANIMAGENONE=1
shift
;;
--option-docker-build)
DOCKERBUILDOPT="$DOCKERBUILDOPT ${1#*=}"
shift
;;
--opennel-code-dir=*)
OPENNEL_CODE_DIR="${1#*=}"
shift
;;
*)
msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage
exit 1
;;
esac
done
function chrashed()
{
msg_error "[$(basename $0):$LINENO] BUILD FAILED (code:$?)"
exit 2
}
trap chrashed EXIT
if [[ $SHOWIPKHANATSERVER -eq 0 ]]
then
msg_info "[$(basename $0):$LINENO] START"
fi
msg_debug "[$(basename $0):$LINENO] prg: $0"
extradir="${rootdir}/${DIROUTPUT}"
mkdir -p ${extradir} || exit 2
docker -v 1>/dev/null
if [[ $? -ne 0 ]]
then
msg_error "[$(basename $0):$LINENO] docker not installed"
exit 2
fi
case "$(uname -m)" in
x86_64)
;;
i686)
;;
*)
msg_error "[$(basename $0):$LINENO] Unknown archi : $(uname -m)"
exit 2
;;
esac
if [[ ($CONNECTSSHKHANAT -ne 0) || ($SHOWIPKHANATSERVER -ne 0) ]]
then
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
if [[ ${#listcontainer[@]} -eq 1 ]]
then
ipaddress=$(docker inspect --format="{{ .NetworkSettings.IPAddress }}" ${listcontainer[@]})
fi
fi
if [[ $SHOWIPKHANATSERVER -ne 0 ]]
then
trap '' EXIT
echo "$ipaddress"
exit 0
fi
if [[ $CONNECTSSHKHANAT -ne 0 ]]
then
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@$ipaddress
trap '' EXIT
msg_info "[$(basename $0):$LINENO] END SSH"
exit 0
fi
if [[ $AUTODETEC -ne 0 ]]
then
if [[ $(docker images -f "reference=$IMAGEGENERICSERVER" | wc -l) -lt 2 ]]
then
BASICSERVER=1
fi
if [[ ! -f ${extradir}/khanat-ressources.tar.gz ]]
then
KHANATRESSOURCES=1
fi
if [[ ! -f ${extradir}/khanat-client-data.tar.gz ]]
then
KHANATDATACLIENT=1
fi
if [[ ! -f ${extradir}/ryzom-ressources.tar.gz ]]
then
RYZOMRESSOURCES=1
fi
if [[ $(docker images -f "reference=$IMAGEKHANATSERVER" | wc -l) -lt 2 ]]
then
KHANATSERVER=1
fi
if [[ -z "$OPENNEL_CODE_DIR" ]]
then
OPENNEL_CODE_DIR="$(dirname $rootdir)/khanat-opennel-code"
fi
if [[ -f ${extradir}/ryzomcore.tar.gz ]]
then
sumsrc=$(md5sum ${rootdir}/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz | awk '{print $1}')
sumdst=$(md5sum ${extradir}/ryzomcore.tar.gz | awk '{print $1}')
else
sumsrc=1
sumdsr=2
fi
msg_debug "[$(basename $0):$LINENO] ryzomcore checksum src:$sumsrc dst:$sumdst"
if [[ "$sumsrc" != "$sumdst" ]]
then
msg_debug "[$(basename $0):$LINENO] copy ryzomcore"
cp ${rootdir}/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz ${extradir}/ryzomcore.tar.gz || exit 2
KHANATSERVER=1
fi
fi
DIRBUILD="${rootdir}/${LOCALBUILDDIR}"
msg_debug "[$(basename $0):$LINENO] calldir: $calldir"
msg_debug "[$(basename $0):$LINENO] basedir: $basedir"
msg_debug "[$(basename $0):$LINENO] rootdir: $rootdir"
msg_debug "[$(basename $0):$LINENO] ressourcedir: $ressourcedir"
msg_debug "[$(basename $0):$LINENO] generate basic image: $BASICSERVER"
msg_debug "[$(basename $0):$LINENO] generate tar khanat ressources: $KHANATRESSOURCES"
msg_debug "[$(basename $0):$LINENO] generate tar khanat data client: $KHANATDATACLIENT"
msg_debug "[$(basename $0):$LINENO] generate tar ryzom ressources: $RYZOMRESSOURCES"
msg_debug "[$(basename $0):$LINENO] generate khanat image: $KHANATSERVER"
msg_debug "[$(basename $0):$LINENO] launch khanat: $LAUNCHKHANAT"
msg_debug "[$(basename $0):$LINENO] stop khanat: $STOPKHANAT"
if [[ ! -d ${OPENNEL_CODE_DIR} ]]
then
msg_error "[$(basename $0):$LINENO] Missing directory opennel-code [${OPENNEL_CODE_DIR}]"
cat << EOF
You need clone repo khanat-opennel-code.
cd $(dirname ${KHANAT_RESSOURCES_DIR})
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-opennel-code.git
EOF
exit 2
fi
if [[ $KHANATRESSOURCES -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] CREATE TAR with KHANAT Ressources"
if [[ ! -d ${ressourcedir} ]]
then
msg_error "[$(basename $0):$LINENO] Missing khanat-ressources directory ($ressourcedir)"
exit 2
fi
(cd $ressourcedir; tar --exclude='.git' -czf ${extradir}/khanat-ressources.tar.gz .) || exit 2
fi
if [[ $KHANATDATACLIENT -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] CREATE TAR with KHANAT DATA CLIENT"
if [[ ! -d ${dataclientdir} ]]
then
msg_error "[$(basename $0):$LINENO] Missing khanat-client-data directory ($dataclientdir)"
exit 2
fi
(cd $dataclientdir; tar --exclude='.git' -czf ${extradir}/khanat-client-data.tar.gz .) || exit 2
fi
if [[ $RYZOMRESSOURCES -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] CREATE TAR with RYZOM Ressources"
if [[ ! -d ${ressourcedir} ]]
then
msg_error "[$(basename $0):$LINENO] Missing khanat-ressources directory ($ressourcedir)"
exit 2
fi
cd ${OPENNEL_CODE_DIR}; tar czf ${extradir}/ryzom-ressources.tar.gz \
code/ryzom/server/shard.screen.rc \
code/ryzom/common/* \
code/ryzom/client/* \
code/ryzom/server/* \
code/ryzom/tools/scripts/linux/* \
code/web/* || exit 2
fi
if [[ $STOPKHANAT -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] STOP SERVER KHANAT"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT UP : ${listcontainer[@]}"
if [[ -n "$listcontainer" ]]
then
docker stop "$listcontainer" || exit 2
fi
fi
if [[ $CLEANCONTAINERKHANAT -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] CLEAN CONTAINER KHANAT"
listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') )
msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT EXITED : ${listcontainer[@]}"
if [[ -n "${listcontainer[@]}" ]]
then
docker rm --force "${listcontainer[@]}" || exit 2
fi
fi
if [[ $CLEANIMAGENONE -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "[$(basename $0):$LINENO] IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]]
then
docker rmi --force "${listimages[@]}" || exit 2
fi
fi
if [[ $BASICSERVER -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE BASIC SERVER"
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \
--file "${basedir}/Dockerfile" || exit 2
fi
if [[ $KHANATSERVER -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] 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
export DIRCLIENT="$DIRCLIENT"
export PACKAGECLIENT="$PACKAGECLIENT"
EOF
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEKHANATSERVER} \
--file "${basedir}/Dockerfile.khanat.image" || exit 2
rm $rootdir/todelete.sh
fi
if [[ $LAUNCHKHANAT -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] START KHANAT SERVER"
cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \
${IMAGEKHANATSERVER} /opt/serverimage_autostart.sh $METHODSTARTSERVER
clear
fi
trap '' EXIT
msg_info "[$(basename $0):$LINENO] END"

View file

@ -1,34 +0,0 @@
# Dockerfile - Build image to prepare khanat server
#
# Copyright (C) 2017 AleaJactaEst
#
# 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 <https://www.gnu.org/licenses/>.
#
FROM amd64/debian:8
MAINTAINER AleaJactaEst
ENV HOSTNAME basic_server
RUN apt-get update ; \
apt-get dist-upgrade -y ; \
apt-get install -y curl nano vim less bash-completion cron logrotate bsd-mailx ; \
apt-get install -y openssh-server sudo net-tools ; \
apt-get install -y lzma xdelta p7zip p7zip-full ; \
DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server ; \
apt-get install -y apache2 php5 libapache2-mod-php5 php5-mysql apache2-utils php5-gd php5-imagick rrdtool screen mcrypt php5-mcrypt python3 ; \
DEBIAN_FRONTEND=noninteractive apt-get install -y phpmyadmin

View file

@ -1,33 +0,0 @@
# Dockerfile - Build for server debian
#
# Copyright (C) 2017 AleaJactaEst
#
# 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 <https://www.gnu.org/licenses/>.
#
FROM opennel/server_generic_debian_jessie_x86_64
MAINTAINER AleaJactaEst
ENV HOSTNAME khanat_server
COPY todelete.sh /opt/khanat_config.sh
COPY server/debian/common/ /opt/
COPY output/extra/ryzomcore.tar.gz /opt/
COPY output/extra/ryzom-ressources.tar.gz /opt/
COPY output/extra/khanat-ressources.tar.gz /opt/
COPY output/extra/khanat-client-data.tar.gz /opt/
RUN /opt/serverimage_init_khanat.sh

View file

@ -16,19 +16,14 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
FROM i386/debian:8
FROM amd64/debian:9
MAINTAINER AleaJactaEst
ENV HOSTNAME basic_server
RUN apt-get update ; \
apt-get dist-upgrade -y ; \
apt-get install -y curl nano vim less bash-completion cron logrotate bsd-mailx ; \
apt-get install -y openssh-server sudo net-tools ; \
apt-get install -y lzma xdelta p7zip p7zip-full ; \
DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server ; \
apt-get install -y apache2 php5 libapache2-mod-php5 php5-mysql apache2-utils php5-gd php5-imagick rrdtool screen mcrypt php5-mcrypt python3 ; \
DEBIAN_FRONTEND=noninteractive apt-get install -y phpmyadmin
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 python3-pip python3-bcrypt python3-pip

View file

@ -16,15 +16,18 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
FROM opennel/server_generic_debian_jessie_x86_64
FROM opennel/server_generic_debian_stretch_x86_64
MAINTAINER AleaJactaEst
ENV HOSTNAME khanat_server
RUN ulimit -c unlimited
COPY server/debian/common/servercontainer_function.sh /opt/
COPY server/debian/common/servercontainer_init_* /opt/
COPY output/opennel_debian_jessie_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_mysql.sh

View file

@ -16,7 +16,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
FROM opennel/server_generic_debian_jessie_i686
FROM opennel/server_generic_debian_stretch_x86_64
MAINTAINER AleaJactaEst
ENV HOSTNAME khanat_server

View file

@ -33,22 +33,28 @@ declare -i CLEANCONTAINERKHANAT=0
declare -i CONNECTSSHKHANAT=0
declare -i KHANAT_CLIENT_VERSION=1
declare -i SHOWIPKHANATSERVER=0
declare METHODSTARTSERVER="--start-khanat-with-screen"
declare METHODSTARTSERVER="--opennel-manager"
declare -i CLEANIMAGENONE=0
declare DOCKERBUILDOPT=""
declare DOCKERRUNOPT=""
declare CONFIGUREAUTO=""
declare UPDATEAUTO=""
declare -i CLEARTERMINAL=0
declare IMAGEGENERICSERVER="opennel/server_generic_debian_jessie_x86_64"
declare IMAGEKHANATSERVER="opennel/servercontainer_debian_jessie_x86_64"
declare LOCALBUILDDIR="build/opennel/builder_debian_jessie_x86_64"
declare DIROUTPUT="output/opennel_debian_jessie_x86_64"
declare IMAGEGENERICSERVER="opennel/server_generic_debian_stretch_x86_64"
declare IMAGEKHANATSERVER="opennel/servercontainer_debian_stretch_x86_64"
declare LOCALBUILDDIR="build/opennel/builder_debian_stretch_x86_64"
declare DIROUTPUT="output/opennel_debian_stretch_x86_64"
declare ROOTDATAKHANAT="$DIROUTPUT/gameserver"
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=""
declare PYMANAGER=""
declare STEP_CONFIGURE_OK="$ROOTDATAKHANAT/khanat/step_configure.ok"
declare DIRCLIENT="Khanat_Linux64"
declare PACKAGECLIENT="smokey_linux64"
@ -79,18 +85,17 @@ options:
-w, --clean-images-none : Remove images docker (with name 'none')
-i, --show-ip-khanat-server : show ip address for khanat server (launch under docker)
--option-docker-build=[STRING] : you can add option in "docker build"
--option-docker-run=[STRING] : you can add option in "docker run"
--khanat-ressources-dir=[DIR] : localization khanat-ressources
--khanat-client-data-dir=[DIR] : localization khanat-client-data
--opennel-code-dir=[DIR] : localization opennel-code
--pymanager-dir=[DIR] : localization pymanager
--start-khanat-with-screen : start with screen
--start-khanat-with-khanat-log : start server khanat and show khanat log
--start-khanat-with-full-log : start server khanat and show full log
--start-khanat-with-watch-state : start server khanat and show state (loop)
--start-khanat-with-watch-state-nagios : start server khanat and show state [nagios format] (loop)
--start-khanat-with-bash-after : start server khanat and launch bash
--start-with-manager : start khanat with manager
--start-bash : start server khanat and launch bash
--start-with-manager : start khanat with manager (default)
--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)
--clear-terminal : clear terminal when script finished
Example :
cd [root Khanat directory]
@ -139,6 +144,8 @@ do
;;
-d|--debug)
DEBUG=1
CONFIGUREAUTO="$CONFIGUREAUTO -d"
UPDATEAUTO="$UPDATEAUTO -d"
shift
;;
--ssh)
@ -179,31 +186,15 @@ do
shift
;;
--start-khanat-with-screen)
METHODSTARTSERVER="--start-khanat-with-screen"
METHODSTARTSERVER="--screen"
shift
;;
--start-khanat-with-khanat-log)
METHODSTARTSERVER="--show-khanat-log"
shift
;;
--start-khanat-with-full-log)
METHODSTARTSERVER="--show-all-log"
shift
;;
--start-khanat-with-watch-state)
METHODSTARTSERVER="--show-status"
shift
;;
--start-khanat-with-watch-state-nagios)
METHODSTARTSERVER="--show-status-nagios"
shift
;;
--start-khanat-with-bash-after)
METHODSTARTSERVER="--bash-after-start"
--start-bash)
METHODSTARTSERVER="--bash"
shift
;;
--start-with-manager)
METHODSTARTSERVER="--start-with-manager"
METHODSTARTSERVER="--opennel-manager"
shift
;;
--client-version*)
@ -222,6 +213,10 @@ do
OPENNEL_CODE_DIR="${1#*=}"
shift
;;
--pymanager-dir=*)
PYMANAGER_DIR="${1#*=}"
shift
;;
-w|--clean-images-none)
CLEANIMAGENONE=1
shift
@ -230,10 +225,17 @@ do
UPDATEDATA=1
shift
;;
--option-docker-build)
--option-docker-build=*)
DOCKERBUILDOPT="$DOCKERBUILDOPT ${1#*=}"
shift
;;
--option-docker-run=*)
DOCKERRUNOPT="$DOCKERRUNOPT ${1#*=}"
shift
;;
--clear-terminal)
CLEARTERMINAL=1
;;
*)
msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage
@ -337,6 +339,10 @@ then
then
OPENNEL_CODE_DIR="$(dirname $rootdir)/khanat-opennel-code"
fi
if [[ -z "$PYMANAGER_DIR" ]]
then
PYMANAGER_DIR="$(dirname $rootdir)/opennel-pymanager"
fi
if [[ ! (-f $rootdir/$STEP_CONFIGURE_OK) ]]
then
CONFIGUREKHANATSERVER=1
@ -353,9 +359,10 @@ msg_debug "[$(basename $0):$LINENO] generate basic image: $BASICSERVER"
msg_debug "[$(basename $0):$LINENO] localization khanat-ressources : ${KHANAT_RESSOURCES_DIR}"
msg_debug "[$(basename $0):$LINENO] localization khanat-client-data: ${KHANAT_CLIENT_DATA_DIR}"
msg_debug "[$(basename $0):$LINENO] localization opennel-code-client : ${OPENNEL_CODE_DIR}"
msg_debug "[$(basename $0):$LINENO] localization opennel-pymanager : ${PYMANAGER_DIR}"
msg_debug "[$(basename $0):$LINENO] generate khanat image: $KHANATSERVER"
msg_debug "[$(basename $0):$LINENO] launch khanat: $LAUNCHKHANAT"
msg_debug "stop khanat: $STOPKHANAT"
msg_debug "[$(basename $0):$LINENO] stop khanat: $STOPKHANAT"
msg_info "[$(basename $0):$LINENO] check khanat-ressources"
if [[ ! -d ${KHANAT_RESSOURCES_DIR} ]]
@ -460,6 +467,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 \
@ -471,6 +479,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 \
@ -483,12 +493,17 @@ then
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_configure_auto.sh || exit 2
-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 \
@ -500,7 +515,9 @@ then
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_update_auto.sh"
-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 \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
@ -512,13 +529,15 @@ then
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/server/debian/common/:/opt/ext:ro \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_update_auto.sh
-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
if [[ $LAUNCHKHANAT -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] START KHANAT SERVER"
cd $rootdir; docker run -it --hostname=khanat \
cd $rootdir; docker run -it $DOCKERRUNOPT --hostname=khanat \
-u "$(id -u $USERNAME):$(id -g $USERNAME)" \
-v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
@ -530,8 +549,19 @@ 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/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"
if [[ $CLEARTERMINAL -ne 0 ]]
then
clear
tput clear
fi
fi
trap '' EXIT
msg_info "[$(basename $0):$LINENO] END"

View file

@ -35,9 +35,9 @@ declare -i METHODSTARTSERVER=1
declare -i CLEANIMAGENONE=0
declare DOCKERBUILDOPT=""
declare IMAGEGENERICSERVER="opennel/server_generic_debian_jessie_x86_64"
declare IMAGEKHANATSERVER="opennel/serverimage_debian_jessie_x86_64"
declare LOCALBUILDDIR="build/opennel/builder_debian_jessie_x86_64"
declare IMAGEGENERICSERVER="opennel/server_generic_debian_stretch_x86_64"
declare IMAGEKHANATSERVER="opennel/serverimage_debian_stretch_x86_64"
declare LOCALBUILDDIR="build/opennel/builder_debian_stretch_x86_64"
declare DIRCLIENT="Khanat_Linux64"
declare PACKAGECLIENT="smokey_linux64"
declare DIROUTPUT="output/extra"