update readme & update message

This commit is contained in:
Jerome Sagnole 2017-11-22 21:13:50 +01:00
parent b10405938f
commit 42f2a25be1
12 changed files with 296 additions and 210 deletions

View file

@ -18,6 +18,7 @@ Depend on your environment.
## Clone repo
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-server-docker.git
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-opennel-code.git
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-client-data.git
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-ressources.git
@ -31,15 +32,18 @@ Depend on your environment.
command :
./builder/debian/jessie/x86_64/build.sh -c -r -j 4 -a '-DWITH_SYMBOLS=ON' -m '-m 20g' -d
``` sh
builder/debian/jessie/x86_64/build.sh -c -r -j 4 -a '-DWITH_SYMBOLS=ON' -m '-m 20g' -d
```
result:
package : ./code/build/builder_khanat_debian_jessie_x86_64/ryzomcore-*.tar.gz
package : build/opennel/builder_debian_jessie_x86_64/ryzomcore-*.tar.gz
log build : ./code/build/builder_khanat_debian_jessie_x86_64/build.log
log build : build/opennel/builder_debian_jessie_x86_64/build.log
all file generated on build : ./code/build/builder_khanat_debian_jessie_x86_64/
all file generated on build : build/opennel/builder_debian_jessie_x86_64/
@ -49,17 +53,73 @@ Compil server :
(prepare server / initialize khanat / database / patch)
./dist/docker/server/debian/jessie/x86_64/server.sh -b -t -q -z -k -n
``` sh
server/debian/jessie/x86_64/server.sh -b -t -q -z -k -n
```
Start server :
(You need tape Enter when application ask to start server)
./dist/docker/server/debian/jessie/x86_64/server.sh
``` sh
server/debian/jessie/x86_64/server.sh
```
Connect server with ssh (only if server is started)
./dist/docker/server/debian/jessie/x86_64/server.sh --ssh
``` sh
server/debian/jessie/x86_64/server.sh --ssh
```
## BUILD ALL
To generate all architectures and all debian release
(build & generate server)
``` sh
build_all.sh
```
## DOCKER
### List image
``` sh
docker images
```
### List container
``` sh
docker ps -a
```
### Remove container
``` sh
docker rm <Container ID>
```
### Remove image
``` sh
docker rmi <Image ID>
```
### Launch container
Launch bash command
(if you exist on your command, it stop your container)
``` sh
docker run -it <Image ID or name> /bin/bash
```
### Save image
``` sh
docker save -o image.tar <Image ID>
```
### Load image
``` sh
docker load --input image.tar
```

View file

@ -24,6 +24,7 @@ declare -i BUILD_x86_64=0
declare -i GENERATE_CONTAINER_x86_64=0
declare -i GENERATE_IMAGE_x86_64=0
declare -i CLEAN=0
declare -i SAVE_IMAGES=0
calldir="$(dirname $0)"
basedir=$(cd $calldir; pwd)
@ -44,6 +45,7 @@ options:
--generate-container-x86_64 : Generate container docker for x86_64 (share data with host)
--generate-image-x86_64 : Generate image docker for x86_64 (image have all opennel)
--clean : remove build & server data
--save-docker-images : save all docker images
EOF
}
@ -59,14 +61,20 @@ function msg_info()
{
msg="$(date "+%Y/%m/%d %H:%M:%S") INFO - $*"
echo "$msg"
if [[ -d ${basedir}/build ]]
then
echo "$msg" >> ${basedir}/build/state.log
fi
}
function msg_error()
{
msg="$(date "+%Y/%m/%d %H:%M:%S") ERROR - $*"
echo "$msg"
if [[ -d ${basedir}/build ]]
then
echo "$msg" >> ${basedir}/build/state.log
fi
exit 2
}
@ -115,6 +123,10 @@ do
CLEAN=1
shift
;;
--save-docker-images)
SAVE_IMAGES=1
shift
;;
*)
usage
msg_error "options '$1' not recognize"
@ -122,9 +134,8 @@ do
esac
done
mkdir -p "${basedir}/build"
msg_info "BEGIN"
if [[ $AUTO ]]
msg_info "[$(basename $0):$LINENO] INIT"
if [[ $AUTO -eq 1 ]]
then
BUILD_i686=1
GENERATE_CONTAINER_i686=1
@ -136,44 +147,59 @@ fi
if [[ $CLEAN -ne 0 ]]
then
msg_debug "CLEAN"
rm -rf $basedir/build $basedir/output || msg_error "CLEAN"
msg_debug "[$(basename $0):$LINENO] CLEAN"
rm -rf "$basedir/build" "$basedir/output" || msg_error "[$(basename $0):$LINENO] CLEAN"
fi
mkdir -p "${basedir}/build"
msg_info "[$(basename $0):$LINENO] BEGIN"
if [[ $BUILD_i686 -ne 0 ]]
then
msg_debug "BUILD DEBIAN JESSIE i686"
builder/debian/jessie/i686/build.sh -c -j 12 -a '-DWITH_SSE2=OFF' -a '-DWITH_SYMBOLS=ON' -m '-m 20g' -d || msg_error "BUILD DEBIAN JESSIE i686"
msg_debug "[$(basename $0):$LINENO] BUILD DEBIAN JESSIE i686"
$basedir/builder/debian/jessie/i686/build.sh -c -j 12 -a '-DWITH_SSE2=OFF' -a '-DWITH_SYMBOLS=ON' -m '-m 20g' -d || msg_error "[$(basename $0):$LINENO] BUILD DEBIAN JESSIE i686"
fi
if [[ $GENERATE_CONTAINER_i686 -ne 0 ]]
then
msg_debug "GENERATE SERVER CONTAINER DEBIAN JESSIE i686"
server/debian/jessie/i686/server-container.sh -r -b -k -w -c -n || msg_error "GENERATE SERVER CONTAINER DEBIAN JESSIE i686"
msg_debug "[$(basename $0):$LINENO] GENERATE SERVER CONTAINER DEBIAN JESSIE i686"
$basedir/server/debian/jessie/i686/server-container.sh -r -b -k -w -c -n || msg_error "[$(basename $0):$LINENO] GENERATE SERVER CONTAINER DEBIAN JESSIE i686"
fi
if [[ $GENERATE_IMAGE_i686 -ne 0 ]]
then
msg_debug "GENERATE SERVER IMAGE DEBIAN JESSIE i686"
server/debian/jessie/i686/server-image.sh -b -k -w -c -n || msg_error "GENERATE SERVER IMAGE DEBIAN JESSIE i686"
msg_debug "[$(basename $0):$LINENO] GENERATE SERVER IMAGE DEBIAN JESSIE i686"
$basedir/server/debian/jessie/i686/server-image.sh -b -k -w -c -n || msg_error "[$(basename $0):$LINENO] GENERATE SERVER IMAGE DEBIAN JESSIE i686"
fi
if [[ $BUILD_x86_64 -ne 0 ]]
then
msg_debug "BUILD DEBIAN JESSIE x86_64"
builder/debian/jessie/x86_64/build.sh -c -j 12 -a '-DWITH_SYMBOLS=ON' -m '-m 20g' -d || msg_error "BUILD DEBIAN JESSIE x86_64"
msg_debug "[$(basename $0):$LINENO] BUILD DEBIAN JESSIE x86_64"
$basedir/builder/debian/jessie/x86_64/build.sh -c -j 12 -a '-DWITH_SYMBOLS=ON' -m '-m 20g' -d || msg_error "[$(basename $0):$LINENO] BUILD DEBIAN JESSIE x86_64"
fi
if [[ $GENERATE_CONTAINER_x86_64 -ne 0 ]]
then
msg_debug "GENERATE SERVER CONTAINER DEBIAN JESSIE x86_64"
server/debian/jessie/x86_64/server-container.sh -r -b -k -g -w -c -n || msg_error "GENERATE SERVER CONTAINER DEBIAN JESSIE x86_64"
msg_debug "[$(basename $0):$LINENO] GENERATE SERVER CONTAINER DEBIAN JESSIE x86_64"
$basedir/server/debian/jessie/x86_64/server-container.sh -r -b -k -g -w -c -n || msg_error "[$(basename $0):$LINENO] GENERATE SERVER CONTAINER DEBIAN JESSIE x86_64"
fi
if [[ $GENERATE_IMAGE_x86_64 -ne 0 ]]
then
msg_debug "GENERATE SERVER IMAGE DEBIAN JESSIE x86_64"
server/debian/jessie/x86_64/server-image.sh -b -k -w -c -n || msg_error "GENERATE SERVER IMAGE DEBIAN JESSIE x86_64"
msg_debug "[$(basename $0):$LINENO] GENERATE SERVER IMAGE DEBIAN JESSIE x86_64"
$basedir/server/debian/jessie/x86_64/server-image.sh -b -k -w -c -n || msg_error "[$(basename $0):$LINENO] GENERATE SERVER IMAGE DEBIAN JESSIE x86_64"
fi
if [[ $SAVE_IMAGES -ne 0 ]]
then
mkdir -p $basedir/output/images || msg_error "[$(basename $0):$LINENO] Impossible to create $basedir/output/images"
listimages=( $(docker images --filter=reference='opennel/*' --format "{{.Repository}}") )
for image in ${listimages[@]}
do
mkdir -p $(dirname $basedir/output/images/$image) || msg_error "[$(basename $0):$LINENO] Impossible to create $(dirname $basedir/output/images/$image)"
docker save -o "$basedir/output/images/$image.tar" "$image" || msg_error "[$(basename $0):$LINENO] Impossible to save image $image"
done
fi
msg_info "END"

