From 489101ff346f9c933e0ec18d97ce9cd55ec0b509 Mon Sep 17 00:00:00 2001 From: Jerome Sagnole Date: Fri, 15 Sep 2017 22:44:13 +0200 Subject: [PATCH] [Docker] build khanat_client, and prepare package khanat_client - web page to download this package --- .../builder/debian/jessie/i686/build.sh | 4 +- .../builder/debian/jessie/x86_64/Dockerfile | 60 +++++++++++++- .../jessie/x86_64/build-under-docker.sh | 11 ++- .../builder/debian/jessie/x86_64/build.sh | 4 +- .../server/debian/common/configure_apache.sh | 22 +++++ .../server/debian/common/init-khanat.sh | 2 + .../debian/common/prepare_khanat_client.sh | 81 +++++++++++++++++++ .../server/debian/jessie/x86_64/Dockerfile | 2 +- .../debian/jessie/x86_64/Dockerfile.khanat | 1 + .../server/debian/jessie/x86_64/server.sh | 4 +- 10 files changed, 183 insertions(+), 8 deletions(-) create mode 100755 dist/docker/server/debian/common/prepare_khanat_client.sh diff --git a/dist/docker/builder/debian/jessie/i686/build.sh b/dist/docker/builder/debian/jessie/i686/build.sh index 9ef037675..b68f19df2 100755 --- a/dist/docker/builder/debian/jessie/i686/build.sh +++ b/dist/docker/builder/debian/jessie/i686/build.sh @@ -29,6 +29,7 @@ declare DIRBUILD="" declare CLEANDOCKER=0 declare -i CLEANIMAGENONE=0 declare -i AUTODETEC=1 +declare DOCKERBUILDOPT="" declare IMAGEDOCKER="builder_khanat_debian_jessie_i686" declare LOCALBUILDDIR="build/$IMAGEDOCKER" @@ -112,6 +113,7 @@ do ;; -f|--force-create-image) IMAGE=1 + DOCKERBUILDOPT="$DOCKERBUILDOPT --no-cache" shift ;; -j) @@ -216,7 +218,7 @@ EOF if [[ $IMAGE -ne 0 ]] then msg_info "GENERATE DOCKER IMAGE" - cd $rootdir; docker build . -t ${IMAGEDOCKER} \ + cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEDOCKER} \ --file "${basedir}/Dockerfile" || exit 2 fi diff --git a/dist/docker/builder/debian/jessie/x86_64/Dockerfile b/dist/docker/builder/debian/jessie/x86_64/Dockerfile index d4cff01be..c8e1e545d 100644 --- a/dist/docker/builder/debian/jessie/x86_64/Dockerfile +++ b/dist/docker/builder/debian/jessie/x86_64/Dockerfile @@ -34,8 +34,49 @@ RUN apt-get update RUN apt-get dist-upgrade -y RUN DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server -RUN apt-get install -y apache2 php5 libapache2-mod-php5 php5-mysql apache2-utils php5-gd php5-imagick -RUN 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 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 + +RUN apt-get install -y apache2 \ + php5 \ + libapache2-mod-php5 \ + php5-mysql \ + apache2-utils \ + php5-gd \ + php5-imagick + +RUN 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 \ + 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 RUN apt-get install -y wget @@ -48,7 +89,7 @@ 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 Build squish +## 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 @@ -56,3 +97,16 @@ COPY dist/docker/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 diff --git a/dist/docker/builder/debian/jessie/x86_64/build-under-docker.sh b/dist/docker/builder/debian/jessie/x86_64/build-under-docker.sh index 8066006b6..6a36565c6 100755 --- a/dist/docker/builder/debian/jessie/x86_64/build-under-docker.sh +++ b/dist/docker/builder/debian/jessie/x86_64/build-under-docker.sh @@ -42,7 +42,16 @@ fi echo "$(date "+%Y/%m/%d %H:%M:%S") BUILD START" >> $LOGFILE -cd ${DIRBUILD}; cmake -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON ${CMAKEOPTS} ../.. 1>>$LOGFILE 2>&1 || exit 2 +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} \ + ../.. 1>>$LOGFILE 2>&1 || exit 2 cd ${DIRBUILD}; make $MAKEOPTS 1>>$LOGFILE 2>&1 || exit 2 diff --git a/dist/docker/builder/debian/jessie/x86_64/build.sh b/dist/docker/builder/debian/jessie/x86_64/build.sh index 61825b040..d2ccf57b5 100755 --- a/dist/docker/builder/debian/jessie/x86_64/build.sh +++ b/dist/docker/builder/debian/jessie/x86_64/build.sh @@ -29,6 +29,7 @@ declare DIRBUILD="" declare CLEANDOCKER=0 declare -i CLEANIMAGENONE=0 declare -i AUTODETEC=1 +declare DOCKERBUILDOPT="" declare IMAGEDOCKER="builder_khanat_debian_jessie_x86_64" declare LOCALBUILDDIR="build/$IMAGEDOCKER" @@ -114,6 +115,7 @@ do ;; -f|--force-create-image) IMAGE=1 + DOCKERBUILDOPT="$DOCKERBUILDOPT --no-cache" shift ;; -j) @@ -222,7 +224,7 @@ EOF if [[ $IMAGE -ne 0 ]] then msg_info "GENERATE DOCKER IMAGE" - cd $rootdir; docker build . -t ${IMAGEDOCKER} \ + cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEDOCKER} \ --file "${basedir}/Dockerfile" || exit 2 fi diff --git a/dist/docker/server/debian/common/configure_apache.sh b/dist/docker/server/debian/common/configure_apache.sh index 9b7fd2c3c..3d4dd2fe2 100755 --- a/dist/docker/server/debian/common/configure_apache.sh +++ b/dist/docker/server/debian/common/configure_apache.sh @@ -31,6 +31,7 @@ source /home/gameserver/.bashrc # Create directory use for patch server #mkdir -p $KHANAT_PATH/khanatweb/public_php/ mkdir -p $PATCH_CLIENT_SYSTEM/patch_game/patch +mkdir -p $KHANAT_HOME/client_service/ # configure apache cat << EOF > /etc/apache2/sites-available/000-default.conf @@ -128,6 +129,27 @@ EOF # Activate & deploy new configuration a2enconf patch_service.conf +# Configuration de la page client +cat << EOF > /etc/apache2/conf-available/client_service.conf +Alias /client /home/gameserver/client_service + + Options FollowSymLinks + DirectoryIndex index.html + + Require all granted + + + AddType application/tar .tar.gz + + + SetHandler application/tar + + + +EOF + +# Activate & deploy new configuration +a2enconf client_service.conf # Restart apache service apache2 restart || exit 2 diff --git a/dist/docker/server/debian/common/init-khanat.sh b/dist/docker/server/debian/common/init-khanat.sh index 53c43ac87..1e32786ed 100755 --- a/dist/docker/server/debian/common/init-khanat.sh +++ b/dist/docker/server/debian/common/init-khanat.sh @@ -24,6 +24,8 @@ /opt/configure_database.sh || exit 2 /opt/initialize_khanat_server.sh || exit 2 /opt/initialize_patch_server.sh || exit 2 +/opt/prepare_khanat_client.sh || exit 2 + # # Stop All diff --git a/dist/docker/server/debian/common/prepare_khanat_client.sh b/dist/docker/server/debian/common/prepare_khanat_client.sh new file mode 100755 index 000000000..147f97ef6 --- /dev/null +++ b/dist/docker/server/debian/common/prepare_khanat_client.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# +# Script to create package khanat_client +# 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 . + +echo "PREPARE PACKAGE KHANAT CLIENT" + +# Load Environment +export KHANAT_CLIENT_VERSION=1 +if [[ ! -f /home/gameserver/.bashrc ]] +then + echo "ERROR - missing /home/gameserver/.bashrc" + exit 2 +fi +source /home/gameserver/.bashrc + +declare DIRCLIENT="Khanat_Linux64" +declare HOME_PREPARE_CLIENT="$KHANAT_HOME/prepare_client/$DIRCLIENT" +declare HOME_CLIENT="$KHANAT_HOME/client_service" + +# Create directory +mkdir -p $HOME_PREPARE_CLIENT || exit 2 +mkdir -p $HOME_PREPARE_CLIENT/{data,cfg,save,user,cache} || exit 2 +mkdir -p $HOME_CLIENT || exit 2 + +# Copy all data +cp /usr/local/games/khanat_client $HOME_PREPARE_CLIENT/. || exit 2 +cp /usr/local/etc/ryzom/client_default.cfg $HOME_PREPARE_CLIENT/. || exit 2 +sed -i -r 's/PatchWanted = 0;/PatchWanted = 1;/g' $HOME_PREPARE_CLIENT/client_default.cfg || exit 2 + +cp $PATCH_HOME/patch_service/patch_game/bnp/kh_translate_{wk,fr,en}.bnp $HOME_PREPARE_CLIENT/data/. || exit 2 +cp $PATCH_HOME/patch_service/dataserver/client/exedll_linux64/khanat.png $HOME_PREPARE_CLIENT/data/. || exit 2 +cp $PATCH_HOME/patch_service/dataserver/data/fonts.bnp $HOME_PREPARE_CLIENT/data/. || exit 2 +cp $PATCH_HOME/patch_service/patch_game/bnp/kh_interfaces.bnp $HOME_PREPARE_CLIENT/data/. || exit 2 +cp $PATCH_HOME/patch_service/patch_game/bnp/ryz_zzz_bazaar.bnp $HOME_PREPARE_CLIENT/data/. || exit 2 +cp $PATCH_HOME/khanat/client/cfg/* $HOME_PREPARE_CLIENT/cfg/. || exit 2 + +# TODO - we need search where are define some files +# .DS_Store : function ? +# khanat_install_desktop_menu.sh : script to install khanat on desktop +# khanat.desktop.in : config desktop for khanat +# khanat_install_desktop_menu.sh : script to uninstall khanat on desktop + +# Generate package +#(cd $PATCH_HOME/..; 7z a smokey_linux64.7z $DIRCLIENT) +(cd $HOME_PREPARE_CLIENT/..; tar cfz $HOME_CLIENT/smokey_linux64.tar.gz $DIRCLIENT) + +# create index for client +cat << EOF > $HOME_CLIENT/index.html + + + +KHANAT CLIENT + + + +

