From 4ab9b9bc17824056051c4c3d6062b0da0fc6c28e Mon Sep 17 00:00:00 2001 From: Gustavo Trott Date: Thu, 31 Mar 2022 13:48:57 -0300 Subject: [PATCH] Improve scripts to run/deploy applications --- akka-bbb-apps/deploy.sh | 13 ++++++++++++ akka-bbb-apps/run-dev.sh | 11 +++++++++- bigbluebutton-html5/deploy_to_usr_share.sh | 5 ++++- bigbluebutton-html5/run-dev.sh | 17 +++++++++++++++ bigbluebutton-web/deploy_to_usr_share.sh | 24 ++++++++++++++++++++++ bigbluebutton-web/run-dev.sh | 9 ++------ 6 files changed, 70 insertions(+), 9 deletions(-) create mode 100755 akka-bbb-apps/deploy.sh create mode 100755 bigbluebutton-html5/run-dev.sh create mode 100755 bigbluebutton-web/deploy_to_usr_share.sh diff --git a/akka-bbb-apps/deploy.sh b/akka-bbb-apps/deploy.sh new file mode 100755 index 0000000000..e174c7ae71 --- /dev/null +++ b/akka-bbb-apps/deploy.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +cd "$(dirname "$0")" + +sudo service bbb-apps-akka stop +sbt debian:packageBin +sudo dpkg -i target/bbb-apps-akka_*.deb +echo '' +echo '' +echo '----------------' +echo 'bbb-web updated' + +sudo service bbb-apps-akka start +echo 'starting service bbb-web' \ No newline at end of file diff --git a/akka-bbb-apps/run-dev.sh b/akka-bbb-apps/run-dev.sh index cbff39c7b7..1e074930a0 100755 --- a/akka-bbb-apps/run-dev.sh +++ b/akka-bbb-apps/run-dev.sh @@ -1,5 +1,14 @@ #!/usr/bin/env bash +sudo service bbb-apps-akka stop + rm -rf src/main/resources cp -R src/universal/conf src/main/resources -exec sbt update run + +#Set correct sharedSecret and bbbWebAPI +sudo sed -i "s/sharedSecret = \"changeme\"/sharedSecret = \"$(sudo bbb-conf --salt | grep Secret: | cut -d ' ' -f 6)\"/g" src/main/resources/application.conf +sudo sed -i "s/bbbWebAPI = \"https:\/\/192.168.23.33\/bigbluebutton\/api\"/bbbWebAPI = \"https:\/\/$(hostname -f)\/bigbluebutton\/api\"/g" src/main/resources/application.conf + +#sbt update - Resolves and retrieves external dependencies, more details in https://www.scala-sbt.org/1.x/docs/Command-Line-Reference.html +#sbt ~reStart (instead of run) - run with "triggered restart" mode, more details in #https://github.com/spray/sbt-revolver +exec sbt update ~reStart diff --git a/bigbluebutton-html5/deploy_to_usr_share.sh b/bigbluebutton-html5/deploy_to_usr_share.sh index 1c7bdf136a..696387e7f9 100755 --- a/bigbluebutton-html5/deploy_to_usr_share.sh +++ b/bigbluebutton-html5/deploy_to_usr_share.sh @@ -1,4 +1,5 @@ #!/bin/sh -ex +cd "$(dirname "$0")" # Please check bigbluebutton/bigbluebutton-html5/dev_local_deployment/README.md @@ -6,7 +7,7 @@ UPPER_DESTINATION_DIR=/usr/share/meteor DESTINATION_DIR=$UPPER_DESTINATION_DIR/bundle SERVICE_FILES_DIR=/usr/lib/systemd/system -LOCAL_PACKAGING_DIR=/home/bigbluebutton/dev/bigbluebutton/build/packages-template/bbb-html5 +LOCAL_PACKAGING_DIR="$(pwd)/../build/packages-template/bbb-html5" if [ ! -d "$LOCAL_PACKAGING_DIR" ]; then echo "Did not find LOCAL_PACKAGING_DIR=$LOCAL_PACKAGING_DIR" @@ -65,6 +66,8 @@ sudo chown -R meteor:meteor "$UPPER_DESTINATION_DIR"/ sudo chmod +x "$DESTINATION_DIR"/mongod_start_pre.sh sudo chmod +x "$DESTINATION_DIR"/systemd_start.sh sudo chmod +x "$DESTINATION_DIR"/systemd_start_frontend.sh + +sudo cp $LOCAL_PACKAGING_DIR/workers-start.sh "$DESTINATION_DIR"/workers-start.sh sudo chmod +x "$DESTINATION_DIR"/workers-start.sh diff --git a/bigbluebutton-html5/run-dev.sh b/bigbluebutton-html5/run-dev.sh new file mode 100755 index 0000000000..04f06b61e3 --- /dev/null +++ b/bigbluebutton-html5/run-dev.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +sudo systemctl stop bbb-html5 mongod + +cd "$(dirname "$0")" + +for var in "$@" +do + if [[ $var == --reset* ]] ; then + echo "Performing Meteor reset..." + rm -rf node_modules + meteor reset + meteor npm i + fi +done + +npm start \ No newline at end of file diff --git a/bigbluebutton-web/deploy_to_usr_share.sh b/bigbluebutton-web/deploy_to_usr_share.sh new file mode 100755 index 0000000000..2d88f237c7 --- /dev/null +++ b/bigbluebutton-web/deploy_to_usr_share.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +cd "$(dirname "$0")" +sudo service bbb-web stop +./build.sh + +grails assemble +mkdir exploded && cd exploded +jar -xvf ../build/libs/bigbluebutton-0.10.0.war +cp ../run-prod.sh . +sudo cp -R /usr/share/bbb-web /usr/share/bbb-web-old +sudo rm -rf /usr/share/bbb-web/assets/ /usr/share/bbb-web/META-INF/ /usr/share/bbb-web/org/ /usr/share/bbb-web/run-prod.sh /usr/share/bbb-web/WEB-INF/ +sudo cp -R . /usr/share/bbb-web/ +sudo chown bigbluebutton:bigbluebutton /usr/share/bbb-web +sudo chown -R bigbluebutton:bigbluebutton /usr/share/bbb-web/assets/ /usr/share/bbb-web/META-INF/ /usr/share/bbb-web/org/ /usr/share/bbb-web/run-prod.sh /usr/share/bbb-web/WEB-INF/ +echo '' +echo '' +echo '----------------' +echo 'bbb-web updated' + +cd .. +sudo rm -r exploded +sudo service bbb-web start + +echo 'starting service bbb-web' \ No newline at end of file diff --git a/bigbluebutton-web/run-dev.sh b/bigbluebutton-web/run-dev.sh index 955942f7ae..3dfdda19b1 100755 --- a/bigbluebutton-web/run-dev.sh +++ b/bigbluebutton-web/run-dev.sh @@ -1,10 +1,4 @@ #!/usr/bin/env bash -IS_BBB_WEB_RUNNING=`ss -lt | grep ":8090" > /dev/null && echo 1 || echo 0` - -if [ "$IS_BBB_WEB_RUNNING" = "1" ]; then - echo "bbb-web is running, exiting" - exit 1 -fi echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo " **** This is for development only *****" @@ -16,5 +10,6 @@ echo " chmod -R 777 /var/bigbluebutton/" echo " " echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" +sudo service bbb-web stop -exec grails prod run-app --port 8090 +exec grails prod run-app --port 8090 -reloading