# Configuration for Continous Integration # # Copyright (C) 2017 AleaJactaEst # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Example to execute locally: # gitlab-runner exec docker --kubernetes-memory-limit="10g" --kubernetes-service-memory-limit="10g" --kubernetes-memory-request="10g" --kubernetes-helper-memory-limit="10g" 'Linux server build' # gitlab-runner exec docker --timeout=3600 'Linux server build' # gitlab-runner exec docker --timeout=3600 --kubernetes-memory-limit="10g" --kubernetes-service-memory-limit="10g" --kubernetes-memory-request="10g" --kubernetes-helper-memory-limit="10g" --docker-volumes $PWD/builds:/builds 'Linux server debian buster build' stages: - build Linux server build: stage: build tags: - Docker image: amd64/debian:9 script: - export -p WORKDIR=$PWD - apt-get update - apt-get dist-upgrade -y - DEBIAN_FRONTEND=noninteractive apt-get install -y bash-completion bsd-mailx cron curl debootstrap fakechroot fakeroot git jq less logrotate lzma nano net-tools openssh-server p7zip p7zip-full schroot sudo unzip vim wget xdelta python3-pip python3-bcrypt libxml2 libpng16-16 libjpeg62-turbo libxmu6 libgif7 libssl1.1 liblzma5 zlib1g libssh2-1 libtool libxml2 mysql-server apache2 apache2-utils libapache2-mod-php mcrypt php php-gd php-imagick php-mcrypt php-mysql python3 rrdtool screen phpmyadmin phpmyadmin - mkdir -p /opt/download - export -p DIR_ARTEFACTS="/opt/download" - (cd /opt/download ; $WORKDIR/server/common/download_artefacts.sh 'https://git.khaganat.net' 'khaganat' 'mmorpg_khanat/khanat-opennel-code' $CI_COMMIT_REF_NAME 'develop' 'master') - (cd /opt/download ; $WORKDIR/server/common/download_artefacts.sh 'https://git.khaganat.net' 'khaganat' 'mmorpg_khanat/opennel-pymanager' $CI_COMMIT_REF_NAME 'develop' 'master') - ls -l /opt/download - mkdir -p /opt/artefacts - (cd /opt/artefacts ; for file in /opt/download/khanat-server_static-debian_amd64_strech*.zip ; do echo "extract $file"; unzip -q -o $file; done) - (cd /opt/artefacts ; for file in /opt/download/khanat-client_static-debian_amd64_strech*.zip ; do echo "extract $file"; unzip -q -o $file; done) - (cd /opt/artefacts ; for file in /opt/download/opennel-manager-*.zip ; do echo "extract $file"; unzip -q -o $file; done) - mkdir -p /opt/ext - cp $WORKDIR/server/debian/common/servercontainer_init_* /opt/ - cp $WORKDIR/server/debian/common/servercontainer_function.sh /opt/ - cp $WORKDIR/server/debian/common/* /opt/ext - cp $WORKDIR/server/debian/common/khaganat.cfg /opt/ext - mkdir -p /opt/rootweb - cp $WORKDIR/server/common/rootweb/* /opt/rootweb/ - echo -e 'export KHANAT_CLIENT_VERSION="1"\nexport UIDGAMESERVER=1000\nexport GIDGAMESERVER=1000\nexport DIRCLIENT="Khanat_Linux64"\nexport PACKAGECLIENT="smokey_linux64"' > /opt/khanat_config.sh - mkdir -p /var/run/mysqld - /opt/servercontainer_init_create_account.sh - /opt/servercontainer_init_mysql.sh - /opt/servercontainer_init_apache.sh - /opt/servercontainer_init_configure_envi.sh - source /home/gameserver/.bashrc # - export -p KHANAT_HOME=/home/gameserver # - export -p KHANAT_PATH=/home/gameserver/khanat # - export -p PATH=$PATH:/usr/local/bin # - export -p PATCH_CLIENT_SYSTEM=$KHANAT_HOME/khanat/patch_service # - export -p DIRCLIENT="Khanat_Linux64" # - export -p PACKAGECLIENT="smokey_linux64" # - export -p PREPARE_CLIENT_DIR="khanat/prepare_client/$DIRCLIENT" # - export -p CLIENT_DIR="khanat/client_service" # - export -p HOME_PREPARE_CLIENT="$KHANAT_HOME/$PREPARE_CLIENT_DIR" # - export -p HOME_CLIENT="$KHANAT_HOME/$CLIENT_DIR" - echo "KHANAT_PATH $KHANAT_PATH" - mkdir -p $KHANAT_PATH - mkdir -p /home/gameserver/ext - ln -s /opt/artefacts/code/web /home/gameserver/ext/khanatweb - ln -s /opt/artefacts/code/ryzom /home/gameserver/ext/ryzom-ressources - (cd /home/gameserver/ext; git clone -q https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-ressources.git) #- ln -s /opt/download/khanat-ressources /home/gameserver/ext/khanat-ressources - (cd /home/gameserver/ext; git clone -q https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-client-data.git) #- ln -s /opt/download/khanat-client-data /home/gameserver/ext/khanat-client-data - for file in /opt/artefacts/code/build/bin/* ; do ln -s $file /usr/local/bin ; done - for file in /opt/artefacts/code/build/lib/* ; do ln -s $file /usr/local/lib ; done - ldconfig - /opt/ext/servercontainer_configure_auto.sh - /opt/ext/servercontainer_update_auto.sh # Install pymanager - ls /opt/artefacts/dist/ - pip3 install /opt/artefacts/dist/opennel_manager-*.whl # Clean - rm -f /opt/servercontainer* # Create image - option="" - echo "khanat-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID-server-debian-stretch" > /home/gameserver/version.txt - for dir in /home/* ; do if [ $dir != '/home/gameserver' ] ; then option="$option --exclude=$dir" ; fi ; done - echo "option '$option'" #- find /home/gameserver -type d -exec du -sh {} \; - find /opt -type d -exec du -sh {} \; - tar --numeric-owner --exclude=.git --exclude=.dockerenv --exclude=/proc --exclude=/sys --exclude=/builds --exclude=/opt/download --exclude=khanat-debian-server.tar.gz $option -czf khanat-debian-server.tar.gz / - ls -lh khanat-debian-server.* artifacts: name: "khanat-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID-server-debian-stretch" paths: - khanat-debian-server.tar.gz when: manual Linux server debian buster build: stage: build tags: - Docker image: amd64/debian:10 script: - export -p WORKDIR=$PWD - apt-get update - apt-get dist-upgrade -y - DEBIAN_FRONTEND=noninteractive apt-get install -y curl nano vim less bash-completion cron logrotate bsd-mailx openssh-server sudo net-tools lzma xdelta p7zip p7zip-full default-mysql-server apache2 php libapache2-mod-php php-mysql apache2-utils php-gd php-imagick rrdtool screen mcrypt python3 gdb valgrind electric-fence python3-pip python3-bcrypt python3-pip ddd libc6 libgnutls28-dev libgnutlsxx28 php7.3-curl php7.3-mbstring patch gcc make autoconf libc-dev pkg-config libmcrypt-dev php-pear php7.3-dev wget jq git unzip - pecl install mcrypt-1.0.2 - sed -i 's/;extension=xsl/extension=mcrypt.so/g' /etc/php/7.3/cli/php.ini - sed -i 's/;extension=xsl/extension=mcrypt.so/g' /etc/php/7.3/apache2/php.ini - wget -q https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.tar.gz - mkdir -p /etc/phpmyadmin /usr/share/phpmyadmin /var/lib/phpmyadmin/tmp - tar xf phpMyAdmin-4.9.0.1-all-languages.tar.gz -C /usr/share/phpmyadmin --strip 1 - chown -R www-data:www-data /var/lib/phpmyadmin - cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php - mkdir -p /opt/download - export -p DIR_ARTEFACTS="/opt/download" - (cd /opt/download ; $WORKDIR/server/common/download_artefacts.sh 'https://git.khaganat.net' 'khaganat' 'mmorpg_khanat/khanat-opennel-code' $CI_COMMIT_REF_NAME 'develop' 'master') - (cd /opt/download ; $WORKDIR/server/common/download_artefacts.sh 'https://git.khaganat.net' 'khaganat' 'mmorpg_khanat/opennel-pymanager' $CI_COMMIT_REF_NAME 'develop' 'master') - ls -l /opt/download - mkdir -p /opt/artefacts - (cd /opt/artefacts ; for file in /opt/download/khanat-server_static_debug-debian_amd64_buster*.zip ; do echo "extract $file"; unzip -q -o $file; done) - (cd /opt/artefacts ; for file in /opt/download/khanat-client-debian_buster*.zip ; do echo "extract $file"; unzip -q -o $file; done) - (cd /opt/artefacts ; for file in /opt/download/opennel-manager-*.zip ; do echo "extract $file"; unzip -q -o $file; done) - mkdir -p /opt/ext - cp $WORKDIR/server/debian/common/servercontainer_init_* /opt/ - cp $WORKDIR/server/debian/common/servercontainer_function.sh /opt/ - cp $WORKDIR/server/debian/common/* /opt/ext - cp $WORKDIR/server/debian/common/khaganat.cfg /opt/ext - mkdir -p /opt/rootweb - cp $WORKDIR/server/common/rootweb/* /opt/rootweb/ - echo -e 'export KHANAT_CLIENT_VERSION="1"\nexport UIDGAMESERVER=1000\nexport GIDGAMESERVER=1000\nexport DIRCLIENT="Khanat_Linux64"\nexport PACKAGECLIENT="smokey_linux64"' > /opt/khanat_config.sh - mkdir -p /var/run/mysqld - /opt/servercontainer_init_create_account.sh - /opt/servercontainer_init_mysql.sh - /opt/servercontainer_init_apache.sh - /opt/servercontainer_init_configure_envi.sh - source /home/gameserver/.bashrc # - export -p KHANAT_HOME=/home/gameserver # - export -p KHANAT_PATH=/home/gameserver/khanat # - export -p PATH=$PATH:/usr/local/bin # - export -p PATCH_CLIENT_SYSTEM=$KHANAT_HOME/khanat/patch_service # - export -p DIRCLIENT="Khanat_Linux64" # - export -p PACKAGECLIENT="smokey_linux64" # - export -p PREPARE_CLIENT_DIR="khanat/prepare_client/$DIRCLIENT" # - export -p CLIENT_DIR="khanat/client_service" # - export -p HOME_PREPARE_CLIENT="$KHANAT_HOME/$PREPARE_CLIENT_DIR" # - export -p HOME_CLIENT="$KHANAT_HOME/$CLIENT_DIR" - echo "KHANAT_PATH $KHANAT_PATH" - mkdir -p $KHANAT_PATH - mkdir -p /home/gameserver/ext - ln -s /opt/artefacts/code/web /home/gameserver/ext/khanatweb - ln -s /opt/artefacts/code/ryzom /home/gameserver/ext/ryzom-ressources - (cd /home/gameserver/ext; git clone -q https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-ressources.git) #- ln -s /opt/download/khanat-ressources /home/gameserver/ext/khanat-ressources - (cd /home/gameserver/ext; git clone -q https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-client-data.git) #- ln -s /opt/download/khanat-client-data /home/gameserver/ext/khanat-client-data - for file in /opt/artefacts/code/build/bin/* ; do ln -s $file /usr/local/bin ; done - for file in /opt/artefacts/code/build/lib/* ; do ln -s $file /usr/local/lib ; done - ldconfig - /opt/ext/servercontainer_configure_auto.sh - /opt/ext/servercontainer_update_auto.sh # Install pymanager - ls /opt/artefacts/dist/ - pip3 install /opt/artefacts/dist/opennel_manager-*.whl # Clean - rm -f /opt/servercontainer* # Create image - option="" - echo "khanat-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID-server-debian-stretch" > /home/gameserver/version.txt - for dir in /home/* ; do if [ $dir != '/home/gameserver' ] ; then option="$option --exclude=$dir" ; fi ; done - echo "option '$option'" #- find /home/gameserver -type d -exec du -sh {} \; - find /opt -type d -exec du -sh {} \; - tar --numeric-owner --exclude=.git --exclude=.dockerenv --exclude=/proc --exclude=/sys --exclude=/builds --exclude=/opt/download --exclude=khanat-debian-skedelererver.tar.gz $option -czf khanat-debian-server.tar.gz / - ls -lh khanat-debian-server.* artifacts: name: "khanat-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID-server-debian-buster" paths: - khanat-debian-server.tar.gz