Compare commits

..

60 commits

Author SHA1 Message Date
17d08d6226 adding phpmyadmin on apache configuration 2019-10-24 20:23:50 +02:00
6cf69b86ef adding buster image 2019-10-24 19:02:40 +02:00
efd7f0d1a0 change package name opennel-manager 2018-10-14 02:15:05 +02:00
59950176f2 remove double install opennel-manager 2018-10-14 01:35:37 +02:00
4be4444a2f update view Opennel Manager and change terminal header 2018-10-11 00:48:24 +02:00
22937b5bae change package opennel-maanger 2018-10-09 20:55:36 +02:00
7821c8a07a update version opennel-manager 2018-10-09 18:57:07 +02:00
06880da7b6 update server to use new functionnality openal-manager 2018-10-09 18:03:04 +02:00
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
48 changed files with 3074 additions and 1520 deletions

188
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,188 @@
# 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'
# gitlab-runner exec docker --timeout=3600 --kubernetes-memory-limit="10g" --kubernetes-service-memory-limit="10g" --kubernetes-memory-request="10g" --kubernetes-helper-memory-limit="10g" --docker-volumes $PWD/builds:/builds 'Linux server debian buster 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/opennel-manager-*.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
- ls /opt/artefacts/dist/
- pip3 install /opt/artefacts/dist/opennel_manager-*.whl
# 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
when: manual
Linux server debian buster build:
stage: build
tags:
- Docker
image: amd64/debian:10
script:
- export -p WORKDIR=$PWD
- apt-get update
- apt-get dist-upgrade -y
- DEBIAN_FRONTEND=noninteractive apt-get install -y curl nano vim less bash-completion cron logrotate bsd-mailx openssh-server sudo net-tools lzma xdelta p7zip p7zip-full default-mysql-server apache2 php libapache2-mod-php php-mysql apache2-utils php-gd php-imagick rrdtool screen mcrypt python3 gdb valgrind electric-fence python3-pip python3-bcrypt python3-pip ddd libc6 libgnutls28-dev libgnutlsxx28 php7.3-curl php7.3-mbstring patch gcc make autoconf libc-dev pkg-config libmcrypt-dev php-pear php7.3-dev wget jq git unzip
- pecl install mcrypt-1.0.2
- sed -i 's/;extension=xsl/extension=mcrypt.so/g' /etc/php/7.3/cli/php.ini
- sed -i 's/;extension=xsl/extension=mcrypt.so/g' /etc/php/7.3/apache2/php.ini
- wget -q https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.tar.gz
- mkdir -p /etc/phpmyadmin /usr/share/phpmyadmin /var/lib/phpmyadmin/tmp
- tar xf phpMyAdmin-4.9.0.1-all-languages.tar.gz -C /usr/share/phpmyadmin --strip 1
- chown -R www-data:www-data /var/lib/phpmyadmin
- cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
- 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_debug-debian_amd64_buster*.zip ; do echo "extract $file"; unzip -q -o $file; done)
- (cd /opt/artefacts ; for file in /opt/download/khanat-client-debian_buster*.zip ; do echo "extract $file"; unzip -q -o $file; done)
- (cd /opt/artefacts ; for file in /opt/download/opennel-manager-*.zip ; do echo "extract $file"; unzip -q -o $file; done)
- mkdir -p /opt/ext
- cp $WORKDIR/server/debian/common/phpmyadmin-apache.conf /opt/
- 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
- ls /opt/artefacts/dist/
- pip3 install /opt/artefacts/dist/opennel_manager-*.whl
# 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-skedelererver.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-buster"
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

