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

View File

@ -73,7 +73,7 @@ if (
const federation = { const federation = {
// FEDERATION_DHT_TOPIC: process.env.FEDERATION_DHT_TOPIC || null, // FEDERATION_DHT_TOPIC: process.env.FEDERATION_DHT_TOPIC || null,
// FEDERATION_DHT_SEED: process.env.FEDERATION_DHT_SEED || 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_API: process.env.FEDERATION_API || '1_0',
FEDERATION_COMMUNITY_URL: process.env.FEDERATION_COMMUNITY_URL || null, FEDERATION_COMMUNITY_URL: process.env.FEDERATION_COMMUNITY_URL || null,
} }