mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-22 14:56:13 +00:00
adding script to start server and change directory to build
This commit is contained in:
parent
1cb56e3a20
commit
a7ae2fb306
12 changed files with 1297 additions and 0 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -10,6 +10,9 @@ DebugFast
|
||||||
ReleaseDebugStatic
|
ReleaseDebugStatic
|
||||||
DebugFastStatic
|
DebugFastStatic
|
||||||
|
|
||||||
|
# Compressed file
|
||||||
|
*.tar.gz
|
||||||
|
|
||||||
# Test and application directories
|
# Test and application directories
|
||||||
screenshots
|
screenshots
|
||||||
release
|
release
|
||||||
|
|
48
dist/docker/builder/debian/jessie/i686/Dockerfile
vendored
Normal file
48
dist/docker/builder/debian/jessie/i686/Dockerfile
vendored
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# Dockerfile - Build new package server
|
||||||
|
# Build for server debian-8 (amd64)
|
||||||
|
#
|
||||||
|
# Copyright : GNU/AGPLv3
|
||||||
|
#
|
||||||
|
# Created : 1 AUG 2017
|
||||||
|
# Created by : AleaJactaEst
|
||||||
|
|
||||||
|
# to build :
|
||||||
|
# $ docker build . -t builder_debian_8_i686 --file dist/docker/builder/debian-8-i686/Dockerfile
|
||||||
|
|
||||||
|
# to use this image :
|
||||||
|
# (on root)
|
||||||
|
# $ docker run -it --hostname=builder -v $PWD/dist:/opt/dist -v $PWD/code:/opt/code builder_debian_8_i686 /bin/bash
|
||||||
|
# (with your account)
|
||||||
|
# $ docker run -it --hostname=builder -u "$(id -u $USERNAME):$(id -g $USERNAME)" -v $PWD/dist:/opt/dist -v $PWD/code:/opt/code builder_debian_8_i686 /bin/bash
|
||||||
|
|
||||||
|
FROM debian:8
|
||||||
|
MAINTAINER AleaJactaEst
|
||||||
|
|
||||||
|
ENV HOSTNAME builder
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
RUN apt-get install -y wget
|
||||||
|
|
||||||
|
## 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 Build 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/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
|
41
dist/docker/builder/debian/jessie/i686/build-under-docker.sh
vendored
Executable file
41
dist/docker/builder/debian/jessie/i686/build-under-docker.sh
vendored
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Script to build Khaganat
|
||||||
|
# Copyright : GNU/AGPLv3
|
||||||
|
#
|
||||||
|
# Created : 1 AUG 2017
|
||||||
|
# Created by : AleaJactaEst
|
||||||
|
|
||||||
|
declare DIRBUILD="/opt/code/build/"
|
||||||
|
if [[ -n "$1" ]]
|
||||||
|
then
|
||||||
|
DIRBUILD="$1"
|
||||||
|
fi
|
||||||
|
declare LOGFILE="${DIRBUILD}/build.log"
|
||||||
|
|
||||||
|
function chrashed()
|
||||||
|
{
|
||||||
|
echo "$(date "+%Y/%m/%d %H:%M:%S") BUILD FAILED (code:$?)" >> $LOGFILE
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
trap chrashed EXIT
|
||||||
|
|
||||||
|
mkdir -p ${DIRBUILD}/ || exit 2
|
||||||
|
|
||||||
|
if [[ -f ${DIRBUILD}/envi.sh ]]
|
||||||
|
then
|
||||||
|
echo "$(date "+%Y/%m/%d %H:%M:%S") LOAD ENVI" >> $LOGFILE
|
||||||
|
source ${DIRBUILD}/envi.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$(date "+%Y/%m/%d %H:%M:%S") BUILD START" >> $LOGFILE
|
||||||
|
|
||||||
|
cd ${DIRBUILD}; cmake -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_CLIENT=OFF -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_DRIVER_OPENGL=OFF -DWITH_DRIVER_OPENAL=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_SOUND=OFF ${CMAKEOPTS} .. 1>>$LOGFILE 2>&1 || exit 2
|
||||||
|
|
||||||
|
cd ${DIRBUILD}; make $MAKEOPTS 1>>$LOGFILE 2>&1 || exit 2
|
||||||
|
|
||||||
|
echo "$(date "+%Y/%m/%d %H:%M:%S") PACKAGE" > $LOGFILE
|
||||||
|
cd ${DIRBUILD}; make package 1>>$LOGFILE 2>&1 || exit 2
|
||||||
|
|
||||||
|
trap '' EXIT
|
||||||
|
echo "$(date "+%Y/%m/%d %H:%M:%S") BUILD END" >> $LOGFILE
|
211
dist/docker/builder/debian/jessie/i686/build.sh
vendored
Executable file
211
dist/docker/builder/debian/jessie/i686/build.sh
vendored
Executable file
|
@ -0,0 +1,211 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Script to build under docker
|
||||||
|
#
|
||||||
|
# Copyright : GNU/AGPLv3
|
||||||
|
#
|
||||||
|
# Created : 1 AUG 2017
|
||||||
|
# Created by : AleaJactaEst
|
||||||
|
|
||||||
|
declare -i REMOVE=0
|
||||||
|
declare -i IMAGE=1
|
||||||
|
declare -i BUILD=1
|
||||||
|
declare -i DEBUG=0
|
||||||
|
declare JOBS=""
|
||||||
|
declare CMAKEOPTS=""
|
||||||
|
declare DIRBUILD=""
|
||||||
|
declare CLEANDOCKER=0
|
||||||
|
|
||||||
|
declare IMAGEDOCKER="builder_khanat_jessie_i686"
|
||||||
|
declare LOCALBUILDDIR="build_linux32"
|
||||||
|
declare LOCALSRC="debian/jessie/i686"
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
options:
|
||||||
|
-h, --help : Show this help
|
||||||
|
-d, --debug : Show debug message
|
||||||
|
-r, --remove : Remove old build repository
|
||||||
|
-i, --image-only : Just create image (no build)
|
||||||
|
-b, --build-only : Just build (no create new image)
|
||||||
|
-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
|
||||||
|
|
||||||
|
Example :
|
||||||
|
cd [root Khanat directory]
|
||||||
|
./build.sh -c -r
|
||||||
|
./build.sh -c -r -j 4 -a '-DWITH_SYMBOLS=ON' -a '-DWITH_RYZOM_TOOLS=OFF' -a '-DWITH_NEL_TOOLS=OFF'
|
||||||
|
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 $(dirname $(dirname ${basedir}))))))"
|
||||||
|
|
||||||
|
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
|
||||||
|
;;
|
||||||
|
-i|--image-only)
|
||||||
|
BUILD=0
|
||||||
|
IMAGE=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-b|--build-only)
|
||||||
|
BUILD=1
|
||||||
|
IMAGE=0
|
||||||
|
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
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
msg_error "options '$1' not recoginze"
|
||||||
|
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
|
||||||
|
|
||||||
|
DIRBUILD="${rootdir}/code/${LOCALBUILDDIR}"
|
||||||
|
|
||||||
|
msg_debug "calldir: $calldir"
|
||||||
|
msg_debug "basedir: $basedir"
|
||||||
|
msg_debug "rootdir: $rootdir"
|
||||||
|
msg_debug "JOBS: '$JOBS'"
|
||||||
|
msg_debug "CMAKEOPTS: '$CMAKEOPTS'"
|
||||||
|
|
||||||
|
mkdir -p "${DIRBUILD}"
|
||||||
|
if [[ $REMOVE -ne 0 ]]
|
||||||
|
then
|
||||||
|
msg_info "REMOVE OLD BUILD"
|
||||||
|
rm -rf ${DIRBUILD}/* || exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
touch ${DIRBUILD}/build.log
|
||||||
|
|
||||||
|
cat << EOF > ${DIRBUILD}/envi.sh
|
||||||
|
#!/bin/bash
|
||||||
|
export MAKEOPTS="$JOBS"
|
||||||
|
export CMAKEOPTS="$CMAKEOPTS"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [[ $IMAGE -ne 0 ]]
|
||||||
|
then
|
||||||
|
msg_info "GENERATE DOCKER IMAGE"
|
||||||
|
cd $rootdir; docker build . -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/dist:/opt/dist \
|
||||||
|
-v $rootdir/code:/opt/code \
|
||||||
|
${IMAGEDOCKER} \
|
||||||
|
/opt/dist/docker/builder/${LOCALSRC}/build-under-docker.sh "/opt/code/${LOCALBUILDDIR}/" || 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
|
||||||
|
|
||||||
|
trap '' EXIT
|
||||||
|
msg_info "END"
|
48
dist/docker/builder/debian/jessie/x86_64/Dockerfile
vendored
Normal file
48
dist/docker/builder/debian/jessie/x86_64/Dockerfile
vendored
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# Dockerfile - Build new package server
|
||||||
|
# Build for server debian-8 (amd64)
|
||||||
|
#
|
||||||
|
# Copyright : GNU/AGPLv3
|
||||||
|
#
|
||||||
|
# Created : 1 AUG 2017
|
||||||
|
# Created by : AleaJactaEst
|
||||||
|
|
||||||
|
# to build :
|
||||||
|
# $ docker build . -t builder_debian_8_adm64 --file dist/docker/builder/debian-8-amd64/Dockerfile
|
||||||
|
|
||||||
|
# to use this image :
|
||||||
|
# (on root)
|
||||||
|
# $ docker run -it --hostname=builder -v $PWD/dist:/opt/dist -v $PWD/code:/opt/code builder_debian_8_adm64 /bin/bash
|
||||||
|
# (with your account)
|
||||||
|
# $ docker run -it --hostname=builder -u "$(id -u $USERNAME):$(id -g $USERNAME)" -v $PWD/dist:/opt/dist -v $PWD/code:/opt/code builder_debian_8_adm64 /bin/bash
|
||||||
|
|
||||||
|
FROM amd64/debian:8
|
||||||
|
MAINTAINER AleaJactaEst
|
||||||
|
|
||||||
|
ENV HOSTNAME builder
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get dist-upgrade
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
RUN apt-get install -y wget
|
||||||
|
|
||||||
|
## 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 Build 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/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
|
41
dist/docker/builder/debian/jessie/x86_64/build-under-docker.sh
vendored
Executable file
41
dist/docker/builder/debian/jessie/x86_64/build-under-docker.sh
vendored
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Script to build Khaganat
|
||||||
|
# Copyright : GNU/AGPLv3
|
||||||
|
#
|
||||||
|
# Created : 1 AUG 2017
|
||||||
|
# Created by : AleaJactaEst
|
||||||
|
|
||||||
|
declare DIRBUILD="/opt/code/build/"
|
||||||
|
if [[ -n "$1" ]]
|
||||||
|
then
|
||||||
|
DIRBUILD="$1"
|
||||||
|
fi
|
||||||
|
declare LOGFILE="${DIRBUILD}/build.log"
|
||||||
|
|
||||||
|
function chrashed()
|
||||||
|
{
|
||||||
|
echo "$(date "+%Y/%m/%d %H:%M:%S") BUILD FAILED (code:$?)" >> $LOGFILE
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
trap chrashed EXIT
|
||||||
|
|
||||||
|
mkdir -p ${DIRBUILD}/ || exit 2
|
||||||
|
|
||||||
|
if [[ -f ${DIRBUILD}/envi.sh ]]
|
||||||
|
then
|
||||||
|
echo "$(date "+%Y/%m/%d %H:%M:%S") LOAD ENVI" >> $LOGFILE
|
||||||
|
source ${DIRBUILD}/envi.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$(date "+%Y/%m/%d %H:%M:%S") BUILD START" >> $LOGFILE
|
||||||
|
|
||||||
|
cd ${DIRBUILD}; cmake -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_CLIENT=OFF -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_DRIVER_OPENGL=OFF -DWITH_DRIVER_OPENAL=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_SOUND=OFF ${CMAKEOPTS} .. 1>>$LOGFILE 2>&1 || exit 2
|
||||||
|
|
||||||
|
cd ${DIRBUILD}; make $MAKEOPTS 1>>$LOGFILE 2>&1 || exit 2
|
||||||
|
|
||||||
|
echo "$(date "+%Y/%m/%d %H:%M:%S") PACKAGE" > $LOGFILE
|
||||||
|
cd ${DIRBUILD}; make package 1>>$LOGFILE 2>&1 || exit 2
|
||||||
|
|
||||||
|
trap '' EXIT
|
||||||
|
echo "$(date "+%Y/%m/%d %H:%M:%S") BUILD END" >> $LOGFILE
|
211
dist/docker/builder/debian/jessie/x86_64/build.sh
vendored
Executable file
211
dist/docker/builder/debian/jessie/x86_64/build.sh
vendored
Executable file
|
@ -0,0 +1,211 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Script to build under docker
|
||||||
|
#
|
||||||
|
# Copyright : GNU/AGPLv3
|
||||||
|
#
|
||||||
|
# Created : 1 AUG 2017
|
||||||
|
# Created by : AleaJactaEst
|
||||||
|
|
||||||
|
declare -i REMOVE=0
|
||||||
|
declare -i IMAGE=1
|
||||||
|
declare -i BUILD=1
|
||||||
|
declare -i DEBUG=0
|
||||||
|
declare JOBS=""
|
||||||
|
declare CMAKEOPTS=""
|
||||||
|
declare DIRBUILD=""
|
||||||
|
declare CLEANDOCKER=0
|
||||||
|
|
||||||
|
declare IMAGEDOCKER="builder_khanat_jessie_x86_64"
|
||||||
|
declare LOCALBUILDDIR="build_linux64"
|
||||||
|
declare LOCALSRC="debian/jessie/x86_64"
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
options:
|
||||||
|
-h, --help : Show this help
|
||||||
|
-d, --debug : Show debug message
|
||||||
|
-r, --remove : Remove old build repository
|
||||||
|
-i, --image-only : Just create image (no build)
|
||||||
|
-b, --build-only : Just build (no create new image)
|
||||||
|
-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
|
||||||
|
|
||||||
|
Example :
|
||||||
|
cd [root Khanat directory]
|
||||||
|
./build.sh -c -r
|
||||||
|
./build.sh -c -r -j 4 -a '-DWITH_SYMBOLS=ON' -a '-DWITH_RYZOM_TOOLS=OFF' -a '-DWITH_NEL_TOOLS=OFF'
|
||||||
|
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 $(dirname $(dirname ${basedir}))))))"
|
||||||
|
|
||||||
|
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
|
||||||
|
;;
|
||||||
|
-i|--image-only)
|
||||||
|
BUILD=0
|
||||||
|
IMAGE=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-b|--build-only)
|
||||||
|
BUILD=1
|
||||||
|
IMAGE=0
|
||||||
|
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
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
msg_error "options '$1' not recoginze"
|
||||||
|
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
|
||||||
|
|
||||||
|
DIRBUILD="${rootdir}/code/${LOCALBUILDDIR}"
|
||||||
|
|
||||||
|
msg_debug "calldir: $calldir"
|
||||||
|
msg_debug "basedir: $basedir"
|
||||||
|
msg_debug "rootdir: $rootdir"
|
||||||
|
msg_debug "JOBS: '$JOBS'"
|
||||||
|
msg_debug "CMAKEOPTS: '$CMAKEOPTS'"
|
||||||
|
|
||||||
|
mkdir -p "${DIRBUILD}"
|
||||||
|
if [[ $REMOVE -ne 0 ]]
|
||||||
|
then
|
||||||
|
msg_info "REMOVE OLD BUILD"
|
||||||
|
rm -rf ${DIRBUILD}/* || exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
touch ${DIRBUILD}/build.log
|
||||||
|
|
||||||
|
cat << EOF > ${DIRBUILD}/envi.sh
|
||||||
|
#!/bin/bash
|
||||||
|
export MAKEOPTS="$JOBS"
|
||||||
|
export CMAKEOPTS="$CMAKEOPTS"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [[ $IMAGE -ne 0 ]]
|
||||||
|
then
|
||||||
|
msg_info "GENERATE DOCKER IMAGE"
|
||||||
|
cd $rootdir; docker build . -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/dist:/opt/dist \
|
||||||
|
-v $rootdir/code:/opt/code \
|
||||||
|
${IMAGEDOCKER} \
|
||||||
|
/opt/dist/docker/builder/${LOCALSRC}/build-under-docker.sh "/opt/code/${LOCALBUILDDIR}/" || 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
|
||||||
|
|
||||||
|
trap '' EXIT
|
||||||
|
msg_info "END"
|
91
dist/docker/server/debian/init-basic.sh
vendored
Executable file
91
dist/docker/server/debian/init-basic.sh
vendored
Executable file
|
@ -0,0 +1,91 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
echo "Start Basic"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
/usr/bin/mysql_install_db --user=mysql --skip-name-resolve || exit 2
|
||||||
|
|
||||||
|
# Start the MySQL daemon in the background.
|
||||||
|
/usr/sbin/mysqld &
|
||||||
|
mysql_pid=$!
|
||||||
|
|
||||||
|
until /usr/bin/mysqladmin ping >/dev/null 2>&1
|
||||||
|
do
|
||||||
|
echo -n "."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
# Initialize password root (to empty)
|
||||||
|
/usr/bin/mysqladmin -u root password '' || exit 2
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y 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
|
||||||
|
|
||||||
|
|
||||||
|
# Stop MySQL
|
||||||
|
/usr/bin/mysqladmin shutdown
|
||||||
|
|
||||||
|
# Wait MySQL stop
|
||||||
|
wait $mysql_pid
|
||||||
|
|
||||||
|
# Initialize bashrc (for root)
|
||||||
|
cat << EOF > /root/.bashrc
|
||||||
|
# bashrc: executed by bash(1) for non-login shells.
|
||||||
|
|
||||||
|
# You may uncomment the following lines if you want 'ls' to be colorized:
|
||||||
|
export SHELL=/bin/bash
|
||||||
|
export LS_OPTIONS='--color=auto'
|
||||||
|
eval "\`dircolors\`"
|
||||||
|
alias ls='ls \$LS_OPTIONS'
|
||||||
|
alias ll='ls \$LS_OPTIONS -l'
|
||||||
|
alias l='ls \$LS_OPTIONS -lA'
|
||||||
|
|
||||||
|
# Some more alias to avoid making mistakes:
|
||||||
|
# alias rm='rm -i'
|
||||||
|
# alias cp='cp -i'
|
||||||
|
# alias mv='mv -i'
|
||||||
|
|
||||||
|
# Autocompletion
|
||||||
|
if [ -f /etc/bash_completion ]; then
|
||||||
|
. /etc/bash_completion
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
cat << EOF > /home/compil/.bashrc
|
||||||
|
# bashrc: executed by bash(1) for non-login shells.
|
||||||
|
|
||||||
|
# You may uncomment the following lines if you want 'ls' to be colorized:
|
||||||
|
export SHELL=/bin/bash
|
||||||
|
export LS_OPTIONS='--color=auto'
|
||||||
|
eval "\`dircolors\`"
|
||||||
|
alias ls='ls \$LS_OPTIONS'
|
||||||
|
alias ll='ls \$LS_OPTIONS -l'
|
||||||
|
alias l='ls \$LS_OPTIONS -lA'
|
||||||
|
|
||||||
|
# Some more alias to avoid making mistakes:
|
||||||
|
# alias rm='rm -i'
|
||||||
|
# alias cp='cp -i'
|
||||||
|
# alias mv='mv -i'
|
||||||
|
|
||||||
|
# Autocompletion
|
||||||
|
if [ -f /etc/bash_completion ]; then
|
||||||
|
. /etc/bash_completion
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
chown compil:compil /home/compil/.bashrc
|
||||||
|
|
||||||
|
cat << EOF > /etc/sudoers.d/compil
|
||||||
|
# User privilege specification
|
||||||
|
compil ALL=NOPASSWD: ALL
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "End Basic"
|
258
dist/docker/server/debian/init-khanat.sh
vendored
Executable file
258
dist/docker/server/debian/init-khanat.sh
vendored
Executable file
|
@ -0,0 +1,258 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# /opt/dist/docker/server/init-khanat.sh
|
||||||
|
|
||||||
|
# install new package
|
||||||
|
cd /; tar xvzf /opt/ryzomcore.tar.gz --strip 1 || exit 2
|
||||||
|
cd /opt; tar xvzf ryzom-ressources.tar.gz || exit 2
|
||||||
|
|
||||||
|
# configure environment
|
||||||
|
cat << EOF > /opt/shard.sh
|
||||||
|
export RYHOME=/home/compil
|
||||||
|
export RYZOM_PATH=/home/compil/ryzom
|
||||||
|
export PATH=$PATH:/usr/local/bin:$RYZOM_PATH/tools/scripts/linux
|
||||||
|
export RYDATA=/home/compil/khanat-ressources
|
||||||
|
echo "Environment loaded"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# configure environment
|
||||||
|
cat << EOF > /home/compil/.bashrc
|
||||||
|
export RYHOME=/home/compil
|
||||||
|
export RYZOM_PATH=/home/compil/ryzom
|
||||||
|
export PATH=$PATH:/usr/local/bin:$RYZOM_PATH/tools/scripts/linux
|
||||||
|
export RYDATA=/home/compil/khanat-ressources
|
||||||
|
echo "Environment loaded"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# load environment
|
||||||
|
source /opt/shard.sh
|
||||||
|
mkdir -p $RYHOME $RYZOM_PATH $PATH || exit 2
|
||||||
|
|
||||||
|
mkdir -p $RYDATA/ressources
|
||||||
|
(cd $RYDATA; tar xvzf /opt/khanat-ressources.tar.gz) || exit 2
|
||||||
|
#cp -r /opt/ressources $RYDATA || exit 2
|
||||||
|
|
||||||
|
mkdir -p $RYZOM_PATH/tools/scripts/linux
|
||||||
|
cp -r /opt/code/ryzom/tools/scripts/linux/* $RYZOM_PATH/tools/scripts/linux || exit 2
|
||||||
|
|
||||||
|
# configure ryzom
|
||||||
|
mkdir -p $RYZOM_PATH/server || exit 2
|
||||||
|
cp -r /opt/code/ryzom/common/ $RYZOM_PATH/common || exit 2
|
||||||
|
cp -r /opt/code/ryzom/client/ $RYZOM_PATH/client || exit 2
|
||||||
|
cp /opt/code/ryzom/server/*.cfg $RYZOM_PATH/server/. || exit 2
|
||||||
|
sed -i -r 's/(FSListenHost)(.*)(=)(.*)(;)/FSListenHost = "localhost";/g' $RYZOM_PATH/server/frontend_service.cfg || exit 2
|
||||||
|
sed -i -r 's/(DBHost)(.*)(=)(.*)(;)/DBHost = "localhost";/g' $RYZOM_PATH/server/sql.cfg || exit 2
|
||||||
|
sed -i -r 's/(DBRingName)(.*)(=)(.*)(;)/ DBRingName = "ring_mini01";/g' $RYZOM_PATH/server/sql.cfg || exit 2
|
||||||
|
|
||||||
|
# install web ryzom
|
||||||
|
cp -r /opt/code/web $RYZOM_PATH/ryzomweb || exit 2
|
||||||
|
|
||||||
|
chmod -R a+w $RYZOM_PATH/ryzomweb || exit 2
|
||||||
|
chown -R www-data:www-data $RYZOM_PATH/ryzomweb || exit 2
|
||||||
|
|
||||||
|
# configure apache
|
||||||
|
cat << EOF > /etc/apache2/sites-available/000-default.conf
|
||||||
|
<VirtualHost *:80>
|
||||||
|
<Directory "$RYZOM_PATH/ryzomweb/">
|
||||||
|
Options Indexes FollowSymLinks
|
||||||
|
AllowOverride None
|
||||||
|
Require all granted
|
||||||
|
DirectoryIndex index.php
|
||||||
|
AddType text/html .php .phps
|
||||||
|
AddHandler application/x-httpd-php .php
|
||||||
|
AddHandler application/x-httpd-php-source .phps
|
||||||
|
</Directory>
|
||||||
|
ServerName lirria.khaganat.net
|
||||||
|
|
||||||
|
ServerAdmin webmaster@localhost
|
||||||
|
DocumentRoot $RYZOM_PATH/ryzomweb/public_php/
|
||||||
|
|
||||||
|
ErrorLog \${APACHE_LOG_DIR}/error.log
|
||||||
|
CustomLog \${APACHE_LOG_DIR}/access.log combined
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
<VirtualHost *:40916>
|
||||||
|
<Directory "$RYZOM_PATH/ryzomweb/">
|
||||||
|
Options Indexes FollowSymLinks
|
||||||
|
AllowOverride None
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
ServerName lirria.khaganat.net
|
||||||
|
|
||||||
|
ServerAdmin admin@localhost
|
||||||
|
DocumentRoot $RYZOM_PATH/ryzomweb/public_php
|
||||||
|
|
||||||
|
ErrorLog \${APACHE_LOG_DIR}/error.log
|
||||||
|
CustomLog \${APACHE_LOG_DIR}/access.log combined
|
||||||
|
</VirtualHost>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat << EOF > /etc/apache2/ports.conf
|
||||||
|
# If you just change the port or add more ports here, you will likely also
|
||||||
|
# have to change the VirtualHost statement in
|
||||||
|
# /etc/apache2/sites-enabled/000-default.conf
|
||||||
|
|
||||||
|
Listen 80
|
||||||
|
Listen 40916
|
||||||
|
|
||||||
|
<IfModule ssl_module>
|
||||||
|
Listen 443
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule mod_gnutls.c>
|
||||||
|
Listen 443
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# start/restart service mysql & apache
|
||||||
|
service mysql restart || exit 2
|
||||||
|
service apache2 restart || exit 2
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# launch web configuration for ryzom
|
||||||
|
# -H 'Accept-Encoding: gzip, deflate'
|
||||||
|
curl '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' \
|
||||||
|
-H 'Cookie: PHPSESSID=9jr1ssig58929bp777nrj2fa92' \
|
||||||
|
-H 'DNT: 1' \
|
||||||
|
-H 'Host: localhost:40916' \
|
||||||
|
-H 'Referer: http://localhost:40916/setup/install.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 'roleService=on'\
|
||||||
|
'&roleSupport=on'\
|
||||||
|
'&roleDomain=on'\
|
||||||
|
'&privatePhpDirectory=..%2Fprivate_php%2F'\
|
||||||
|
'&nelSetupPassword=admin'\
|
||||||
|
'&nelSqlHostname=localhost'\
|
||||||
|
'&nelSqlUsername=root'\
|
||||||
|
'&nelSqlPassword='\
|
||||||
|
'&nelDatabase=nel'\
|
||||||
|
'&toolDatabase=nel_tool'\
|
||||||
|
'&toolsAdminUsername=admin'\
|
||||||
|
'&toolsAdminPassword=admin'\
|
||||||
|
'&amsSqlHostname=localhost'\
|
||||||
|
'&amsSqlUsername=root'\
|
||||||
|
'&amsSqlPassword='\
|
||||||
|
'&amsDatabase=nel_ams'\
|
||||||
|
'&amsLibDatabase=nel_ams_lib'\
|
||||||
|
'&amsAdminUsername=admin'\
|
||||||
|
'&amsAdminPassword=admin'\
|
||||||
|
'&nelDomainName=mini01'\
|
||||||
|
'&domainDatabase=ring_mini01'\
|
||||||
|
'&submit=Configure' \
|
||||||
|
-o /opt/setup.log || exit 2
|
||||||
|
|
||||||
|
grep "Domain role successfully installed" /opt/setup.log >/dev/null || exit 2
|
||||||
|
|
||||||
|
# create link resource
|
||||||
|
# Les dossiers :
|
||||||
|
ln -s $RYDATA/collisions $RYZOM_PATH/server/
|
||||||
|
ln -s $RYDATA/leveldesign $RYZOM_PATH/server/
|
||||||
|
ln -s $RYDATA/primitives $RYZOM_PATH/server/
|
||||||
|
ln -s $RYDATA/translation $RYZOM_PATH/server/
|
||||||
|
ln -s $RYDATA/continents $RYZOM_PATH/server/
|
||||||
|
ln -s $RYDATA/common $RYZOM_PATH/server/
|
||||||
|
|
||||||
|
# Les fichiers :
|
||||||
|
mkdir -p $RYZOM_PATH/server/data_shard
|
||||||
|
cp -r /opt/code/ryzom/server/data_shard/* $RYZOM_PATH/server/data_shard/.
|
||||||
|
ln -s $RYDATA/shard/su/dev_gm_names.xml $RYZOM_PATH/server/data_shard/dev_gm_names.xml
|
||||||
|
ln -s $RYDATA/shard/su/invalid_entity_names.txt $RYZOM_PATH/server/data_shard/invalid_entity_names.txt
|
||||||
|
ln -s $RYDATA/shard/su/reserved_names.xml $RYZOM_PATH/server/data_shard/reserved_names.xml
|
||||||
|
ln -s $RYDATA/shard/egs/game_event.txt $RYZOM_PATH/server/data_shard/game_event.txt
|
||||||
|
ln -s $RYDATA/shard/egs/mission_queues.txt $RYZOM_PATH/server/data_shard/mission_queues.txt
|
||||||
|
ln -s $RYDATA/shard/egs/named_items.txt $RYZOM_PATH/server/data_shard/named_items.txt
|
||||||
|
|
||||||
|
mkdir -p $RYDATA/mirror_sheets
|
||||||
|
cp -r /opt/code/ryzom/server/data_shard/mirror_sheets/* $RYDATA/mirror_sheets
|
||||||
|
|
||||||
|
cd /usr/local; /usr/local/bin/make_sheet_id \
|
||||||
|
-c/usr/local/etc/nel/make_sheet_id.cfg \
|
||||||
|
-o$RYDATA/leveldesign/game_elem/sheet_id.bin \
|
||||||
|
$RYDATA/leveldesign/game_elem \
|
||||||
|
$RYDATA/leveldesign/game_element \
|
||||||
|
$RYDATA/leveldesign/world \
|
||||||
|
$RYDATA/leveldesign/ecosystems \
|
||||||
|
$RYDATA/sound \
|
||||||
|
$RYDATA/mirror_sheets || exit 2
|
||||||
|
|
||||||
|
rm -rf /opt/sheets_packer/*
|
||||||
|
mkdir -p /opt/sheets_packer/common /opt/sheets_packer/khanat-ressources /opt/sheets_packer/client
|
||||||
|
cat << EOF > /opt/sheets_packer/sheets_packer.cfg
|
||||||
|
/////////////////////////////////
|
||||||
|
/////////////////////////////////
|
||||||
|
/// SHEETS PACKER CONFIG FILE ///
|
||||||
|
/////////////////////////////////
|
||||||
|
/////////////////////////////////
|
||||||
|
DataPath = { "/opt/sheets_packer/common/data_leveldesign",
|
||||||
|
"/opt/sheets_packer/common/data_common",
|
||||||
|
"/opt/sheets_packer/client/data",
|
||||||
|
"/opt/sheets_packer/khanat-ressources/common",
|
||||||
|
"/opt/sheets_packer/khanat-ressources/leveldesign",
|
||||||
|
"/opt/sheets_packer/khanat-ressources/primitives" };
|
||||||
|
WorldSheet = "ryzom.world";
|
||||||
|
PrimitivesPath = "/opt/sheets_packer/khanat-ressources/primitives";
|
||||||
|
OutputDataPath = "/opt/sheets_packer/client/data";
|
||||||
|
LigoPrimitiveClass = "world_editor_classes.xml";
|
||||||
|
DumpVisualSlotsIndex = 1;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cp -r /opt/code/ryzom/common/* /opt/sheets_packer/common || exit 2
|
||||||
|
cp -r $RYDATA/* /opt/sheets_packer/khanat-ressources || exit 2
|
||||||
|
cp -r /opt/code/ryzom/client/* /opt/sheets_packer/client || exit 2
|
||||||
|
cd /opt/sheets_packer; sheets_packer 1>/opt/sheets_packer/sheets_packer.log 2>/opt/sheets_packer/sheets_packer.err || exit 2
|
||||||
|
cp /opt/sheets_packer/visual_slot.tab $RYZOM_PATH/common/data_common/visual_slot.tab || exit 2
|
||||||
|
|
||||||
|
cp /opt/sheets_packer/visual_slot.tab $RYZOM_PATH/client/data/visual_slot.tab || exit 2
|
||||||
|
|
||||||
|
|
||||||
|
for var in $RYDATA/translation/translated/*_en.txt; do nomfic=${var##*/}; ln -s $nomfic ${var%/*}/${nomfic/_en/_de}; done
|
||||||
|
for var in $RYDATA/translation/translated/*_en.txt; do nomfic=${var##*/}; ln -s $nomfic ${var%/*}/${nomfic/_en/_es}; done
|
||||||
|
for var in $RYDATA/translation/translated/*_wk.txt; do nomfic=${var##*/}; ln -s $nomfic ${var%/*}/${nomfic/_wk/_ru}; done
|
||||||
|
|
||||||
|
cp /opt/code/ryzom/server/shard.screen.rc $RYZOM_PATH/server/shard.screen.rc
|
||||||
|
ln -s /usr/local /home/compil/build
|
||||||
|
|
||||||
|
/etc/init.d/ssh restart
|
||||||
|
|
||||||
|
cp /usr/local/sbin/* /usr/local/bin
|
||||||
|
cat << EOF
|
||||||
|
source /opt/shard.sh
|
||||||
|
/home/compil/ryzom/tools/scripts/linux/shard
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat << EOF > /opt/autostart.sh
|
||||||
|
#!/bin/bash
|
||||||
|
/etc/init.d/mysql restart
|
||||||
|
/etc/init.d/apache2 restart
|
||||||
|
/etc/init.d/ssh restart
|
||||||
|
source /opt/shard.sh
|
||||||
|
/home/compil/ryzom/tools/scripts/linux/shard start
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod +x /opt/autostart.sh
|
||||||
|
|
||||||
|
mkdir -p $RYZOM_PATH/server/save_shard/rrd_graphs
|
||||||
|
|
||||||
|
|
||||||
|
## See on https://ryzomcore.atlassian.net/wiki/display/RC/Configure+Linux+Web+Services
|
||||||
|
#mkdir -p $RYZOM_PATH/tools/server/admin/graphs_output
|
||||||
|
#mkdir -p $RYZOM_PATH/tools/server/admin/templates/default_c
|
||||||
|
#mkdir -p $RYZOM_PATH/tools/server/www/login/logs
|
||||||
|
#mkdir -p $RYZOM_PATH/tools/server/ryzom_ams/www/
|
||||||
|
#mkdir -p $RYZOM_PATH/tools/server/ryzom_ams/www/html/cache
|
||||||
|
#mkdir -p $RYZOM_PATH/tools/server/ryzom_ams/www/html/templates_c
|
||||||
|
#shard
|
||||||
|
|
||||||
|
|
||||||
|
/etc/init.d/ssh stop || exit 2
|
||||||
|
service apache2 stop|| exit 2
|
||||||
|
service mysql stop || exit 2
|
35
dist/docker/server/debian/jessie/x86_64/Dockerfile
vendored
Normal file
35
dist/docker/server/debian/jessie/x86_64/Dockerfile
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
# Dockerfile - Build new package server
|
||||||
|
# Build for server debian-8 (amd64)
|
||||||
|
#
|
||||||
|
# Copyright : GNU/AGPLv3
|
||||||
|
#
|
||||||
|
# Created : 1 AUG 2017
|
||||||
|
# Createryzomwebd by : AleaJactaEst
|
||||||
|
|
||||||
|
FROM amd64/debian:8
|
||||||
|
MAINTAINER AleaJactaEst
|
||||||
|
|
||||||
|
ENV HOSTNAME basic_server
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
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
|
||||||
|
|
||||||
|
# adding account compil, password compil
|
||||||
|
RUN useradd -G sudo,www-data -c /home -d /home/compil -c "Khanat account" -m -p '$6$cQrN51jJ$eP/whHzKesStKm8KgQwZMb.kYdPzJm2RtG7FcESQtrrioyOiDslE4jxnuz4WieMIvW8saPdnj3vOy1s/cnfVy.' -s /bin/bash -U compil
|
||||||
|
|
||||||
|
|
||||||
|
COPY dist/docker/server/debian/init-basic.sh /opt/
|
||||||
|
|
||||||
|
#COPY code/build_linux64/ryzomcore*.tar.gz /opt/.
|
||||||
|
#COPY code/build_linux64/ryzom-ressources.tar.gz /opt/.
|
||||||
|
#COPY khanat-ressources.tar.gz /opt/
|
||||||
|
#COPY dist/docker/server/debian/init-khanat.sh /opt/
|
||||||
|
|
||||||
|
RUN /opt/init-basic.sh
|
||||||
|
#RUN /opt/init-khanat.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
22
dist/docker/server/debian/jessie/x86_64/Dockerfile.khanat
vendored
Normal file
22
dist/docker/server/debian/jessie/x86_64/Dockerfile.khanat
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# Dockerfile - Build new package server
|
||||||
|
# Build for server debian-8 (amd64)
|
||||||
|
#
|
||||||
|
# Copyright : GNU/AGPLv3
|
||||||
|
#
|
||||||
|
# Created : 1 AUG 2017
|
||||||
|
# Createryzomwebd by : AleaJactaEst
|
||||||
|
|
||||||
|
FROM server_generic_debian_8_x86_64
|
||||||
|
MAINTAINER AleaJactaEst
|
||||||
|
|
||||||
|
ENV HOSTNAME khanat_server
|
||||||
|
|
||||||
|
COPY dist/docker/server/debian/init-khanat.sh /opt/
|
||||||
|
COPY ryzomcore.tar.gz /opt/
|
||||||
|
COPY ryzom-ressources.tar.gz /opt/
|
||||||
|
COPY khanat-ressources.tar.gz /opt/
|
||||||
|
|
||||||
|
RUN /opt/init-khanat.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
288
dist/docker/server/debian/jessie/x86_64/server.sh
vendored
Executable file
288
dist/docker/server/debian/jessie/x86_64/server.sh
vendored
Executable file
|
@ -0,0 +1,288 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Script to start khanat server
|
||||||
|
#
|
||||||
|
# Copyright : GNU/AGPLv3
|
||||||
|
#
|
||||||
|
# Created : 1 AUG 2017
|
||||||
|
# Created by : AleaJactaEst
|
||||||
|
|
||||||
|
declare -i IMAGE=1
|
||||||
|
declare -i BASICSERVER=0
|
||||||
|
declare -i KHANATSERVER=0
|
||||||
|
declare -i KHANATRESSOURCES=0
|
||||||
|
declare -i RYZOMRESSOURCES=0
|
||||||
|
declare -i LAUNCHKHANAT=1
|
||||||
|
declare -i DEBUG=0
|
||||||
|
declare -i AUTODETEC=1
|
||||||
|
declare -i STOPKHANAT=0
|
||||||
|
declare -i CLEANCONTAINERKHANAT=0
|
||||||
|
declare -i CONNECTSSHKHANAT=0
|
||||||
|
|
||||||
|
declare IMAGEGENERICSERVER="server_generic_debian_jessie_x86_64"
|
||||||
|
declare IMAGEKHANATSERVER="server_khanat_debian_jessie_x86_64"
|
||||||
|
declare LOCALBUILDDIR="build_linux64"
|
||||||
|
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
cat << EOF
|
||||||
|
usage:$0 [options]
|
||||||
|
script to build under docker
|
||||||
|
|
||||||
|
Step:
|
||||||
|
1) generate tar with khanat-ressources
|
||||||
|
2) generate tar with ryzom-ressources
|
||||||
|
3) create image basic server
|
||||||
|
4) create image khanat server
|
||||||
|
5) launch khanat server
|
||||||
|
|
||||||
|
options:
|
||||||
|
-h, --help : Show this help
|
||||||
|
-d, --debug : Show debug message
|
||||||
|
-b, --force-basic : Force create/recreate image basic server
|
||||||
|
-t, --force-tar-ressources : Generate TAR.GZ for khanat-ressources (look directory ../khanat-ressources)
|
||||||
|
-z, --force-tar-ryzom-ressources : Generate TAR.GZ in data khanat-code
|
||||||
|
-k, --force-khanat : Force create/recreate image khanat server
|
||||||
|
-n, --no-launch-khanat : Doesn't launch khanat server
|
||||||
|
-s, --stop-server : Stop server khanat
|
||||||
|
-c, --clean-container-khanat : Remove old server khanat (stopped)
|
||||||
|
--ssh : connect on khanat server (with ssh) [Exclusive action, can't execute other action]
|
||||||
|
|
||||||
|
Example :
|
||||||
|
cd [root Khanat directory]
|
||||||
|
./server.sh
|
||||||
|
./server.sh -k
|
||||||
|
./server.sh --ssh
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
function msg_debug()
|
||||||
|
{
|
||||||
|
if [[ $DEBUG -ne 0 ]]
|
||||||
|
then
|
||||||
|
echo "$(date "+%Y/%m/%d %H:%M:%S") DEBUG - $*"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function msg_info()
|
||||||
|
{
|
||||||
|
echo "$(date "+%Y/%m/%d %H:%M:%S") INFO - $*"
|
||||||
|
}
|
||||||
|
|
||||||
|
function msg_error()
|
||||||
|
{
|
||||||
|
echo "$(date "+%Y/%m/%d %H:%M:%S") ERROR - $*" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# MAIN
|
||||||
|
#
|
||||||
|
|
||||||
|
calldir="$(dirname $0)"
|
||||||
|
basedir=$(cd $calldir; pwd)
|
||||||
|
rootdir="$(dirname $(dirname $(dirname $(dirname $(dirname $(dirname ${basedir}))))))"
|
||||||
|
ressourcedir="$(dirname ${rootdir})/khanat-ressources"
|
||||||
|
|
||||||
|
while test $# -gt 0
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
-d|--debug)
|
||||||
|
DEBUG=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--ssh)
|
||||||
|
CONNECTSSHKHANAT=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-c|--clean-container-khanat)
|
||||||
|
CLEANCONTAINERKHANAT=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-s|--stop-server)
|
||||||
|
STOPKHANAT=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-b|--force-basic)
|
||||||
|
BASICSERVER=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-n|--no-launch-khanat)
|
||||||
|
LAUNCHKHANAT=0
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-t|--force-tar-ressources)
|
||||||
|
KHANATRESSOURCES=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-z|--force-tar-ryzom-ressources)
|
||||||
|
RYZOMRESSOURCES=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-k|--force-khanat)
|
||||||
|
KHANATSERVER=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
msg_error "options '$1' not recoginze"
|
||||||
|
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
|
||||||
|
msg_error "docker not installed"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$(uname -m)" in
|
||||||
|
x86_64)
|
||||||
|
;;
|
||||||
|
i686)
|
||||||
|
msg_error "Bad Archi"
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
msg_error "Unknown archi : $(uname -m)"
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ $CONNECTSSHKHANAT -ne 0 ]]
|
||||||
|
then
|
||||||
|
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
|
||||||
|
if [[ ${#listcontainer[@]} -eq 1 ]]
|
||||||
|
then
|
||||||
|
|
||||||
|
ipaddress=$(docker inspect --format="{{ .NetworkSettings.IPAddress }}" ${listcontainer[@]})
|
||||||
|
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no compil@$ipaddress
|
||||||
|
fi
|
||||||
|
trap '' EXIT
|
||||||
|
msg_info "END SSH"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $AUTODETEC -ne 0 ]]
|
||||||
|
then
|
||||||
|
if [[ $(docker images -f "reference=$IMAGEGENERICSERVER" | wc -l) -lt 2 ]]
|
||||||
|
then
|
||||||
|
BASICSERVER=1
|
||||||
|
fi
|
||||||
|
if [[ ! -d ${ressourcedir} ]]
|
||||||
|
then
|
||||||
|
KHANATRESSOURCES=1
|
||||||
|
fi
|
||||||
|
if [[ ! -f ${rootdir}/ryzom-ressources.tar.gz ]]
|
||||||
|
then
|
||||||
|
RYZOMRESSOURCES=1
|
||||||
|
fi
|
||||||
|
if [[ $(docker images -f "reference=$IMAGEKHANATSERVER" | wc -l) -lt 2 ]]
|
||||||
|
then
|
||||||
|
KHANATSERVER=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
(cd $rootdir; cp ${rootdir}/code/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz ${rootdir}/ryzomcore.tar.gz) || exit 2
|
||||||
|
|
||||||
|
DIRBUILD="${rootdir}/code/${LOCALBUILDDIR}"
|
||||||
|
|
||||||
|
msg_debug "calldir: $calldir"
|
||||||
|
msg_debug "basedir: $basedir"
|
||||||
|
msg_debug "rootdir: $rootdir"
|
||||||
|
msg_debug "ressourcedir: $ressourcedir"
|
||||||
|
msg_debug "generate basic image: $BASICSERVER"
|
||||||
|
msg_debug "generate tar khanat ressources: $KHANATRESSOURCES"
|
||||||
|
msg_debug "generate tar ryzom ressources: $RYZOMRESSOURCES"
|
||||||
|
msg_debug "generate khanat image: $KHANATSERVER"
|
||||||
|
msg_debug "launch khanat: $LAUNCHKHANAT"
|
||||||
|
msg_debug "stop khanat: $STOPKHANAT"
|
||||||
|
|
||||||
|
if [[ $KHANATRESSOURCES -ne 0 ]]
|
||||||
|
then
|
||||||
|
msg_info "$(date "+%Y/%m/%d %H:%M:%S") CREATE TAR with KHANAT Ressources"
|
||||||
|
if [[ ! -d ${ressourcedir} ]]
|
||||||
|
then
|
||||||
|
msg_error "Missing khanat-ressources directory ($ressourcedir)"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
(cd $ressourcedir; tar --exclude='.git' -czf ${rootdir}/khanat-ressources.tar.gz .) || exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $RYZOMRESSOURCES -ne 0 ]]
|
||||||
|
then
|
||||||
|
msg_info "CREATE TAR with RYZOM Ressources"
|
||||||
|
if [[ ! -d ${ressourcedir} ]]
|
||||||
|
then
|
||||||
|
msg_error "Missing khanat-ressources directory ($ressourcedir)"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
cd ${rootdir}; tar czf ryzom-ressources.tar.gz \
|
||||||
|
code/ryzom/server/shard.screen.rc \
|
||||||
|
code/ryzom/common/* \
|
||||||
|
code/ryzom/client/* \
|
||||||
|
code/ryzom/server/* \
|
||||||
|
code/ryzom/tools/scripts/linux/* \
|
||||||
|
code/web/* || exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $STOPKHANAT -ne 0 ]]
|
||||||
|
then
|
||||||
|
msg_info "STOP SERVER KHANAT"
|
||||||
|
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
|
||||||
|
msg_debug "CONTAINER KHANAT UP : ${listcontainer[@]}"
|
||||||
|
if [[ -n "$listcontainer" ]]
|
||||||
|
then
|
||||||
|
docker stop "$listcontainer" || exit 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $CLEANCONTAINERKHANAT -ne 0 ]]
|
||||||
|
then
|
||||||
|
msg_info "CLEAN CONTAINER KHANAT"
|
||||||
|
listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') )
|
||||||
|
msg_debug "CONTAINER KHANAT EXITED : ${listcontainer[@]}"
|
||||||
|
if [[ -n "${listcontainer[@]}" ]]
|
||||||
|
then
|
||||||
|
docker rm --force "${listcontainer[@]}" || exit 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $BASICSERVER -ne 0 ]]
|
||||||
|
then
|
||||||
|
msg_info "GENERATE DOCKER IMAGE BASIC SERVER"
|
||||||
|
cd $rootdir; docker build . -t ${IMAGEGENERICSERVER} \
|
||||||
|
--file "${basedir}/Dockerfile" || exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $KHANATSERVER -ne 0 ]]
|
||||||
|
then
|
||||||
|
msg_info "GENERATE DOCKER IMAGE KHANAT SERVER"
|
||||||
|
ls ${rootdir}/code/${LOCALBUILDDIR}/ryzomcore.tar.gz
|
||||||
|
cd $rootdir; docker build . -t ${IMAGEKHANATSERVER} \
|
||||||
|
--file "${basedir}/Dockerfile.khanat" || exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $LAUNCHKHANAT -ne 0 ]]
|
||||||
|
then
|
||||||
|
msg_info "START KHANAT SERVER"
|
||||||
|
cd $rootdir; docker run -it --hostname=khanat ${IMAGEKHANATSERVER} /opt/autostart.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
trap '' EXIT
|
||||||
|
msg_info "END"
|
Loading…
Reference in a new issue