add federation-module to deployment script

This commit is contained in:
Claus-Peter Hübner 2023-02-22 22:42:18 +01:00
parent 56485d2d75
commit c9df716eb3
2 changed files with 28 additions and 13 deletions

View File

@ -1,18 +1,25 @@
#!/bin/bash
echo "Before getopt"
for i
do
echo $i
done
args=`getopt b:p: $*`
set -- $args
echo "After getopt"
for i
do
echo "-->$i"
while [ "$#" -gt 0 ]; do
case "$1" in
-a) ARG_API="${2:-1_0}"; shift 2;;
-b) ARG_BRANCH="${2:-master}"; shift 2;;
--api-version=*) ARG_API="${1#*=}"; shift 1;;
--branch=*) ARG_BRANCH="${1#*=}"; shift 1;;
--api-version|--branch) echo "$1 requires an argument" >&2; exit 1;;
-*) echo "unknown option: $1" >&2; exit 1;;
*) handle_argument "$1"; shift 1;;
esac
done
echo "=================================================="
echo "Arguments:"
echo " -api-version = $ARG_API"
echo " -branch = $ARG_BRANCH"
echo "=================================================="
# Find current directory & configure paths
set -o allexport
SCRIPT_PATH=$(realpath $0)
@ -76,7 +83,8 @@ echo 'Stopping all Gradido services' >> $UPDATE_HTML
pm2 stop all
# git
BRANCH=${1:-master}
# BRANCH=${1:-master}
BRANCH=$ARG_BRANCH
echo "Starting with git pull - branch:$BRANCH" >> $UPDATE_HTML
cd $PROJECT_ROOT
# TODO: this overfetches alot, but ensures we can use start.sh with tags
@ -177,6 +185,13 @@ yarn build
# TODO maybe handle this differently?
export NODE_ENV=production
pm2 delete gradido-federation
# set FEDERATION_PORT from ARG_API
port=${ARG_API//_/}
FEDERATION_PORT=$(($FEDERATION_PORT + $port))
export FEDERATION_PORT
echo "===================================================="
echo " start federation listening on port=$FEDERATION_PORT
echo "===================================================="
pm2 start --name gradido-federation "yarn --cwd $PROJECT_ROOT/federation start" -l $GRADIDO_LOG_PATH/pm2.federation.$TODAY.log --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS'
pm2 save

View File

@ -73,7 +73,7 @@ if (
const federation = {
// FEDERATION_DHT_TOPIC: process.env.FEDERATION_DHT_TOPIC || null,
// FEDERATION_DHT_SEED: process.env.FEDERATION_DHT_SEED || null,
FEDERATION_PORT: process.env.FEDERATION_PORT || 5010,
FEDERATION_PORT: process.env.FEDERATION_PORT || 5000,
FEDERATION_API: process.env.FEDERATION_API || '1_0',
FEDERATION_COMMUNITY_URL: process.env.FEDERATION_COMMUNITY_URL || null,
}