@ -29,79 +29,73 @@ FROM amd64/debian:9
MAINTAINER AleaJactaEst
ENV HOSTNAME builder
ENV DEBIAN_FRONTEND noninteractive
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
RUN apt-get update && \
apt-get dist-upgrade -y && \
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 xsltproc rsync
## 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,211 @@
#
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
declare -i REGENERATE_DATABASE=0
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)
--build-dir=<directory> : build directory
--code-dir=<directory> : code source localization
--opennel-pymanager-dir=<directory> : opennel manager localization code
--cxxflags="string" : option to add for C++ builder
--regenerate-database : regenerate database_plr.cpp & database_plr.h (depend of database.xml)
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"
echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $1" >> $LOGFILE
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
;;
--regenerate-database)
REGENERATE_DATABASE=1
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_debug "REGENERATE_DATABASE:$REGENERATE_DATABASE"
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"
rm -f ${DIRBUILD}/*.whl || exit 2
cd /tmp/pymanager; `which python3` setup.py bdist_wheel -d ${DIRBUILD} -b /tmp/pymanager/tmp || exit 2
fi
msg_info "PREPARE BUILD"
cd ${DIRBUILD}; cmake -DWITH_NEL=ON \
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
if [[ $REGENERATE_DATABASE -ne 0 ]]
then
msg_info "GENERATE DATABASE HEADER"
find / -name generate_client_db.xslt 2>/dev/null
cd ${DIRBUILD}/opennel-code/code/ryzom/common/src/game_share; xsltproc --stringparam filename database --stringparam bank PLR --stringparam output header --stringparam side server --output ../../../server/src/entities_game_service/database_plr.h generate_client_db.xslt ../../data_common/database.xml || exit 2
msg_info "GENERATE DATABASE CODE"
cd ${DIRBUILD}/opennel-code/code/ryzom/common/src/game_share; xsltproc --stringparam filename database --stringparam bank PLR --stringparam output cpp --stringparam side server --output ../../../server/src/entities_game_service/database_plr.cpp generate_client_db.xslt ../../data_common/database.xml || exit 2
fi
msg_info "PREPARE BUILD"
msg_debug "cd ${DIRBUILD}; CXXFLAGS="$CXXFLAGS" cmake -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_SYMBOLS=ON -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=ON -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON ${CMAKEOPTS} ${DIRCODEUSE}/code 1>>$LOGFILE 2>&1 "
cd ${DIRBUILD}; CXXFLAGS="$CXXFLAGS" cmake -DWITH_NEL=ON \
-DWITH_STATIC=ON \
-DWITH_STATIC_DRIVERS=ON \
-DWITH_STATIC_EXTERNAL=ON \
@ -57,13 +231,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_info "BUILD START"
msg_debug "make option : $MAKEOPTS"
cd ${DIRBUILD}; VERBOSE=1 make $MAKEOPTS 1>>$LOGFILE 2>&1 || exit 2
fi
trap '' EXIT
msg_info "BUILD END"

View file

@ -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,61 +249,78 @@ 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 ]]
then
msg_info "REMOVE OLD BUILD"
rm -rf ${DIRBUILD}/* || exit 2
rm -rf ${DIRBUILD}/* || exit 2
fi
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:ro \
-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,141 @@
<!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>
<a href="/info.php">info</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,4 @@
<?php
//Call the phpinfo function.
phpinfo();
?>

View file

@ -0,0 +1,251 @@
<!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 split_simple($data, $separator)
{
$pos = strpos($data, $separator);
if ( $pos == false ) {
return $data;
return "";
} else {
return explode($separator, $data, 2);
}
}
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) {
$pos = strpos($line, '#');
list($data, $comment) = split_simple('#', $line);
list($key, $value) = split_simple('=', $data);
$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>Num. launch</th><th>Last line log</th><th>Detail</th></tr>";
ksort($data);
foreach ($data as $key => $value)
{
$state=$value['state'];
$number_launch=$value['number_launch'];
$number_launch=$value['number_launch'];
$last_line=$value['last_line'];
$filter=$value['filter'];
$egs=$value['egs'];
$extra="";
if ( $state == 'started' ) {
$fond = "bgcolor=\"SpringGreen \"";
} else {
$fond = "bgcolor=\"Tomato\"";
}
if ( $filter == 'True' ) {
$extra="$extra <a href=\"/opennelmanager_filter.php?command=$key\">filter</a>";
}
if ( $egs == 'True' ) {
$extra="$extra <a href=\"/opennelmanager_player.php?command=$key\">player</a>";
$extra="$extra <a href=\"/opennelmanager_admin.php?command=$key\">admin</a>";
}
list($type, $command) = explode(':', $key, 2);
echo "<tr><td>$command</td><td><button onclick=\"start('$rooturl', '$key')\">Start</button></td>";
echo "<td><button onclick=\"stop('$rooturl', '$key')\">Stop</button></td><td $fond>$state</td><";
echo "td align=\"right\">$number_launch</td><td align=\"right\">$last_line</td>";
echo "<td><a href=\"/opennelmanager_log.php?command=$key\">log</a> <a href=\"/opennelmanager_config.php?command=$key\">config</a> <a href=\"/opennelmanager_info.php?command=$key\">info</a> $extra</td></tr>";
}
echo "</table></div>";
} else {
echo "<a>OpenNelManager not used</a>";
}
} else {
echo "<a>OpenNelManager not activated</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,177 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Khanat Config</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 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 - ADMIN COMMAND)</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 . "/ADMINCOMMAND";
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = "{\"name\": \"${_GET['command']}\"}";
$headers = array(
"GET /CONFIG 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);
$data = json_decode($result,true);
ksort($data);
if ( $data )
{
echo "<table>";
echo "<tr><th>Line</th>";
foreach ($data as $key => $value)
{
ksort($value);
foreach ($value as $key2 => $value2)
{
echo "<th>$key2</th>";
}
break;
}
echo "</tr>";
foreach ($data as $key => $value)
{
echo "<tr><td>$key</td>";
ksort($value);
foreach ($value as $key2 => $value2)
{
echo "<td align=\"right\">$value2</td>";
}
}
echo "</table></div>";
} else {
echo "<b>No admin command executed</b>";
}
} else {
echo "<a>OpenNelManager not enabled</a>";
}
?>
</p>
<div>
Command line :
<div id='command_shell'>
curl -XGET --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\"}";?>' <?php print $url;?>
</div>
</div>
<p id="info"></p>
</body>
</html>

View file

@ -0,0 +1,158 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Khanat Config</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 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 - CONFIG)</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 . "/CONFIG";
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = "{\"name\": \"${_GET['command']}\"}";
$headers = array(
"GET /CONFIG 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);
$data = json_decode($result,true);
echo "<table>";
echo "<tr><th>Key</th><th>Value</th></tr>";
ksort($data);
foreach ($data as $key => $value)
{
echo "<tr><td>$key</td><td align=\"right\">$value</td>";
}
echo "</table></div>";
} else {
echo "<a>OpenNelManager not enabled</a>";
}
?>
</p>
<div>
Command line :
<div id='command_shell'>
curl -XGET --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\"}";?>' <?php print $url;?>
</div>
</div>
<p id="info"></p>
</body>
</html>

View file

@ -0,0 +1,168 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Khanat Config</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 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 - FILTER)</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 . "/FILTER";
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = "{\"name\": \"${_GET['command']}\"}";
$headers = array(
"GET /CONFIG 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);
$data = json_decode($result,true);
ksort($data);
foreach ($data as $key => $value)
{
echo "<p><div>$key</div>";
echo "<table>";
if ( $value )
{
echo "<tr><th>Key</th><th>Value</th></tr>";
foreach ($value as $key2 => $value2)
{
echo "<tr><td>$key2</td><td align=\"right\">$value2</td>";
}
echo "</table></div>";
} else {
echo "<b>Nothing</b>";
}
echo "</p>";
}
} else {
echo "<a>OpenNelManager not enabled</a>";
}
?>
</p>
<div>
Command line :
<div id='command_shell'>
curl -XGET --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\"}";?>' <?php print $url;?>
</div>
</div>
<p id="info"></p>
</body>
</html>

View file

@ -0,0 +1,158 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Khanat Config</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 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 - INFO)</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 . "/INFO";
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = "{\"name\": \"${_GET['command']}\"}";
$headers = array(
"GET /CONFIG 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);
$data = json_decode($result,true);
echo "<table>";
echo "<tr><th>Key</th><th>Value</th></tr>";
ksort($data);
foreach ($data as $key => $value)
{
echo "<tr><td>$key</td><td align=\"right\">$value</td>";
}
echo "</table></div>";
} else {
echo "<a>OpenNelManager not enabled</a>";
}
?>
</p>
<div>
Command line :
<div id='command_shell'>
curl -XGET --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\"}";?>' <?php print $url;?>
</div>
</div>
<p id="info"></p>
</body>
</html>

View file

@ -0,0 +1,284 @@
<!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) {
$datawithoutcomment = explode('#', $line);
$data = explode('=', $datawithoutcomment[0]);
if ( count($data) >= 2 ) {
list($key, $value) = explode('=', $datawithoutcomment[0], 2);
} else if ( count($data) == 1 ) {
$key = $data[0];
$value = "";
} else {
$key = "";
$value = "";
}
$key = trim($key);
if ( $key == "port" ) {
return trim($value);
}
}
fclose($fp);
}
return "8000";
}
function is_valid_type($type)
{
if ( $type == 'INF' ) { // Information
return true;
} else if ( $type == 'DBG') { // Information
return true;
} else if ( $type == 'WRN') { // Warning
return true;
} else if ( $type == 'ERR') { // Error
return true;
} else if ( $type == 'STT') { // Statistic
return true;
} else if ( $type == 'AST') { // Assert
return true;
} else if ( $type == 'UKN') { // Unknown
return true;
}
return false;
}
$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;
list($date, $hour, $timezone, $typesrc, $addr, $program, $line, $msg, $type) = array('', '', '', '', '', '', '', '', '?');
// 2018/08/03 10:45:36 CEST INF 442b0740 command.cpp 149
$arrayret = explode(' ', $value);
if ( count($arrayret) >= 8 ) {
list($date, $hour, $timezone, $typesrc, $addr, $program, $line, $msg) = explode(' ', $value, 8);
if ( ! is_numeric($line) ) {
if ( is_valid_type($line) ) {
list($date, $hour, $timezone, $data1, $hour1, $kind, $typesrc, $addr, $program, $line, $msg) = explode(' ', $value, 11);
$msg = "[$data1 $hour1 $kind] $msg";
} else {
list($date, $hour, $timezone, $msg) = explode(' ', $value, 4);
$msg = "$msg";
}
} else {
$msg = "$msg";
}
} else if ( count($arrayret) >= 4 ) {
$arrayret = explode(' ', $value, 4);
list($date, $hour, $timezone, $msg) = explode(' ', $value, 4);
} else {
$msg = $value;
}
$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>";
}
?>
<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>
<p>
<br>
Send to STDIN: <input type="text" id="command" value="help" size="100"/>
<input type="submit" value="Submit" onclick="send('<?php echo $rooturl; ?>', 'command');"/>
<br>
<div>
Command line :
<div id='command_shell'>
curl -XPOST --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\", \"action\": \"help\"}";?>' <?php print $rooturl . "/STDIN";?>
</div>
</div>
</p>
<p id="info"></p>
</body>
</html>

View file

@ -0,0 +1,178 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Khanat Config</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 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 - PLAYER)</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 . "/PLAYER";
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = "{\"name\": \"${_GET['command']}\"}";
$headers = array(
"GET /CONFIG 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);
$data = json_decode($result,true);
ksort($data);
if ( $data )
{
echo "<table>";
echo "<tr><th>Player</th>";
foreach ($data as $key => $value)
{
ksort($value);
foreach ($value as $key2 => $value2)
{
echo "<th>$key2</th>";
}
break;
}
echo "</tr>";
foreach ($data as $key => $value)
{
echo "<tr><td>$key</td>";
ksort($value);
foreach ($value as $key2 => $value2)
{
echo "<td align=\"right\">$value2</td>";
}
}
echo "</table></div>";
} else {
echo "<b>No player connected</b>";
}
} else {
echo "<a>OpenNelManager not enabled</a>";
}
?>
</p>
<div>
Command line :
<div id='command_shell'>
curl -XGET --header "content-type: application/json" -d '<?php print "{\"name\": \"${_GET['command']}\"}";?>' <?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

@ -0,0 +1,44 @@
# 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:10
MAINTAINER AleaJactaEst
ENV HOSTNAME basic_server
ENV DISPLAY :0
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update ; \
apt-get dist-upgrade -y ; \
apt-get install -y curl nano vim less bash-completion cron logrotate bsd-mailx openssh-server sudo net-tools lzma xdelta p7zip p7zip-full default-mysql-server apache2 php libapache2-mod-php php-mysql apache2-utils php-gd php-imagick rrdtool screen mcrypt python3 gdb valgrind electric-fence python3-pip python3-bcrypt python3-pip ddd libc6 libgnutls28-dev libgnutlsxx28 php7.3-curl php7.3-mbstring patch
# Install php-mcrypt
RUN apt-get -y install gcc make autoconf libc-dev pkg-config libmcrypt-dev php-pear php7.3-dev; \
pecl install mcrypt-1.0.2
RUN sed -i 's/;extension=xsl/extension=mcrypt.so/g' /etc/php/7.3/cli/php.ini;\
sed -i 's/;extension=xsl/extension=mcrypt.so/g' /etc/php/7.3/apache2/php.ini
# Install phpmyadmin
RUN apt-get -y install wget ;\
wget -q https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.tar.gz ;\
mkdir -p /etc/phpmyadmin /usr/share/phpmyadmin /var/lib/phpmyadmin/tmp ; \
tar xf phpMyAdmin-4.9.0.1-all-languages.tar.gz -C /usr/share/phpmyadmin --strip 1 ; \
chown -R www-data:www-data /var/lib/phpmyadmin ; \
cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php

View file

@ -16,18 +16,22 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
FROM opennel/server_generic_debian_jessie_i686
FROM opennel/server_generic_debian_buster_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 server/debian/common/phpmyadmin-apache.conf /opt/
COPY output/opennel_debian_jessie_i686/khanat_config.sh /opt/khanat_config.sh
COPY output/opennel_debian_buster_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
RUN /opt/servercontainer_init_apache.sh
RUN /opt/servercontainer_init_apache.sh -d
RUN /opt/servercontainer_init_configure_envi.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,25 +33,31 @@ 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_i686"
declare IMAGEKHANATSERVER="opennel/servercontainer_debian_jessie_i686"
declare LOCALBUILDDIR="build/opennel/builder_debian_jessie_i686"
declare DIROUTPUT="output/opennel_debian_jessie_i686"
declare IMAGEGENERICSERVER="opennel/server_generic_debian_buster_x86_64"
declare IMAGEKHANATSERVER="opennel/servercontainer_debian_buster_x86_64"
declare LOCALBUILDDIR="build/opennel/builder_debian_buster_x86_64"
declare DIROUTPUT="output/opennel_debian_buster_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_Linux32"
declare PACKAGECLIENT="smokey_linux32"
declare DIRCLIENT="Khanat_Linux64"
declare PACKAGECLIENT="smokey_linux64"
usage()
{
@ -79,18 +85,18 @@ 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
--jobs=[INTEGER] : Number thread for path_gen
Example :
cd [root Khanat directory]
@ -139,6 +145,8 @@ do
;;
-d|--debug)
DEBUG=1
CONFIGUREAUTO="$CONFIGUREAUTO -d"
UPDATEAUTO="$UPDATEAUTO -d"
shift
;;
--ssh)
@ -179,31 +187,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 +214,10 @@ do
OPENNEL_CODE_DIR="${1#*=}"
shift
;;
--pymanager-dir=*)
PYMANAGER_DIR="${1#*=}"
shift
;;
-w|--clean-images-none)
CLEANIMAGENONE=1
shift
@ -230,10 +226,22 @@ 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
;;
--jobs=*)
CONFIGUREAUTO="$CONFIGUREAUTO $1"
UPDATEAUTO="$UPDATEAUTO $1"
shift
;;
*)
msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage
@ -337,6 +345,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,6 +365,7 @@ 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 "[$(basename $0):$LINENO] stop khanat: $STOPKHANAT"
@ -435,7 +448,9 @@ fi
if [[ $BASICSERVER -ne 0 ]]
then
msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE BASIC SERVER"
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \
#cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \
# --file "${basedir}/Dockerfile" || exit 2
cd $basedir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \
--file "${basedir}/Dockerfile" || exit 2
fi
@ -460,6 +475,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 +487,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/opennel_manager: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,24 +501,31 @@ 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/opennel_manager: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 \
-v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \
-v ${OPENNEL_CODE_DIR}/code/ryzom:/home/gameserver/ext/ryzom-ressources:ro \
-v ${rootdir}/${LOCALBUILDDIR}/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"
-v ${rootdir}/${LOCALBUILDDIR}:/opt/ref/opennel_manager: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 +537,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/opennel_manager: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 +557,20 @@ 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/opennel_manager: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_buster_x86_64"
declare IMAGEKHANATSERVER="opennel/serverimage_debian_buster_x86_64"
declare LOCALBUILDDIR="build/opennel/builder_debian_buster_x86_64"
declare DIRCLIENT="Khanat_Linux64"
declare PACKAGECLIENT="smokey_linux64"
declare DIROUTPUT="output/extra"

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,30 +48,38 @@ 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
path = /home/gameserver/khanat/server/
# size buffer log for each program launched (number line stdout)
logsize = 1000
logsize = 2000
# buffer size (define value bufsize on subprocess.Popen, this buffer is use before read by manager)
bufsize = 100
activate_filter = yes
size_max_filter = 100
add_filter = "(^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))|(^(.*)(AES client module )(.*)( for service )(?P<Service_up>.*)( is up))|(^(.*)(AES client module )(.*)( of service )(?P<Service_down>.*)( is down)))"
del_filter = "(^(.*)(AES client module )(.*)( for service )(?P<Service_down>.*)( is up))|((^(.*)(AES client module )(.*)( of service )(?P<Service_up>.*)( is down)))"
##############################
# 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
logsize = 2000
activate_filter = yes
size_max_filter = 100
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"
#[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,169 +88,231 @@ 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
# keep some data on array/dict state
# activate_filter = yes
# size array/dict state
size_max_filter = 1000
# search regex to add state (python regex)
# "^((.*)(setActiveCharForPlayer).*(: set active char )[\d]+( for )(?P<ActivePlayer>.*)|(.*)(disconnectPlayer)(.+:.+<.+>){0,1}[\s]+(?P<InactivePlayer>.*)[\s]+(is disconnected))"
# add_filter = "^(.*)(setActiveCharForPlayer).*(: set active char )[\d]+( for )(?P<ActivePlayer>.*)"
# search regex to del state (python regex)
# del_filter = "^(.*)(disconnectPlayer).+[\s]+(?P<ActivePlayer>.*)[\s]+(is disconnected)"
# add_filter = "^(.*)(setActiveCharForPlayer)(.*)(: set active char )[\d]+( for )(?P<ActivePlayer>.*)"
# del_filter = "^(.*)(disconnectPlayer).+[\s]+(?P<ActivePlayer>.*)[\s]+(is disconnected)"
# add_filter = "^((.*)(setActiveCharForPlayer).*(: set active char )[\d]+( for )(?P<ActivePlayer>.*)|(.*)(disconnectPlayer)(.+:.+<.+>){0,1}[\s]+(?P<InactivePlayer>.*)[\s]+(is disconnected))"
# del_filter = "^((.*)(setActiveCharForPlayer).*(: set active char )[\d]+( for )(?P<InactivePlayer>.*)|(.*)(disconnectPlayer)(.+:.+<.+>){0,1}[\s]+(?P<ActivePlayer>.*)[\s]+(is disconnected))"
# autostart (when start OpenNelManager, launch this program)
autostart = yes
# restart after crash
restart_after_crash = yes
# Delay after each restart (second)
restart_delay = 10
egs_filter = yes
activate_filter = yes
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"
##############################
# 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)
logsize = 1000
logsize = 2000
activate_filter = yes
size_max_filter = 100
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"
##############################
# 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)
logsize = 1000
logsize = 2000
activate_filter = yes
size_max_filter = 100
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"
##############################
# 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)
logsize = 1000
logsize = 2000
activate_filter = yes
size_max_filter = 100
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"
##############################
# 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)
logsize = 1000
logsize = 2000
activate_filter = yes
size_max_filter = 100
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"
##############################
# 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)
logsize = 1000
logsize = 2000
activate_filter = yes
size_max_filter = 100
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"
##############################
# 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)
logsize = 1000
logsize = 2000
activate_filter = yes
size_max_filter = 100
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"
##############################
# 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)
logsize = 1000
logsize = 2000
activate_filter = yes
size_max_filter = 100
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"
##############################
# 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)
logsize = 1000
logsize = 2000
activate_filter = yes
size_max_filter = 100
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"
##############################
# 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)
logsize = 1000
logsize = 2000
activate_filter = yes
size_max_filter = 100
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"
##############################
# 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)
logsize = 1000
logsize = 2000
activate_filter = yes
size_max_filter = 100
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"
##############################
# 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)
logsize = 1000
logsize = 2000
activate_filter = yes
size_max_filter = 100
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"
##############################
# 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
logsize = 2000
activate_filter = yes
size_max_filter = 100
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"
# [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
# logsize = 2000
# [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)
# logsize = 1000
# logsize = 2000
##############################
# 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)
logsize = 1000
logsize = 2000
activate_filter = yes
size_max_filter = 100
add_filter = "^((.*)(main )(.*)( : SERVICE: Service )(?P<Name>.*))"

View file

@ -0,0 +1,60 @@
# phpMyAdmin default Apache configuration
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
<IfModule mod_php5.c>
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
</IfModule>
<FilesMatch ".+\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
php_admin_value mbstring.func_overload 0
</IfModule>
<IfModule mod_php.c>
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
</IfModule>
<FilesMatch ".+\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
php_admin_value mbstring.func_overload 0
</IfModule>
</Directory>
# Authorize for setup
<Directory /usr/share/phpmyadmin/setup>
<IfModule mod_authz_core.c>
<IfModule mod_authn_file.c>
AuthType Basic
AuthName "phpMyAdmin Setup"
AuthUserFile /etc/phpmyadmin/htpasswd.setup
</IfModule>
Require valid-user
</IfModule>
</Directory>
# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/templates>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
Require all denied
</Directory>

View file

@ -16,14 +16,56 @@
# 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
/opt/ext/servercontainer_configure_mysql.sh || exit 2
declare DEBUG=""
usage()
{
cat << EOF
usage:$0 [options]
Configure Patch Server
options:
-h, --help : Show this help
-d, --debug : Show debug message
--jobs=[INTEGER] : Number thread for path_gen
EOF
}
while test $# -gt 0
do
case "$1" in
-h|--help)
usage
exit 1
;;
-d|--debug)
DEBUG="-d"
shift
;;
--client-dir=*)
DIRCLIENT="${1#*=}"
shift
;;
--jobs=*)
MULTITHREAD="$1"
shift
;;
*)
msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage
exit 1
;;
esac
done
/opt/ext/servercontainer_configure_link.sh $DEBUG || exit 2
/opt/ext/servercontainer_configure_mysql.sh $DEBUG || exit 2
sync
/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' gameserver || exit 2
su -c '/opt/ext/servercontainer_configure_launcher.sh' gameserver || exit 2
/opt/ext/servercontainer_configure_apache.sh $DEBUG || exit 2
/opt/ext/servercontainer_configure_world.sh $DEBUG || exit 2
su -c "/opt/ext/servercontainer_configure_khanat.sh $DEBUG" gameserver || exit 2
su -c "/opt/ext/servercontainer_configure_patch.sh $DEBUG $MULTITHREAD" gameserver || exit 2
su -c "/opt/ext/servercontainer_configure_launcher.sh $DEBUG" gameserver || exit 2
su -c 'touch /home/gameserver/khanat/step_configure.ok' gameserver || exit 2
sync
exit 0

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,27 @@ fi
source /home/gameserver/.bashrc
####################################
# opennel-pymanager
####################################
msg_info "[$(basename $0):$LINENO] install/update opennel-pymanager"
last_pymanager_package=$(ls /opt/ref/opennel_manager/opennel_manager*.whl | sort -r | 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_error "[$(basename $0):$LINENO] no package opennel-pymanager"
find / -name "opennel_manager*.whl"
exit 3
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,6 +156,7 @@ 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
# create_link '/home/gameserver/ext/ryzom-ressources/common/data_common/database.xml' /home/gameserver/ext/khanat-client-data/data/kh_shard/kh_server/ || exit 2
####################################
# Link configuration
@ -176,10 +177,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

@ -91,14 +91,12 @@ msg_debug "Configure Log"
mkdir -p /home/gameserver/log/mysql || exit 2
chown -R gameserver:$(id -g -n gameserver) /home/gameserver/log || exit 2
####################################
# Install Database
####################################
msg_debug "Install Database"
/usr/bin/mysql_install_db --user=gameserver --skip-name-resolve || exit 2
####################################
# Start Database
####################################
@ -125,7 +123,13 @@ sleep 1
msg_debug "configure password root for database"
/usr/bin/mysqladmin -u root password '' || exit 2
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
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

@ -29,6 +29,8 @@ usage:$0 [options]
options:
-h, --help : Show this help
-d, --debug : Show debug message
--client-dir=[PATH] : Localization client data
--jobs=[INTEGER] : Number thread for path_gen
EOF
}
@ -50,6 +52,14 @@ do
set_debug 1
shift
;;
--client-dir=*)
DIRCLIENT="${1#*=}"
shift
;;
--jobs=*)
MULTITHREAD="$1"
shift
;;
*)
msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage
@ -237,6 +247,15 @@ wait_all_job || exit 2
####################################
msg_info "[$(basename $0):$LINENO] Prepare Patch"
patch_gen --help | grep '\-\-jobs' 1>/dev/null || MULTITHREAD=""
tar cvzf /home/gameserver/khanat/patch_data.tar.gz $PATCH_CLIENT_SYSTEM
# 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
@ -284,7 +303,7 @@ echo -n "$KHANAT_CLIENT_VERSION" > $PATCH_CLIENT_SYSTEM/patch_game/Lirria.versi
# prepare patch
####################################
msg_info "[$(basename $0):$LINENO] Generate patch"
cd $PATCH_CLIENT_SYSTEM; patch_gen updateProduct patch_game/ryzom.xml 2>$KHANAT_HOME/log/configure/patch_${KHANAT_CLIENT_VERSION}_updateProduct.err 1>$KHANAT_HOME/log/configure/patch_${KHANAT_CLIENT_VERSION}_updateProduct.out || exit 2
cd $PATCH_CLIENT_SYSTEM; patch_gen $MULTITHREAD updateProduct patch_game/ryzom.xml 2>$KHANAT_HOME/log/configure/patch_${KHANAT_CLIENT_VERSION}_updateProduct.err 1>$KHANAT_HOME/log/configure/patch_${KHANAT_CLIENT_VERSION}_updateProduct.out || exit 2
####################################
# Edit release note
@ -292,7 +311,15 @@ cd $PATCH_CLIENT_SYSTEM; patch_gen updateProduct patch_game/ryzom.xml 2>$KHANAT_
msg_info "[$(basename $0):$LINENO] Edit release note"
# Added files for version
REALVERSION=$(awk '{if($0 ~ /patch_gen_common.cpp 330 addVersion <Unknown> : Added files for version:/){print $12}}' $KHANAT_HOME/log/configure/patch_${KHANAT_CLIENT_VERSION}_updateProduct.out)
REALVERSION=$(awk '{if($0 ~ /patch_gen_common.cpp [0-9]+ addVersion <Unknown> : Added files for version:/){print $12}}' $KHANAT_HOME/log/configure/patch_${KHANAT_CLIENT_VERSION}_updateProduct.out)
if [[ -z "$REALVERSION" ]]
then
REALVERSION=$(awk '{if($0 ~ /patch_gen_common.cpp [0-9]+ addVersion [a-zA-Z0-9_]+ : Added files for version:/){print $12}}' $KHANAT_HOME/log/configure/patch_${KHANAT_CLIENT_VERSION}_updateProduct.out | head -n 1)
fi
if [[ -z "$REALVERSION" ]]
then
msg_critical "[$(basename $0):$LINENO] IMPOSSIBLE TO DETECT CLIENT VERSION REAL"
fi
msg_info "[$(basename $0):$LINENO] CLIENT VERSION REAL: $REALVERSION"
cat << EOF > $PATCH_CLIENT_SYSTEM/patch_game/patch/index.php

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,16 +249,24 @@ 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"
####################################
# configure default nel.permission (use when we create account)
# OPEN (1), DEV (2), RESTRICTED (4) 1 + 2 + 4 = 7
####################################
msg_debug "[$(basename $0):$LINENO] Update default permission"
mysql -u root -e "use nel_ams_lib;
UPDATE settings SET Value = 7 WHERE settings.Setting = 'Domain_Auto_Add';
" || msg_critical "[$(basename $0):$LINENO] mysql - Update default permission"
####################################
# Stop Database & apache
####################################
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

@ -80,11 +80,43 @@ sed -i -r 's/^LogLevel[[:space:]]+warn/LogLevel debug/g' /etc/apache2/apache2.co
# configure phpmyadmin
####################################
msg_debug "configure phpmyadmin"
ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf || exit 2
a2enconf phpmyadmin.conf || exit 2
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
if [[ -f /etc/phpmyadmin/apache.conf ]]
then
ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf || exit 2
elif [[ -f /opt/phpmyadmin-apache.conf ]]
then
ln -s /opt/phpmyadmin-apache.conf /etc/apache2/conf-available/phpmyadmin.conf || exit 2
else
echo "Error - Missing configuration phpmyadmin for apache" >&2
exit 2
fi
a2enconf phpmyadmin.conf || exit 2
if [[ -f /etc/phpmyadmin/config.inc.php ]]
then
msg_debug "configure phpmyadmin /etc/phpmyadmin/config.inc.php"
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
elif [[ -f /usr/share/phpmyadmin/config.inc.php ]]
then
msg_debug "configure phpmyadmin /usr/share/phpmyadmin/config.inc.php"
sed -i "s/.*\$cfg\['Servers'\]\[\$i\]\['AllowNoPassword'\] =.*;/\$cfg\['Servers'\]\[\$i\]\['AllowNoPassword'\] = true;/g" /usr/share/phpmyadmin/config.inc.php || exit 2
elif [[ -f /usr/share/phpmyadmin/setup/frames/config.inc.php ]]
then
msg_debug "configure phpmyadmin /usr/share/phpmyadmin/setup/frames/config.inc.php"
cp /usr/share/phpmyadmin/setup/frames/config.inc.php /etc/phpmyadmin/config.inc.php || exit 2
echo "\$cfg['Servers'][\$i]['AllowNoPassword'] = TRUE;" >> /etc/phpmyadmin/config.inc.php || exit 2
else
echo "Error - Impossible to configure AllowNoPassword for phpMyAdmin" >&2
exit 2
fi
####################################
# 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 +126,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,14 +134,15 @@ 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
ServerName lirria.khaganat.net
ServerAdmin webmaster@localhost
DocumentRoot /home/gameserver/khanat/khanatweb/public_php/
ServerAdmin webmaster@localhost
DocumentRoot /home/gameserver/rootweb/
ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined
ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# Khanat Server Web
@ -119,13 +152,13 @@ cat << EOF > /etc/apache2/sites-available/000-default.conf
AllowOverride None
Require all granted
</Directory>
ServerName lirria.khaganat.net
ServerName lirria.khaganat.net
ServerAdmin admin@localhost
DocumentRoot /home/gameserver/khanat/khanatweb/public_php
ServerAdmin admin@localhost
DocumentRoot /home/gameserver/khanat/khanatweb/public_php
ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined
ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# Patch Server
@ -133,11 +166,11 @@ cat << EOF > /etc/apache2/sites-available/000-default.conf
ServerName lirria.khaganat.net
DocumentRoot /home/gameserver/khanat/patch_service/patch_game/patch/
<Directory "/home/gameserver/khanat/patch_service/patch_game/patch">
<Directory "/home/gameserver/khanat/patch_service/patch_game/patch">
Options -Indexes
AllowOverride All
Require all granted
</Directory>
</Directory>
</VirtualHost>
EOF

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,33 @@ 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)
---------------------------------------------------
log khanat server : /home/gameserver/khanat/server/log/log.log
***************************************************
ENDOFCOMMENT
EOF
####################################
@ -192,12 +219,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 +235,50 @@ EOF
msg_debug "Configure banner"
cat << EOF > /etc/motd
***************************************************
connect to root use gameserver account and launch sudo command
like :
sudo bash
---------------------------------------------------
mysql : account root (no password)
---------------------------------------------------
log khanat server : /home/gameserver/khanat/server/log/log.log
***************************************************
EOF
# After Login and on gameserver (can use bash and other command)
# Bash_profile
cat << EOF > /home/gameserver/.bash_profile
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)
---------------------------------------------------
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,31 @@ 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
sed -i -r 's/^\[mysqld\]/[mysqld]\nsql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"/g' $1 || exit 2
else
msg_debug "nothing for $1"
fi
}
#####################
# MAIN
#####################
@ -66,22 +91,24 @@ 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
mkdir -p /home/gameserver/database/ || exit 2
chown gameserver:$(id -g -n gameserver) /home/gameserver/database/ || exit 2
mkdir -p /home/gameserver/log/mysql || 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
@ -23,130 +25,59 @@ usage:$0 [options]
Prepare and launch server khanat
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
-h, --help : Show this help
-d, --debug : Show debug message
--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,55 @@ 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 ]]
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
msg_debug "start with OpenNelManager"
touch /home/gameserver/opennelmanager.flag
# Copy file (if original is link)
if [[ -L /home/gameserver/khanat/server/common.cfg ]]
then
mv /home/gameserver/khanat/server/common.cfg /home/gameserver/khanat/server/common.cfg.ref
cp /home/gameserver/khanat/server/common.cfg.ref /home/gameserver/khanat/server/common.cfg
fi
# Disable Color
grep -e '^StdDisplayerColor' /home/gameserver/khanat/server/common.cfg >/dev/null
if [[ $? -eq 0 ]]
then
sed -i 's/StdDisplayerColor.*/StdDisplayerColor = 0;/g' /home/gameserver/khanat/server/common.cfg
else
echo -en "\n// ---- Disable color\nStdDisplayerColor = 0;\n" >> /home/gameserver/khanat/server/common.cfg
fi
# Enable debug message
grep -e '^DisableNLDebug' /home/gameserver/khanat/server/common.cfg >/dev/null
if [[ $? -eq 0 ]]
then
sed -i 's/DisableNLDebug.*/DisableNLDebug = 0;/g' /home/gameserver/khanat/server/common.cfg
else
echo -en "\n// ---- Enable debug\nDisableNLDebug = 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
bash
#screen -t terminal /bin/bash -l
/bin/bash -l
else
msg_error 'Bad option'
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,55 @@
# 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
--jobs=[INTEGER] : Number thread for path_gen
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
;;
--jobs=*)
MULTITHREAD="$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 $MULTITHREAD" 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,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