View file

@ -287,7 +287,7 @@ fi
if [[ $CLEANIMAGENONE -ne 0 ]]
then
msg_info "CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images | awk '{if ($1=="<none>")print $3}') )
listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]]

View file

@ -287,7 +287,7 @@ fi
if [[ $CLEANIMAGENONE -ne 0 ]]
then
msg_info "CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images | awk '{if ($1=="<none>")print $3}') )
listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]]

View file

@ -268,7 +268,7 @@ fi
if [[ $CLEANIMAGENONE -ne 0 ]]
then
msg_info "CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images | awk '{if ($1=="<none>")print $3}') )
listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]]

View file

@ -277,7 +277,7 @@ else
fi
fi
msg_info "[$(basename $0):$LINENO] CLIENT VERSION: $KHANAT_CLIENT_VERSION"
msg_info "[$(basename $0):$LINENO] CLIENT VERSION SELECTED : $KHANAT_CLIENT_VERSION"
echo -n "$KHANAT_CLIENT_VERSION" > $PATCH_CLIENT_SYSTEM/patch_game/Lirria.version
####################################
@ -294,7 +294,7 @@ 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)
msg_info "CLIENT VERSION: $REALVERSION"
msg_info "[$(basename $0):$LINENO] CLIENT VERSION REAL: $REALVERSION"
cat << EOF > $PATCH_CLIENT_SYSTEM/patch_game/patch/index.php
<html>
<head>

View file