You can download khanat client

+khanat client + + + +EOF +chown -R gameserver:www-data $HOME_CLIENT + +################################# +# +################################# + diff --git a/dist/docker/server/debian/jessie/x86_64/Dockerfile b/dist/docker/server/debian/jessie/x86_64/Dockerfile index cf3c8d1b3..b68e93099 100644 --- a/dist/docker/server/debian/jessie/x86_64/Dockerfile +++ b/dist/docker/server/debian/jessie/x86_64/Dockerfile @@ -26,7 +26,7 @@ RUN apt-get dist-upgrade -y RUN apt-get install -y curl nano vim less bash-completion cron logrotate bsd-mailx RUN apt-get install -y openssh-server sudo net-tools -RUN apt-get install -y lzma xdelta +RUN apt-get install -y lzma xdelta p7zip p7zip-full # adding account gameserver, password khanat RUN useradd -G sudo,www-data -c /home -d /home/gameserver -c "Khanat account GAME" -m -p '$6$nxHX/3u.$azS0.eldpfKqxqOLDjgZj8.hPOLC64arXDTUVX0fs7RZvRBX/pNqPzDR89ccP5XkEE/daOyaD3wVtDGDUND5b/' -s /bin/bash -U gameserver diff --git a/dist/docker/server/debian/jessie/x86_64/Dockerfile.khanat b/dist/docker/server/debian/jessie/x86_64/Dockerfile.khanat index 803305447..1de6502d1 100644 --- a/dist/docker/server/debian/jessie/x86_64/Dockerfile.khanat +++ b/dist/docker/server/debian/jessie/x86_64/Dockerfile.khanat @@ -33,6 +33,7 @@ COPY dist/docker/server/debian/common/configure_database.sh /opt/ COPY dist/docker/server/debian/common/initialize_khanat_server.sh /opt/ COPY dist/docker/server/debian/common/initialize_patch_server.sh /opt/ COPY dist/docker/server/debian/common/prepare_start_server.sh /opt/ +COPY dist/docker/server/debian/common/prepare_khanat_client.sh /opt/ COPY ryzomcore.tar.gz /opt/ COPY ryzom-ressources.tar.gz /opt/ diff --git a/dist/docker/server/debian/jessie/x86_64/server.sh b/dist/docker/server/debian/jessie/x86_64/server.sh index 4d9816ccd..2082ced4e 100755 --- a/dist/docker/server/debian/jessie/x86_64/server.sh +++ b/dist/docker/server/debian/jessie/x86_64/server.sh @@ -34,6 +34,7 @@ declare -i KHANAT_CLIENT_VERSION=1 declare -i SHOWIPKHANATSERVER=0 declare -i METHODSTARTSERVER=1 declare -i CLEANIMAGENONE=0 +declare DOCKERBUILDOPT="" declare IMAGEGENERICSERVER="server_generic_debian_jessie_x86_64" declare IMAGEKHANATSERVER="server_khanat_debian_jessie_x86_64" @@ -134,6 +135,7 @@ do ;; -b|--force-basic) BASICSERVER=1 + DOCKERBUILDOPT="$DOCKERBUILDOPT --no-cache" shift ;; -n|--no-launch-khanat) @@ -377,7 +379,7 @@ fi if [[ $BASICSERVER -ne 0 ]] then msg_info "GENERATE DOCKER IMAGE BASIC SERVER" - cd $rootdir; docker build . -t ${IMAGEGENERICSERVER} \ + cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \ --file "${basedir}/Dockerfile" || exit 2 fi