@ -16,19 +16,15 @@
# 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
ENV DISPLAY :0
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 ddd libmariadbclient18

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_x86_64
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,18 @@ 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
--jobs=[INTEGER] : Number thread for path_gen
Example :
cd [root Khanat directory]
@ -139,6 +145,8 @@ do
;;
-d|--debug)
DEBUG=1
CONFIGUREAUTO="$CONFIGUREAUTO -d"
UPDATEAUTO="$UPDATEAUTO -d"
shift
;;
--ssh)
@ -179,31 +187,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 +214,10 @@ do
OPENNEL_CODE_DIR="${1#*=}"
shift
;;
--pymanager-dir=*)
PYMANAGER_DIR="${1#*=}"
shift
;;
-w|--clean-images-none)
CLEANIMAGENONE=1
shift
@ -230,10 +226,22 @@ 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
;;
--jobs=*)
CONFIGUREAUTO="$CONFIGUREAUTO $1"
UPDATEAUTO="$UPDATEAUTO $1"
shift
;;
*)
msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage
@ -337,6 +345,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 +365,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 +473,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 +485,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/opennel_manager: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,24 +499,31 @@ 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/opennel_manager: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 \
-v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \
-v ${OPENNEL_CODE_DIR}/code/ryzom:/home/gameserver/ext/ryzom-ressources:ro \
-v ${rootdir}/${LOCALBUILDDIR}/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"
-v ${rootdir}/${LOCALBUILDDIR}:/opt/ref/opennel_manager: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 +535,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/opennel_manager: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 +555,20 @@ 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/opennel_manager: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

@ -17,7 +17,6 @@
# 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
@ -35,13 +34,12 @@ 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 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"
usage()
@ -196,7 +194,7 @@ do
shift
;;
*)
msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
msg_error "options '$1' not recognize"
usage
exit 1
;;
@ -205,7 +203,7 @@ done
function chrashed()
{
msg_error "[$(basename $0):$LINENO] BUILD FAILED (code:$?)"
msg_error "BUILD FAILED (code:$?)"
exit 2
}