@ -52,7 +52,7 @@ function msg_error()
# MAIN
#####################
source /opt/ext/servercontainer_function.sh
msg_info "$(basename $0) => START"
msg_info "[$(basename $0):$LINENO] => START"
while test $# -gt 0
do
@ -76,17 +76,17 @@ done
####################################
# Load Environment
####################################
msg_debug "Load environment"
msg_debug "[$(basename $0):$LINENO] Load environment"
if [[ ! -f /opt/khanat_config.sh ]]
then
echo "ERROR - missing /opt/khanat_config.sh"
echo "ERROR [$(basename $0):$LINENO] missing /opt/khanat_config.sh"
exit 2
fi
source /opt/khanat_config.sh
if [[ ! -f /home/gameserver/.bashrc ]]
then
msg_error "Missing /home/gameserver/.bashrc"
msg_error "[$(basename $0):$LINENO] Missing /home/gameserver/.bashrc"
exit 2
fi
source /home/gameserver/.bashrc
@ -95,12 +95,12 @@ source /home/gameserver/.bashrc
####################################
# Start mysql & apache
####################################
msg_debug "Start mysql"
msg_debug "[$(basename $0):$LINENO] Start mysql"
# start/restart service mysql & apache
sudo service mysql start || exit 2
# Wait mysql start
msg_info "Check database is started"
msg_info "[$(basename $0):$LINENO] Check database is started"
sleep 1
until sudo /usr/bin/mysqladmin ping >/dev/null 2>&1
do
@ -117,7 +117,7 @@ sudo service apache2 start || exit 2
####################################
# Create account
####################################
msg_debug "Create account"
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
@ -126,7 +126,7 @@ mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'shard'@'localhost' WITH GRANT
####################################
# launch web configuration for khanat
####################################
msg_debug "launch web configuration for khanat"
msg_debug "[$(basename $0):$LINENO] launch web configuration for khanat"
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' \
@ -179,7 +179,7 @@ export addressip=${tmp//[[:blank:]]/}
####################################
## Configure Domain
####################################
msg_debug "Configure Domain"
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
@ -187,14 +187,14 @@ INSERT INTO nel.domain (domain_id, domain_name, status, patch_version, backup_pa
####################################
# Configure nel.shard
####################################
msg_debug "Configure nel.shard"
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
####################################
# Configure nel_tool.neltool_domains
####################################
msg_debug "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
@ -202,7 +202,7 @@ INSERT INTO nel_tool.neltool_domains (domain_id, domain_name, domain_as_host, do
####################################
# configure nel_tool.neltool_shards
####################################
msg_debug "Configure nel_tool.neltool_shards"
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
@ -210,7 +210,7 @@ INSERT INTO nel_tool.neltool_shards (shard_id, shard_name, shard_as_id, shard_do
####################################
# configure nel_tool.neltool_user_domains
####################################
msg_debug "Configure nel_tool.neltool_user_domains"
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
@ -218,7 +218,7 @@ INSERT INTO nel_tool.neltool_user_domains (user_domain_id, user_domain_user_id,
####################################
# configure nel_tool.neltool_user_shards
####################################
msg_debug "Configure nel_tool.neltool_user_shards"
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
@ -226,7 +226,7 @@ INSERT INTO nel_tool.neltool_user_shards (user_shard_id, user_shard_user_id, use
####################################
# configure ring_mini01.sessions
####################################
msg_debug "Configure ring_mini01.sessions"
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
@ -234,7 +234,7 @@ INSERT INTO ring_mini01.sessions (session_id, session_type, title, owner, plan_d
####################################
## Create one user 'tester' (password : tester)
####################################
msg_debug "Create one user"
msg_debug "[$(basename $0):$LINENO] Create one user"
declare accountuser="tester"
declare passworduser="tester"
curl 'http://localhost:40916/ams/index.php' \
@ -255,7 +255,7 @@ curl 'http://localhost:40916/ams/index.php' \
####################################
# configure nel.permission
####################################
msg_debug "Create nel.permission"
msg_debug "[$(basename $0):$LINENO] Create nel.permission"
mysql -u root -e "use nel;
UPDATE nel.permission SET AccessPrivilege = 'OPEN,DEV,RESTRICTED';
" || exit 2
@ -264,7 +264,7 @@ UPDATE nel.permission SET AccessPrivilege = 'OPEN,DEV,RESTRICTED';
####################################
# Stop Database & apache
####################################
msg_debug "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
@ -276,5 +276,5 @@ chown_gameserver "$KHANAT_HOME/database/mysql_upgrade_info"
####################################
# End
####################################
msg_info "$(basename $0) => END"
msg_info "[$(basename $0):$LINENO] => END"

View file

@ -87,7 +87,7 @@ done
msg_debug "[$(basename $0):$LINENO] Load environment"
if [[ ! -f /opt/khanat_config.sh ]]
then
echo "ERROR - missing /opt/khanat_config.sh"
echo "ERROR - [$(basename $0):$LINENO] missing /opt/khanat_config.sh"
exit 2
fi
source /opt/khanat_config.sh

View file

@ -235,7 +235,7 @@ do
shift
;;
*)
msg_error "options '$1' not recognize"
msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage
exit 1
;;
@ -244,7 +244,7 @@ done
function chrashed()
{
msg_error "BUILD FAILED (code:$?)"
msg_error "[$(basename $0):$LINENO] BUILD FAILED (code:$?)"
exit 2
}
@ -252,15 +252,15 @@ trap chrashed EXIT
if [[ $SHOWIPKHANATSERVER -eq 0 ]]
then
msg_info "START"
msg_info "[$(basename $0):$LINENO] START"
fi
msg_debug "prg: $0"
msg_debug "[$(basename $0):$LINENO] prg: $0"
docker -v 1>/dev/null
if [[ $? -ne 0 ]]
then
msg_error "docker not installed"
msg_error "[$(basename $0):$LINENO] docker not installed"
exit 2
fi
@ -270,28 +270,28 @@ case "$(uname -m)" in
i686)
;;
*)
msg_error "Unknown archi : $(uname -m)"
msg_error "[$(basename $0):$LINENO] Unknown archi : $(uname -m)"
exit 2
;;
esac
if [[ $REMOVE -ne 0 ]]
then
msg_info "REMOVE DATA KHANAT : $ROOTDATAKHANAT"
msg_info "[$(basename $0):$LINENO] REMOVE DATA KHANAT : $ROOTDATAKHANAT"
if [[ -n "$ROOTDATAKHANAT" ]]
then
rm -rf ${ROOTDATAKHANAT}/* || exit 2
fi
fi
msg_debug "Create directory on host ($ROOTDATAKHANAT)"
msg_debug "[$(basename $0):$LINENO] Create directory on host ($ROOTDATAKHANAT)"
mkdir -p $ROOTDATAKHANAT || exit 2
chmod g+s $ROOTDATAKHANAT
if [[ ($CONNECTSSHKHANAT -ne 0) || ($SHOWIPKHANATSERVER -ne 0) ]]
then
msg_debug "clean container"
msg_debug "[$(basename $0):$LINENO] clean container"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
if [[ ${#listcontainer[@]} -eq 1 ]]
then
@ -310,13 +310,13 @@ if [[ $CONNECTSSHKHANAT -ne 0 ]]
then
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@$ipaddress
trap '' EXIT
msg_info "END SSH"
msg_info "[$(basename $0):$LINENO] END SSH"
exit 0
fi
if [[ $AUTODETEC -ne 0 ]]
then
msg_debug "Autodetect state"
msg_debug "[$(basename $0):$LINENO] Autodetect state"
if [[ $(docker images -f "reference=$IMAGEGENERICSERVER" | wc -l) -lt 2 ]]
then
BASICSERVER=1
@ -345,22 +345,22 @@ fi
DIRBUILD="${rootdir}/${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 "localization khanat-ressources : ${KHANAT_RESSOURCES_DIR}"
msg_debug "localization khanat-client-data: ${KHANAT_CLIENT_DATA_DIR}"
msg_debug "localization opennel-code-client : ${OPENNEL_CODE_DIR}"
msg_debug "generate khanat image: $KHANATSERVER"
msg_debug "launch khanat: $LAUNCHKHANAT"
msg_debug "stop khanat: $STOPKHANAT"
msg_debug "[$(basename $0):$LINENO] calldir: $calldir"
msg_debug "[$(basename $0):$LINENO] basedir: $basedir"
msg_debug "[$(basename $0):$LINENO] rootdir: $rootdir"
msg_debug "[$(basename $0):$LINENO] ressourcedir: $ressourcedir"
msg_debug "[$(basename $0):$LINENO] generate basic image: $BASICSERVER"
msg_debug "[$(basename $0):$LINENO] localization khanat-ressources : ${KHANAT_RESSOURCES_DIR}"
msg_debug "[$(basename $0):$LINENO] localization khanat-client-data: ${KHANAT_CLIENT_DATA_DIR}"
msg_debug "[$(basename $0):$LINENO] localization opennel-code-client : ${OPENNEL_CODE_DIR}"
msg_debug "[$(basename $0):$LINENO] generate khanat image: $KHANATSERVER"
msg_debug "[$(basename $0):$LINENO] launch khanat: $LAUNCHKHANAT"
msg_debug "[$(basename $0):$LINENO] stop khanat: $STOPKHANAT"
msg_info "check khanat-ressources"
msg_info "[$(basename $0):$LINENO] check khanat-ressources"
if [[ ! -d ${KHANAT_RESSOURCES_DIR} ]]
then
msg_error "Missing directory khanat-ressources [${KHANAT_RESSOURCES_DIR}]"
msg_error "[$(basename $0):$LINENO] Missing directory khanat-ressources [${KHANAT_RESSOURCES_DIR}]"
cat << EOF
You need clone repo khanat-ressource.
@ -372,10 +372,10 @@ EOF
fi
msg_info "check khanat-client-data"
msg_info "[$(basename $0):$LINENO] check khanat-client-data"
if [[ ! -d ${KHANAT_CLIENT_DATA_DIR} ]]
then
msg_error "Missing directory khanat-client-data [${KHANAT_CLIENT_DATA_DIR}]"
msg_error "[$(basename $0):$LINENO] Missing directory khanat-client-data [${KHANAT_CLIENT_DATA_DIR}]"
cat << EOF
You need clone repo khanat-client-data.
@ -388,7 +388,7 @@ fi
if [[ ! -d ${OPENNEL_CODE_DIR} ]]
then
msg_error "Missing directory opennel-code [${OPENNEL_CODE_DIR}]"
msg_error "[$(basename $0):$LINENO] Missing directory opennel-code [${OPENNEL_CODE_DIR}]"
cat << EOF
You need clone repo khanat-opennel-code.
@ -400,9 +400,9 @@ EOF
fi
if [[ $STOPKHANAT -ne 0 ]]
then
msg_info "STOP SERVER KHANAT"
msg_info "[$(basename $0):$LINENO] STOP SERVER KHANAT"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
msg_debug "CONTAINER KHANAT UP : ${listcontainer[@]}"
msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT UP : ${listcontainer[@]}"
if [[ -n "$listcontainer" ]]
then
docker stop "$listcontainer" || exit 2
@ -411,9 +411,9 @@ fi
if [[ $CLEANCONTAINERKHANAT -ne 0 ]]
then
msg_info "CLEAN CONTAINER KHANAT"
msg_info "[$(basename $0):$LINENO] CLEAN CONTAINER KHANAT"
listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') )
msg_debug "CONTAINER KHANAT EXITED : ${listcontainer[@]}"
msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT EXITED : ${listcontainer[@]}"
if [[ -n "${listcontainer[@]}" ]]
then
docker rm --force "${listcontainer[@]}" || exit 2
@ -422,10 +422,10 @@ fi
if [[ $CLEANIMAGENONE -ne 0 ]]
then
msg_info "CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images | awk '{if ($1=="<none>")print $3}') )
msg_info "[$(basename $0):$LINENO] CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}"
msg_debug "[$(basename $0):$LINENO] IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]]
then
docker rmi --force "${listimages[@]}" || exit 2
@ -434,14 +434,14 @@ fi
if [[ $BASICSERVER -ne 0 ]]
then
msg_info "GENERATE DOCKER IMAGE BASIC SERVER"
msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE BASIC SERVER"
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \
--file "${basedir}/Dockerfile" || exit 2
fi
if [[ $KHANATSERVER -ne 0 ]]
then
msg_info "GENERATE DOCKER IMAGE KHANAT SERVER"
msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE KHANAT SERVER"
cat << EOF > $rootdir/${ENVIFILE}
#!/bin/bash
# Temporary file, use only to send some information on build docker
@ -457,10 +457,10 @@ fi
if [[ $CONFIGUREKHANATSERVER -ne 0 ]]
then
msg_info "CONFIGURE KHANAT SERVER"
msg_info "[$(basename $0):$LINENO] CONFIGURE KHANAT SERVER"
mkdir -p $DIRLOG || exit 2
mkdir -p $DIRDATABASE || exit 2
msg_debug "command : cd $rootdir; docker run -it --hostname=khanat \
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 \
@ -488,8 +488,8 @@ fi
if [[ $UPDATEDATA -ne 0 ]]
then
msg_info "UPDATE KHANAT SERVER"
msg_debug "command: cd $rootdir; docker run -it --hostname=khanat \
msg_info "[$(basename $0):$LINENO] UPDATE KHANAT SERVER"
msg_debug "[$(basename $0):$LINENO] command: cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
-v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \
@ -517,7 +517,7 @@ fi
if [[ $LAUNCHKHANAT -ne 0 ]]
then
msg_info "START KHANAT SERVER"
msg_info "[$(basename $0):$LINENO] START KHANAT SERVER"
cd $rootdir; docker run -it --hostname=khanat \
-u "$(id -u $USERNAME):$(id -g $USERNAME)" \
-v /etc/localtime:/etc/localtime:ro \
@ -534,4 +534,4 @@ then
fi
trap '' EXIT
msg_info "END"
msg_info "[$(basename $0):$LINENO] END"

View file

@ -196,7 +196,7 @@ do
shift
;;
*)
msg_error "options '$1' not recognize"
msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage
exit 1
;;
@ -205,7 +205,7 @@ done
function chrashed()
{
msg_error "BUILD FAILED (code:$?)"
msg_error "[$(basename $0):$LINENO] BUILD FAILED (code:$?)"
exit 2
}
@ -213,10 +213,10 @@ trap chrashed EXIT
if [[ $SHOWIPKHANATSERVER -eq 0 ]]
then
msg_info "START"
msg_info "[$(basename $0):$LINENO] START"
fi
msg_debug "prg: $0"
msg_debug "[$(basename $0):$LINENO] prg: $0"
extradir="${rootdir}/${DIROUTPUT}"
mkdir -p ${extradir} || exit 2
@ -225,7 +225,7 @@ mkdir -p ${extradir} || exit 2
docker -v 1>/dev/null
if [[ $? -ne 0 ]]
then
msg_error "docker not installed"
msg_error "[$(basename $0):$LINENO] docker not installed"
exit 2
fi
@ -235,7 +235,7 @@ case "$(uname -m)" in
i686)
;;
*)
msg_error "Unknown archi : $(uname -m)"
msg_error "[$(basename $0):$LINENO] Unknown archi : $(uname -m)"
exit 2
;;
esac
@ -260,7 +260,7 @@ if [[ $CONNECTSSHKHANAT -ne 0 ]]
then
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@$ipaddress
trap '' EXIT
msg_info "END SSH"
msg_info "[$(basename $0):$LINENO] END SSH"
exit 0
fi
@ -299,10 +299,10 @@ then
sumsrc=1
sumdsr=2
fi
msg_debug "ryzomcore checksum src:$sumsrc dst:$sumdst"
msg_debug "[$(basename $0):$LINENO] ryzomcore checksum src:$sumsrc dst:$sumdst"
if [[ "$sumsrc" != "$sumdst" ]]
then
msg_debug "copy ryzomcore"
msg_debug "[$(basename $0):$LINENO] copy ryzomcore"
cp ${rootdir}/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz ${extradir}/ryzomcore.tar.gz || exit 2
KHANATSERVER=1
fi
@ -310,21 +310,21 @@ fi
DIRBUILD="${rootdir}/${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 khanat data client: $KHANATDATACLIENT"
msg_debug "generate tar ryzom ressources: $RYZOMRESSOURCES"
msg_debug "generate khanat image: $KHANATSERVER"
msg_debug "launch khanat: $LAUNCHKHANAT"
msg_debug "stop khanat: $STOPKHANAT"
msg_debug "[$(basename $0):$LINENO] calldir: $calldir"
msg_debug "[$(basename $0):$LINENO] basedir: $basedir"
msg_debug "[$(basename $0):$LINENO] rootdir: $rootdir"
msg_debug "[$(basename $0):$LINENO] ressourcedir: $ressourcedir"
msg_debug "[$(basename $0):$LINENO] generate basic image: $BASICSERVER"
msg_debug "[$(basename $0):$LINENO] generate tar khanat ressources: $KHANATRESSOURCES"
msg_debug "[$(basename $0):$LINENO] generate tar khanat data client: $KHANATDATACLIENT"
msg_debug "[$(basename $0):$LINENO] generate tar ryzom ressources: $RYZOMRESSOURCES"
msg_debug "[$(basename $0):$LINENO] generate khanat image: $KHANATSERVER"
msg_debug "[$(basename $0):$LINENO] launch khanat: $LAUNCHKHANAT"
msg_debug "[$(basename $0):$LINENO] stop khanat: $STOPKHANAT"
if [[ ! -d ${OPENNEL_CODE_DIR} ]]
then
msg_error "Missing directory opennel-code [${OPENNEL_CODE_DIR}]"
msg_error "[$(basename $0):$LINENO] Missing directory opennel-code [${OPENNEL_CODE_DIR}]"
cat << EOF
You need clone repo khanat-opennel-code.
@ -337,10 +337,10 @@ fi
if [[ $KHANATRESSOURCES -ne 0 ]]
then
msg_info "CREATE TAR with KHANAT Ressources"
msg_info "[$(basename $0):$LINENO] CREATE TAR with KHANAT Ressources"
if [[ ! -d ${ressourcedir} ]]
then
msg_error "Missing khanat-ressources directory ($ressourcedir)"
msg_error "[$(basename $0):$LINENO] Missing khanat-ressources directory ($ressourcedir)"
exit 2
fi
(cd $ressourcedir; tar --exclude='.git' -czf ${extradir}/khanat-ressources.tar.gz .) || exit 2
@ -348,10 +348,10 @@ fi
if [[ $KHANATDATACLIENT -ne 0 ]]
then
msg_info "CREATE TAR with KHANAT DATA CLIENT"
msg_info "[$(basename $0):$LINENO] CREATE TAR with KHANAT DATA CLIENT"
if [[ ! -d ${dataclientdir} ]]
then
msg_error "Missing khanat-client-data directory ($dataclientdir)"
msg_error "[$(basename $0):$LINENO] Missing khanat-client-data directory ($dataclientdir)"
exit 2
fi
(cd $dataclientdir; tar --exclude='.git' -czf ${extradir}/khanat-client-data.tar.gz .) || exit 2
@ -359,10 +359,10 @@ fi
if [[ $RYZOMRESSOURCES -ne 0 ]]
then
msg_info "CREATE TAR with RYZOM Ressources"
msg_info "[$(basename $0):$LINENO] CREATE TAR with RYZOM Ressources"
if [[ ! -d ${ressourcedir} ]]
then
msg_error "Missing khanat-ressources directory ($ressourcedir)"
msg_error "[$(basename $0):$LINENO] Missing khanat-ressources directory ($ressourcedir)"
exit 2
fi
cd ${OPENNEL_CODE_DIR}; tar czf ${extradir}/ryzom-ressources.tar.gz \
@ -376,9 +376,9 @@ fi
if [[ $STOPKHANAT -ne 0 ]]
then
msg_info "STOP SERVER KHANAT"
msg_info "[$(basename $0):$LINENO] STOP SERVER KHANAT"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
msg_debug "CONTAINER KHANAT UP : ${listcontainer[@]}"
msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT UP : ${listcontainer[@]}"
if [[ -n "$listcontainer" ]]
then
docker stop "$listcontainer" || exit 2
@ -387,9 +387,9 @@ fi
if [[ $CLEANCONTAINERKHANAT -ne 0 ]]
then
msg_info "CLEAN CONTAINER KHANAT"
msg_info "[$(basename $0):$LINENO] CLEAN CONTAINER KHANAT"
listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') )
msg_debug "CONTAINER KHANAT EXITED : ${listcontainer[@]}"
msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT EXITED : ${listcontainer[@]}"
if [[ -n "${listcontainer[@]}" ]]
then
docker rm --force "${listcontainer[@]}" || exit 2
@ -398,10 +398,10 @@ fi
if [[ $CLEANIMAGENONE -ne 0 ]]
then
msg_info "CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images | awk '{if ($1=="<none>")print $3}') )
msg_info "[$(basename $0):$LINENO] CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}"
msg_debug "[$(basename $0):$LINENO] IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]]
then
docker rmi --force "${listimages[@]}" || exit 2
@ -410,14 +410,14 @@ fi
if [[ $BASICSERVER -ne 0 ]]
then
msg_info "GENERATE DOCKER IMAGE BASIC SERVER"
msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE BASIC SERVER"
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \
--file "${basedir}/Dockerfile" || exit 2
fi
if [[ $KHANATSERVER -ne 0 ]]
then
msg_info "GENERATE DOCKER IMAGE KHANAT SERVER"
msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE KHANAT SERVER"
cat << EOF > $rootdir/todelete.sh
#!/bin/bash
# Temporary file, use only to send some information on build docker
@ -432,7 +432,7 @@ fi
if [[ $LAUNCHKHANAT -ne 0 ]]
then
msg_info "START KHANAT SERVER"
msg_info "[$(basename $0):$LINENO] START KHANAT SERVER"
cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \
${IMAGEKHANATSERVER} /opt/serverimage_autostart.sh $METHODSTARTSERVER
@ -440,4 +440,4 @@ then
fi
trap '' EXIT
msg_info "END"
msg_info "[$(basename $0):$LINENO] END"

View file

@ -235,7 +235,7 @@ do
shift
;;
*)
msg_error "options '$1' not recognize"
msg_error "[$(basename $0):$LINENO] options '$1' not recognize"
usage
exit 1
;;
@ -244,7 +244,7 @@ done
function chrashed()
{
msg_error "BUILD FAILED (code:$?)"
msg_error "[$(basename $0):$LINENO] BUILD FAILED (code:$?)"
exit 2
}
@ -252,15 +252,15 @@ trap chrashed EXIT
if [[ $SHOWIPKHANATSERVER -eq 0 ]]
then
msg_info "START"
msg_info "[$(basename $0):$LINENO] START"
fi
msg_debug "prg: $0"
msg_debug "[$(basename $0):$LINENO] prg: $0"
docker -v 1>/dev/null
if [[ $? -ne 0 ]]
then
msg_error "docker not installed"
msg_error "[$(basename $0):$LINENO] docker not installed"
exit 2
fi
@ -270,28 +270,28 @@ case "$(uname -m)" in
i686)
;;
*)
msg_error "Unknown archi : $(uname -m)"
msg_error "[$(basename $0):$LINENO] Unknown archi : $(uname -m)"
exit 2
;;
esac
if [[ $REMOVE -ne 0 ]]
then
msg_info "REMOVE DATA KHANAT : $ROOTDATAKHANAT"
msg_info "[$(basename $0):$LINENO] REMOVE DATA KHANAT : $ROOTDATAKHANAT"
if [[ -n "$ROOTDATAKHANAT" ]]
then
rm -rf ${ROOTDATAKHANAT}/* || exit 2
fi
fi
msg_debug "Create directory on host ($ROOTDATAKHANAT)"
msg_debug "[$(basename $0):$LINENO] Create directory on host ($ROOTDATAKHANAT)"
mkdir -p $ROOTDATAKHANAT || exit 2
chmod g+s $ROOTDATAKHANAT
if [[ ($CONNECTSSHKHANAT -ne 0) || ($SHOWIPKHANATSERVER -ne 0) ]]
then
msg_debug "clean container"
msg_debug "[$(basename $0):$LINENO] clean container"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
if [[ ${#listcontainer[@]} -eq 1 ]]
then
@ -310,13 +310,13 @@ if [[ $CONNECTSSHKHANAT -ne 0 ]]
then
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@$ipaddress
trap '' EXIT
msg_info "END SSH"
msg_info "[$(basename $0):$LINENO] END SSH"
exit 0
fi
if [[ $AUTODETEC -ne 0 ]]
then
msg_debug "Autodetect state"
msg_debug "[$(basename $0):$LINENO] Autodetect state"
if [[ $(docker images -f "reference=$IMAGEGENERICSERVER" | wc -l) -lt 2 ]]
then
BASICSERVER=1
@ -345,22 +345,22 @@ fi
DIRBUILD="${rootdir}/${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 "localization khanat-ressources : ${KHANAT_RESSOURCES_DIR}"
msg_debug "localization khanat-client-data: ${KHANAT_CLIENT_DATA_DIR}"
msg_debug "localization opennel-code-client : ${OPENNEL_CODE_DIR}"
msg_debug "generate khanat image: $KHANATSERVER"
msg_debug "launch khanat: $LAUNCHKHANAT"
msg_debug "[$(basename $0):$LINENO] calldir: $calldir"
msg_debug "[$(basename $0):$LINENO] basedir: $basedir"
msg_debug "[$(basename $0):$LINENO] rootdir: $rootdir"
msg_debug "[$(basename $0):$LINENO] ressourcedir: $ressourcedir"
msg_debug "[$(basename $0):$LINENO] generate basic image: $BASICSERVER"
msg_debug "[$(basename $0):$LINENO] localization khanat-ressources : ${KHANAT_RESSOURCES_DIR}"
msg_debug "[$(basename $0):$LINENO] localization khanat-client-data: ${KHANAT_CLIENT_DATA_DIR}"
msg_debug "[$(basename $0):$LINENO] localization opennel-code-client : ${OPENNEL_CODE_DIR}"
msg_debug "[$(basename $0):$LINENO] generate khanat image: $KHANATSERVER"
msg_debug "[$(basename $0):$LINENO] launch khanat: $LAUNCHKHANAT"
msg_debug "stop khanat: $STOPKHANAT"
msg_info "check khanat-ressources"
msg_info "[$(basename $0):$LINENO] check khanat-ressources"
if [[ ! -d ${KHANAT_RESSOURCES_DIR} ]]
then
msg_error "Missing directory khanat-ressources [${KHANAT_RESSOURCES_DIR}]"
msg_error "[$(basename $0):$LINENO] Missing directory khanat-ressources [${KHANAT_RESSOURCES_DIR}]"
cat << EOF
You need clone repo khanat-ressource.
@ -372,10 +372,10 @@ EOF
fi
msg_info "check khanat-client-data"
msg_info "[$(basename $0):$LINENO] check khanat-client-data"
if [[ ! -d ${KHANAT_CLIENT_DATA_DIR} ]]
then
msg_error "Missing directory khanat-client-data [${KHANAT_CLIENT_DATA_DIR}]"
msg_error "[$(basename $0):$LINENO] Missing directory khanat-client-data [${KHANAT_CLIENT_DATA_DIR}]"
cat << EOF
You need clone repo khanat-client-data.
@ -388,7 +388,7 @@ fi
if [[ ! -d ${OPENNEL_CODE_DIR} ]]
then
msg_error "Missing directory opennel-code [${OPENNEL_CODE_DIR}]"
msg_error "[$(basename $0):$LINENO] Missing directory opennel-code [${OPENNEL_CODE_DIR}]"
cat << EOF
You need clone repo khanat-opennel-code.
@ -400,9 +400,9 @@ EOF
fi
if [[ $STOPKHANAT -ne 0 ]]
then
msg_info "STOP SERVER KHANAT"
msg_info "[$(basename $0):$LINENO] STOP SERVER KHANAT"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
msg_debug "CONTAINER KHANAT UP : ${listcontainer[@]}"
msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT UP : ${listcontainer[@]}"
if [[ -n "$listcontainer" ]]
then
docker stop "$listcontainer" || exit 2
@ -411,9 +411,9 @@ fi
if [[ $CLEANCONTAINERKHANAT -ne 0 ]]
then
msg_info "CLEAN CONTAINER KHANAT"
msg_info "[$(basename $0):$LINENO] CLEAN CONTAINER KHANAT"
listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') )
msg_debug "CONTAINER KHANAT EXITED : ${listcontainer[@]}"
msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT EXITED : ${listcontainer[@]}"
if [[ -n "${listcontainer[@]}" ]]
then
docker rm --force "${listcontainer[@]}" || exit 2
@ -422,10 +422,10 @@ fi
if [[ $CLEANIMAGENONE -ne 0 ]]
then
msg_info "CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images | awk '{if ($1=="<none>")print $3}') )
msg_info "[$(basename $0):$LINENO] CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}"
msg_debug "[$(basename $0):$LINENO] IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]]
then
docker rmi --force "${listimages[@]}" || exit 2
@ -434,14 +434,14 @@ fi
if [[ $BASICSERVER -ne 0 ]]
then
msg_info "GENERATE DOCKER IMAGE BASIC SERVER"
msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE BASIC SERVER"
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \
--file "${basedir}/Dockerfile" || exit 2
fi
if [[ $KHANATSERVER -ne 0 ]]
then
msg_info "GENERATE DOCKER IMAGE KHANAT SERVER"
msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE KHANAT SERVER"
cat << EOF > $rootdir/${ENVIFILE}
#!/bin/bash
# Temporary file, use only to send some information on build docker
@ -457,10 +457,10 @@ fi
if [[ $CONFIGUREKHANATSERVER -ne 0 ]]
then
msg_info "CONFIGURE KHANAT SERVER"
msg_info "[$(basename $0):$LINENO] CONFIGURE KHANAT SERVER"
mkdir -p $DIRLOG || exit 2
mkdir -p $DIRDATABASE || exit 2
msg_debug "command : cd $rootdir; docker run -it --hostname=khanat \
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 \
@ -488,8 +488,8 @@ fi
if [[ $UPDATEDATA -ne 0 ]]
then
msg_info "UPDATE KHANAT SERVER"
msg_debug "command: cd $rootdir; docker run -it --hostname=khanat \
msg_info "[$(basename $0):$LINENO] UPDATE KHANAT SERVER"
msg_debug "[$(basename $0):$LINENO] command: cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
-v ${OPENNEL_CODE_DIR}/code/web/:/home/gameserver/ext/khanatweb:ro \
@ -517,7 +517,7 @@ fi
if [[ $LAUNCHKHANAT -ne 0 ]]
then
msg_info "START KHANAT SERVER"
msg_info "[$(basename $0):$LINENO] START KHANAT SERVER"
cd $rootdir; docker run -it --hostname=khanat \
-u "$(id -u $USERNAME):$(id -g $USERNAME)" \
-v /etc/localtime:/etc/localtime:ro \
@ -534,4 +534,4 @@ then
fi
trap '' EXIT
msg_info "END"
msg_info "[$(basename $0):$LINENO] END"

View file

@ -35,8 +35,8 @@ declare -i METHODSTARTSERVER=1
declare -i CLEANIMAGENONE=0
declare DOCKERBUILDOPT=""
declare IMAGEGENERICSERVER="server_generic_debian_jessie_x86_64"
declare IMAGEKHANATSERVER="serverimage_khanat_debian_jessie_x86_64"
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 DIRCLIENT="Khanat_Linux64"
declare PACKAGECLIENT="smokey_linux64"
@ -211,10 +211,10 @@ trap chrashed EXIT
if [[ $SHOWIPKHANATSERVER -eq 0 ]]
then
msg_info "START"
msg_info "[$(basename $0):$LINENO] START"
fi
msg_debug "prg: $0"
msg_debug "[$(basename $0):$LINENO] prg: $0"
extradir="${rootdir}/${DIROUTPUT}"
mkdir -p ${extradir} || exit 2
@ -223,7 +223,7 @@ mkdir -p ${extradir} || exit 2
docker -v 1>/dev/null
if [[ $? -ne 0 ]]
then
msg_error "docker not installed"
msg_error "[$(basename $0):$LINENO] docker not installed"
exit 2
fi
@ -233,7 +233,7 @@ case "$(uname -m)" in
i686)
;;
*)
msg_error "Unknown archi : $(uname -m)"
msg_error "[$(basename $0):$LINENO] Unknown archi : $(uname -m)"
exit 2
;;
esac
@ -258,7 +258,7 @@ if [[ $CONNECTSSHKHANAT -ne 0 ]]
then
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no gameserver@$ipaddress
trap '' EXIT
msg_info "END SSH"
msg_info "[$(basename $0):$LINENO] END SSH"
exit 0
fi
@ -297,10 +297,10 @@ then
sumsrc=1
sumdsr=2
fi
msg_debug "ryzomcore checksum src:$sumsrc dst:$sumdst"
msg_debug "[$(basename $0):$LINENO] ryzomcore checksum src:$sumsrc dst:$sumdst"
if [[ "$sumsrc" != "$sumdst" ]]
then
msg_debug "copy ryzomcore"
msg_debug "[$(basename $0):$LINENO] copy ryzomcore"
cp ${rootdir}/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz ${extradir}/ryzomcore.tar.gz || exit 2
KHANATSERVER=1
fi
@ -308,21 +308,21 @@ fi
DIRBUILD="${rootdir}/${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 khanat data client: $KHANATDATACLIENT"
msg_debug "generate tar ryzom ressources: $RYZOMRESSOURCES"
msg_debug "generate khanat image: $KHANATSERVER"
msg_debug "launch khanat: $LAUNCHKHANAT"
msg_debug "stop khanat: $STOPKHANAT"
msg_debug "[$(basename $0):$LINENO] calldir: $calldir"
msg_debug "[$(basename $0):$LINENO] basedir: $basedir"
msg_debug "[$(basename $0):$LINENO] rootdir: $rootdir"
msg_debug "[$(basename $0):$LINENO] ressourcedir: $ressourcedir"
msg_debug "[$(basename $0):$LINENO] generate basic image: $BASICSERVER"
msg_debug "[$(basename $0):$LINENO] generate tar khanat ressources: $KHANATRESSOURCES"
msg_debug "[$(basename $0):$LINENO] generate tar khanat data client: $KHANATDATACLIENT"
msg_debug "[$(basename $0):$LINENO] generate tar ryzom ressources: $RYZOMRESSOURCES"
msg_debug "[$(basename $0):$LINENO] generate khanat image: $KHANATSERVER"
msg_debug "[$(basename $0):$LINENO] launch khanat: $LAUNCHKHANAT"
msg_debug "[$(basename $0):$LINENO] stop khanat: $STOPKHANAT"
if [[ ! -d ${OPENNEL_CODE_DIR} ]]
then
msg_error "Missing directory opennel-code [${OPENNEL_CODE_DIR}]"
msg_error "[$(basename $0):$LINENO] Missing directory opennel-code [${OPENNEL_CODE_DIR}]"
cat << EOF
You need clone repo khanat-opennel-code.
@ -335,10 +335,10 @@ fi
if [[ $KHANATRESSOURCES -ne 0 ]]
then
msg_info "CREATE TAR with KHANAT Ressources"
msg_info "[$(basename $0):$LINENO] CREATE TAR with KHANAT Ressources"
if [[ ! -d ${ressourcedir} ]]
then
msg_error "Missing khanat-ressources directory ($ressourcedir)"
msg_error "[$(basename $0):$LINENO] Missing khanat-ressources directory ($ressourcedir)"
exit 2
fi
(cd $ressourcedir; tar --exclude='.git' -czf ${extradir}/khanat-ressources.tar.gz .) || exit 2
@ -346,10 +346,10 @@ fi
if [[ $KHANATDATACLIENT -ne 0 ]]
then
msg_info "CREATE TAR with KHANAT DATA CLIENT"
msg_info "[$(basename $0):$LINENO] CREATE TAR with KHANAT DATA CLIENT"
if [[ ! -d ${dataclientdir} ]]
then
msg_error "Missing khanat-client-data directory ($dataclientdir)"
msg_error "[$(basename $0):$LINENO] Missing khanat-client-data directory ($dataclientdir)"
exit 2
fi
(cd $dataclientdir; tar --exclude='.git' -czf ${extradir}/khanat-client-data.tar.gz .) || exit 2
@ -357,10 +357,10 @@ fi
if [[ $RYZOMRESSOURCES -ne 0 ]]
then
msg_info "CREATE TAR with RYZOM Ressources"
msg_info "[$(basename $0):$LINENO] CREATE TAR with RYZOM Ressources"
if [[ ! -d ${ressourcedir} ]]
then
msg_error "Missing khanat-ressources directory ($ressourcedir)"
msg_error "[$(basename $0):$LINENO] Missing khanat-ressources directory ($ressourcedir)"
exit 2
fi
cd ${OPENNEL_CODE_DIR}; tar czf ${extradir}/ryzom-ressources.tar.gz \
@ -374,9 +374,9 @@ fi
if [[ $STOPKHANAT -ne 0 ]]
then
msg_info "STOP SERVER KHANAT"
msg_info "[$(basename $0):$LINENO] STOP SERVER KHANAT"
listcontainer="$(docker ps -qf 'status=running' -f 'ancestor='"${IMAGEKHANATSERVER}"'')"
msg_debug "CONTAINER KHANAT UP : ${listcontainer[@]}"
msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT UP : ${listcontainer[@]}"
if [[ -n "$listcontainer" ]]
then
docker stop "$listcontainer" || exit 2
@ -385,9 +385,9 @@ fi
if [[ $CLEANCONTAINERKHANAT -ne 0 ]]
then
msg_info "CLEAN CONTAINER KHANAT"
msg_info "[$(basename $0):$LINENO] CLEAN CONTAINER KHANAT"
listcontainer=( $(docker ps -qf 'status=exited' -f 'ancestor='"${IMAGEKHANATSERVER}"'') )
msg_debug "CONTAINER KHANAT EXITED : ${listcontainer[@]}"
msg_debug "[$(basename $0):$LINENO] CONTAINER KHANAT EXITED : ${listcontainer[@]}"
if [[ -n "${listcontainer[@]}" ]]
then
docker rm --force "${listcontainer[@]}" || exit 2
@ -396,10 +396,10 @@ fi
if [[ $CLEANIMAGENONE -ne 0 ]]
then
msg_info "CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images | awk '{if ($1=="<none>")print $3}') )
msg_info "[$(basename $0):$LINENO] CLEAN IMAGE DOCKER 'NONE'"
listimages=( $(docker images --filter "dangling=true" --format "{{.ID}}") )
msg_debug "IMAGES NONE : ${listimages[@]}"
msg_debug "[$(basename $0):$LINENO] IMAGES NONE : ${listimages[@]}"
if [[ -n "${listimages[@]}" ]]
then
docker rmi --force "${listimages[@]}" || exit 2
@ -408,14 +408,14 @@ fi
if [[ $BASICSERVER -ne 0 ]]
then
msg_info "GENERATE DOCKER IMAGE BASIC SERVER"
msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE BASIC SERVER"
cd $rootdir; docker build . ${DOCKERBUILDOPT} -t ${IMAGEGENERICSERVER} \
--file "${basedir}/Dockerfile" || exit 2
fi
if [[ $KHANATSERVER -ne 0 ]]
then
msg_info "GENERATE DOCKER IMAGE KHANAT SERVER"
msg_info "[$(basename $0):$LINENO] GENERATE DOCKER IMAGE KHANAT SERVER"
cat << EOF > $rootdir/todelete.sh
#!/bin/bash
# Temporary file, use only to send some information on build docker
@ -430,7 +430,7 @@ fi
if [[ $LAUNCHKHANAT -ne 0 ]]
then
msg_info "START KHANAT SERVER"
msg_info "[$(basename $0):$LINENO] START KHANAT SERVER"
cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \
${IMAGEKHANATSERVER} /opt/serverimage_autostart.sh $METHODSTARTSERVER
@ -438,4 +438,4 @@ then
fi
trap '' EXIT
msg_info "END"
msg_info "[$(basename $0):$LINENO] END"