2021-10-30 03:30:59 +08:00
#!/bin/sh -ex
2022-04-01 00:48:57 +08:00
cd " $( dirname " $0 " ) "
2021-02-16 23:59:01 +08:00
# Please check bigbluebutton/bigbluebutton-html5/dev_local_deployment/README.md
UPPER_DESTINATION_DIR = /usr/share/meteor
DESTINATION_DIR = $UPPER_DESTINATION_DIR /bundle
SERVICE_FILES_DIR = /usr/lib/systemd/system
2022-04-01 00:48:57 +08:00
LOCAL_PACKAGING_DIR = " $( pwd ) /../build/packages-template/bbb-html5 "
2021-02-16 23:59:01 +08:00
2021-07-05 23:44:21 +08:00
if [ ! -d " $LOCAL_PACKAGING_DIR " ] ; then
echo " Did not find LOCAL_PACKAGING_DIR= $LOCAL_PACKAGING_DIR "
exit
fi
2021-02-16 23:59:01 +08:00
sudo rm -rf " $UPPER_DESTINATION_DIR "
sudo mkdir -p " $UPPER_DESTINATION_DIR "
sudo chown -R meteor:meteor " $UPPER_DESTINATION_DIR "
# the next 5 lines may be temporarily commented out if you are sure you are not tweaking the required node_modules after first use of the script. This will save a minute or two during the run of the script
if [ -d "node_modules" ] ; then
rm -r node_modules/
fi
meteor reset
2021-10-30 03:30:59 +08:00
meteor npm ci --production
2021-02-16 23:59:01 +08:00
sudo chmod 777 /usr/share/meteor
2021-10-30 03:30:59 +08:00
METEOR_DISABLE_OPTIMISTIC_CACHING = 1 meteor build $UPPER_DESTINATION_DIR --architecture os.linux.x86_64 --allow-superuser --directory
2021-02-16 23:59:01 +08:00
sudo chown -R meteor:meteor " $UPPER_DESTINATION_DIR " /
echo 'stage3'
2021-10-30 03:30:59 +08:00
cd " $DESTINATION_DIR " /programs/server/ || exit
2022-09-20 22:22:35 +08:00
sudo chmod -R 777 .
meteor npm i
2021-02-16 23:59:01 +08:00
echo " deployed to $DESTINATION_DIR /programs/server\n\n\n "
echo " writing $DESTINATION_DIR /mongod_start_pre.sh "
sudo cp $LOCAL_PACKAGING_DIR /mongod_start_pre.sh " $DESTINATION_DIR " /mongod_start_pre.sh
echo " writing $DESTINATION_DIR /mongo-ramdisk.conf "
sudo cp $LOCAL_PACKAGING_DIR /mongo-ramdisk.conf " $DESTINATION_DIR " /mongo-ramdisk.conf
echo " writing $DESTINATION_DIR /bbb-html5-with-roles.conf "
sudo tee " $DESTINATION_DIR /bbb-html5-with-roles.conf " >/dev/null <<HERE
2021-05-03 21:10:22 +08:00
# Default = 2; Min = 1; Max = 4
2021-02-16 23:59:01 +08:00
# On powerful systems with high number of meetings you can set values up to 4 to accelerate handling of events
NUMBER_OF_BACKEND_NODEJS_PROCESSES = 2
2021-05-03 21:10:22 +08:00
# Default = 2; Min = 0; Max = 8
2021-02-16 23:59:01 +08:00
# If 0 is set, bbb-html5 will handle both backend and frontend roles in one process (default until Feb 2021)
# Set a number between 1 and 4 times the value of NUMBER_OF_BACKEND_NODEJS_PROCESSES where higher number helps with meetings
# stretching the recommended number of users in BigBlueButton
NUMBER_OF_FRONTEND_NODEJS_PROCESSES = 2
HERE
echo " writing $DESTINATION_DIR /systemd_start.sh "
2022-03-15 03:04:23 +08:00
sudo cp $LOCAL_PACKAGING_DIR /systemd_start.sh " $DESTINATION_DIR " /systemd_start.sh
2021-02-16 23:59:01 +08:00
echo " writing $DESTINATION_DIR /systemd_start_frontend.sh "
2022-03-15 03:04:23 +08:00
sudo cp $LOCAL_PACKAGING_DIR /systemd_start_frontend.sh " $DESTINATION_DIR " /systemd_start_frontend.sh
2021-02-16 23:59:01 +08:00
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
2022-04-01 00:48:57 +08:00
sudo cp $LOCAL_PACKAGING_DIR /workers-start.sh " $DESTINATION_DIR " /workers-start.sh
2021-02-16 23:59:01 +08:00
sudo chmod +x " $DESTINATION_DIR " /workers-start.sh
echo " writing $SERVICE_FILES_DIR /bbb-html5-frontend@.service "
2022-03-15 03:04:23 +08:00
sudo cp $LOCAL_PACKAGING_DIR /bbb-html5-frontend@.service " $SERVICE_FILES_DIR " /bbb-html5-frontend@.service
2021-02-16 23:59:01 +08:00
echo " writing $SERVICE_FILES_DIR /bbb-html5-backend@.service "
2022-03-15 03:04:23 +08:00
sudo cp $LOCAL_PACKAGING_DIR /bbb-html5-backend@.service " $SERVICE_FILES_DIR " /bbb-html5-backend@.service
2021-02-16 23:59:01 +08:00
sudo systemctl daemon-reload
echo 'before stopping bbb-html5:'
ps -ef | grep node-
2022-03-24 04:50:19 +08:00
sudo ss -netlp | grep -i node
2021-02-16 23:59:01 +08:00
echo 'before stopping bbb-html5:'
echo '_____________'
sudo systemctl stop bbb-html5
sleep 5s
echo 'after stopping bbb-html5:'
ps -ef | grep node-
2022-03-24 04:50:19 +08:00
sudo ss -netlp | grep -i node
2021-02-16 23:59:01 +08:00
echo 'after stopping bbb-html5:'
echo '_____________'
echo 'starting bbb-html5'
sudo systemctl start bbb-html5
sleep 10s
echo 'after:...'
ps -ef | grep node-
2022-03-24 04:50:19 +08:00
sudo ss -netlp | grep -i node
2021-02-16 23:59:01 +08:00
echo 'after:'
echo '_____________'