add autodeploy bash scripts

This commit is contained in:
staging new 2021-06-22 10:35:47 +02:00
parent bade847619
commit f49cf4d7f8
4 changed files with 105 additions and 0 deletions

View File

@ -0,0 +1,29 @@
#!/bin/bash
# stop login_server running in screen
screen -XS login quit
# rebuild login-server
cd ../../login_server
if [ ! -d "./build" ] ; then
cd scripts
./prepare_build.sh
cd ..
fi
cd build
cmake ..
make -j$(nproc) Gradido_LoginServer
# rebuild locales
cd ../scripts
./compile_pot.sh
cd ../src/LOCALE
cp *.mo *.po /etc/grd_login/LOCALE/
cd ../../build/bin
# start login-server
screen -dmS 'login_server' bash -c './Gradido_LoginServer'

View File

@ -0,0 +1,13 @@
#!/bin/bash
# For that to work, node v12.19.0 needs to be installed with nvm for root
# or NPM_BIN Path and NVM_DIR must be adjusted
cd /var/www/html/gradido/frontend
NPM_BIN=/root/.nvm/versions/node/v12.19.0/bin/npm
export NVM_DIR="/root/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
$NPM_BIN install
$NPM_BIN run build

View File

@ -0,0 +1,54 @@
#!/bin/bash
EMPTY_UPDATE_HTML=/var/www/html/admin/updating_original.html
UPDATE_HTML=/var/www/html/admin/updating.html
LOCK_FILE=/root/relay.lock
#PROJECT_PATH=/var/www/html/gradido
PROJECT_PATH=/root/code/gradido
SITE_CONFIG=stage1
UPDATE_SITE_CONFIG=stage1_updating
# this script can be called for example from webhookrelay.com relay
# to auto-deploy automatic after a update to the master branch
if [ -f $LOCK_FILE ] ; then
retVal="Already building!"
return "${retVal}" 2>/dev/null || exit "${retVal}"
fi
touch $LOCK_FILE
# start with nearly empty html
# needed a nearly empty html page in the folder
cp $EMPTY_UPDATE_HTML $UPDATE_HTML
# let nginx showing a update page
# needed nginx site-configs in nginx folders
# gradido for running gradido servers
# gradido_updating for showing upddate.html idealy for all pathes
rm /etc/nginx/sites-enabled/$SITE_CONFIG
ln -s /etc/nginx/sites-available/$UPDATE_SITE_CONFIG /etc/nginx/sites-enabled/
service nginx restart
# stop login server
screen -XS login quit
echo 'starting with git pull<br>' >> $UPDATE_HTML
cd $PROJECT_PATH
# git checkout -f master
git pull
cd deployment/bare_metal
echo 'update schemas' >> $UPDATE_HTML
./update_db_schemas.sh
echo 'starting with rebuilding login-server<br>' >> $UPDATE_HTML
./build_and_start_login_server.sh
echo 'starting with rebuilding frontend<br>' >> $UPDATE_HTML
./build_frontend.sh
# let nginx showing gradido
rm /etc/nginx/sites-enabled/$UPDATE_SITE_CONFIG
ln -s /etc/nginx/sites-available/$SITE_CONFIG /etc/nginx/sites-enabled/
service nginx restart
rm $LOCK_FILE

View File

@ -0,0 +1,9 @@
#!/bin/bash
# For that to work skeema needed to be installed on system
# in login_server/skeema and community_server/db/skeema skeema configuration files need to be there also in the subfolders
# Update DB Schemas (only the schemas, not the data)
cd ../../login_server/skeema
skeema push --allow-unsafe
cd ../../community_server/db/skeema
skeema push --allow-unsafe