2021-08-13 18:53:18 +08:00
|
|
|
#!/bin/bash -ex
|
|
|
|
|
|
|
|
TARGET=`basename $(pwd)`
|
|
|
|
|
|
|
|
|
|
|
|
PACKAGE=$(echo $TARGET | cut -d'_' -f1)
|
|
|
|
VERSION=$(echo $TARGET | cut -d'_' -f2)
|
|
|
|
DISTRO=$(echo $TARGET | cut -d'_' -f3)
|
|
|
|
TAG=$(echo $TARGET | cut -d'_' -f4)
|
2022-08-19 00:39:47 +08:00
|
|
|
BUILD=$1
|
2021-08-13 18:53:18 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# Clean up directories
|
|
|
|
rm -rf staging
|
|
|
|
|
|
|
|
#
|
|
|
|
# package
|
|
|
|
|
|
|
|
# New format
|
|
|
|
if [ -f private/config/settings.yml ]; then
|
2022-08-26 20:31:06 +08:00
|
|
|
sed -i "s/HTML5_CLIENT_VERSION/$(($BUILD))/g" private/config/settings.yml
|
2021-08-13 18:53:18 +08:00
|
|
|
fi
|
|
|
|
|
2022-03-06 11:51:27 +08:00
|
|
|
mkdir -p staging/usr/share/bigbluebutton/nginx
|
|
|
|
cp bbb-html5.nginx staging/usr/share/bigbluebutton/nginx
|
2021-08-13 18:53:18 +08:00
|
|
|
|
|
|
|
mkdir -p staging/etc/nginx/conf.d
|
2023-02-22 02:15:42 +08:00
|
|
|
cp bbb-html5-conn-limit.conf staging/etc/nginx/conf.d
|
2024-04-02 20:07:20 +08:00
|
|
|
cp bbb-html5-meteor-assets-cache.conf staging/etc/nginx/conf.d
|
2021-08-13 18:53:18 +08:00
|
|
|
|
|
|
|
mkdir -p staging/etc/systemd/system
|
2022-02-27 10:36:36 +08:00
|
|
|
cp mongod.service staging/etc/systemd/system
|
2021-08-13 18:53:18 +08:00
|
|
|
|
|
|
|
mkdir -p staging/usr/share/meteor
|
|
|
|
|
|
|
|
rm -rf /tmp/html5-build
|
|
|
|
mkdir -p /tmp/html5-build
|
|
|
|
|
2021-10-30 03:30:59 +08:00
|
|
|
npm -v
|
2021-09-30 23:36:03 +08:00
|
|
|
meteor npm -v
|
|
|
|
meteor node -v
|
|
|
|
cat .meteor/release
|
2021-10-01 04:43:48 +08:00
|
|
|
|
|
|
|
# meteor version control was moved to the Dockerfile of the image used in .gitlab-ci.yml
|
|
|
|
# meteor update --allow-superuser --release 2.3.6
|
2021-09-30 23:36:03 +08:00
|
|
|
|
2021-10-30 03:30:59 +08:00
|
|
|
# Install the npm dependencies needed for the HTML5 client.
|
|
|
|
# Argument 'c' means package-lock.json will be respected
|
|
|
|
# --production means we won't be installing devDependencies
|
2021-09-30 23:36:03 +08:00
|
|
|
meteor npm ci --production
|
2021-09-30 04:14:17 +08:00
|
|
|
|
2022-07-13 00:25:37 +08:00
|
|
|
# deleting links as they were repeatedly broken (node_modules/acorn/bin mostly)
|
|
|
|
# I have not seen this on npm 8+ but meteor npm is still at 6.x right now
|
|
|
|
# https://forums.meteor.com/t/broken-symbolic-link-on-running-app/57770/3
|
|
|
|
find node_modules/.bin -xtype l -delete
|
|
|
|
|
2021-10-30 03:30:59 +08:00
|
|
|
# Build the HTML5 client https://guide.meteor.com/deployment.html#custom-deployment
|
|
|
|
# https://docs.meteor.com/environment-variables.html#METEOR-DISABLE-OPTIMISTIC-CACHING - disable caching because we're only building once
|
|
|
|
# --allow-superuser
|
|
|
|
# --directory - instead of creating tar.gz and then extracting (which is the default option)
|
|
|
|
METEOR_DISABLE_OPTIMISTIC_CACHING=1 meteor build /tmp/html5-build --architecture os.linux.x86_64 --allow-superuser --directory
|
2021-08-13 18:53:18 +08:00
|
|
|
|
2021-10-30 03:30:59 +08:00
|
|
|
# Install the npm dependencies, then copy to staging
|
2021-08-13 18:53:18 +08:00
|
|
|
cd /tmp/html5-build/bundle/programs/server/
|
2021-10-30 03:30:59 +08:00
|
|
|
|
|
|
|
# Install Meteor related dependencies
|
|
|
|
# Note that we don't use "c" argument as there is no package-lock.json here
|
|
|
|
# only package.json. The dependencies for bbb-html5 are already installed in
|
|
|
|
# /usr/share/meteor/bundle/programs/server/npm/node_modules/ and not in
|
|
|
|
# /usr/share/meteor/bundle/programs/server/node_modules
|
|
|
|
npm i
|
2021-08-13 18:53:18 +08:00
|
|
|
cd -
|
|
|
|
cp -r /tmp/html5-build/bundle staging/usr/share/meteor
|
|
|
|
|
2024-03-22 03:41:32 +08:00
|
|
|
# generate index.json locales file if it does not exist
|
|
|
|
if [ ! -f staging/usr/share/meteor/bundle/programs/web.browser/app/locales/index.json ]; then
|
|
|
|
find staging/usr/share/meteor/bundle/programs/web.browser/app/locales -maxdepth 1 -type f -name "*.json" -exec basename {} \; | awk 'BEGIN{printf "["}{printf "\"%s\", ", $0}END{print "]"}' | sed 's/, ]/]/' > staging/usr/share/meteor/bundle/programs/web.browser/app/locales/index.json
|
|
|
|
fi
|
|
|
|
|
2022-02-27 10:36:36 +08:00
|
|
|
cp workers-start.sh staging/usr/share/meteor/bundle
|
2021-08-13 18:53:18 +08:00
|
|
|
chmod +x staging/usr/share/meteor/bundle/workers-start.sh
|
|
|
|
|
|
|
|
cp mongod_start_pre.sh staging/usr/share/meteor/bundle
|
|
|
|
chmod +x staging/usr/share/meteor/bundle/mongod_start_pre.sh
|
|
|
|
|
2023-04-29 01:32:09 +08:00
|
|
|
cp mongo-ramdisk.conf staging/usr/share/meteor/bundle
|
|
|
|
# cp mongo-ramdisk.conf staging/etc/mongod.conf
|
2021-08-13 18:53:18 +08:00
|
|
|
|
|
|
|
mkdir -p staging/usr/lib/systemd/system
|
2022-02-27 10:36:36 +08:00
|
|
|
cp bbb-html5.service staging/usr/lib/systemd/system
|
2021-08-13 18:53:18 +08:00
|
|
|
cp disable-transparent-huge-pages.service staging/usr/lib/systemd/system
|
|
|
|
|
|
|
|
mkdir -p staging/usr/share
|
|
|
|
|
2022-08-19 00:39:47 +08:00
|
|
|
# replace v=VERSION with build number in head and css files
|
2021-08-13 18:53:18 +08:00
|
|
|
if [ -f staging/usr/share/meteor/bundle/programs/web.browser/head.html ]; then
|
2022-08-25 23:11:48 +08:00
|
|
|
sed -i "s/VERSION/$(($BUILD))/g" staging/usr/share/meteor/bundle/programs/web.browser/head.html
|
2021-08-13 18:53:18 +08:00
|
|
|
fi
|
|
|
|
|
2022-08-25 23:11:48 +08:00
|
|
|
find staging/usr/share/meteor/bundle/programs/web.browser -name '*.css' -exec sed -i "s/VERSION/$(($BUILD))/g" '{}' \;
|
2022-08-19 00:39:47 +08:00
|
|
|
|
2022-02-27 10:36:36 +08:00
|
|
|
# Compress CSS, Javascript and tensorflow WASM binaries used for virtual backgrounds. Keep the
|
2021-10-19 00:02:29 +08:00
|
|
|
# uncompressed versions as well so it works with mismatched nginx location blocks
|
2022-02-01 03:05:41 +08:00
|
|
|
find staging/usr/share/meteor/bundle/programs/web.browser -name '*.js' -exec gzip -k -f -9 '{}' \;
|
|
|
|
find staging/usr/share/meteor/bundle/programs/web.browser -name '*.css' -exec gzip -k -f -9 '{}' \;
|
|
|
|
find staging/usr/share/meteor/bundle/programs/web.browser -name '*.wasm' -exec gzip -k -f -9 '{}' \;
|
2021-10-19 00:02:29 +08:00
|
|
|
|
2021-08-13 18:53:18 +08:00
|
|
|
mkdir -p staging/etc/nginx/sites-available
|
|
|
|
cp bigbluebutton.nginx staging/etc/nginx/sites-available/bigbluebutton
|
|
|
|
|
2022-03-06 11:51:27 +08:00
|
|
|
mkdir -p staging/usr/share/bigbluebutton/nginx
|
|
|
|
cp sip.nginx staging/usr/share/bigbluebutton/nginx
|
2021-08-13 18:53:18 +08:00
|
|
|
|
|
|
|
mkdir -p staging/var/www/bigbluebutton
|
|
|
|
touch staging/var/www/bigbluebutton/index.html
|
|
|
|
|
|
|
|
. ./opts-$DISTRO.sh
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build RPM package
|
|
|
|
fpm -s dir -C ./staging -n $PACKAGE \
|
|
|
|
--version $VERSION --epoch $EPOCH \
|
|
|
|
--before-install before-install.sh \
|
|
|
|
--after-install after-install.sh \
|
|
|
|
--before-remove before-remove.sh \
|
|
|
|
--after-remove after-remove.sh \
|
|
|
|
--description "The HTML5 components for BigBlueButton" \
|
|
|
|
$DIRECTORIES \
|
2023-04-27 04:26:51 +08:00
|
|
|
$OPTS
|