Reworking install scripts to run parts in parallel.

This commit is contained in:
Roland 2022-11-05 14:38:00 -06:00
parent 66336e7ca5
commit 48944c32ac
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
4 changed files with 45 additions and 21 deletions

View file

@ -11,14 +11,18 @@ apt install -y apt-transport-https ca-certificates curl gnupg-agent gcc libpq-de
chromium chromium-driver cpufrequtils network-manager npm
# Install Archiving tools.
npm install -g 'git+https://github.com/gildas-lormeau/SingleFile'
npm install -g 'git+https://github.com/pirate/readability-extractor'
# Build React app
[[ ! -f /usr/local/bin/serve || ! -f /usr/bin/serve ]] && npm -g install serve
cd /opt/wrolpi/app || exit 5
npm install || npm install || npm install || npm install # try install multiple times
npm run build
SF_VERSION="1.0.15"
if [ "$(single-file --version)" != "${SF_VERSION}" ]; then
(
wget --continue https://github.com/gildas-lormeau/SingleFile/archive/refs/tags/v${SF_VERSION}.tar.gz -O \
/tmp/SingleFile.git.tar.gz
cd /tmp
tar xf SingleFile.git.tar.gz
cd SingleFile-${SF_VERSION}
npm install
) & # Install in background.
fi
readability-extractor --version || npm install -g 'git+https://github.com/pirate/readability-extractor'
# Setup the virtual environment that main.py expects
pip3 --version || (
@ -27,8 +31,16 @@ pip3 --version || (
python3 /tmp/get-pip.py
)
# Install python requirements files
pip3 install -r /opt/wrolpi/requirements.txt
# Build React app in background job.
[[ ! -f /usr/local/bin/serve || ! -f /usr/bin/serve ]] && npm -g install serve
cd /opt/wrolpi/app || exit 5
npm install || npm install || npm install || npm install # try install multiple times :(
npm run build &
# Install python requirements files in background job.
pip3 install -r /opt/wrolpi/requirements.txt &
wait $(jobs -p)
# Install the WROLPi nginx config over the default nginx config.
cp /opt/wrolpi/nginx.conf /etc/nginx/nginx.conf

View file

@ -19,7 +19,7 @@ set -e
[ -z "$(find -H /var/lib/apt/lists -maxdepth 0 -mtime -1)" ] && apt update
# Install map dependencies.
apt install -y libboost-all-dev git tar unzip wget bzip2 build-essential autoconf libtool libxml2-dev libgeos-dev \
libgeos++-dev libpq-dev libbz2-dev libproj-dev munin-node munin protobuf-c-compiler libfreetype6-dev libtiff5-dev \
libgeos++-dev libpq-dev libbz2-dev libproj-dev protobuf-c-compiler libfreetype6-dev libtiff5-dev \
libicu-dev libgdal-dev libcairo2-dev libcairomm-1.0-dev libagg-dev liblua5.2-dev ttf-unifont lua5.1 liblua5.1-0-dev \
postgis postgresql-12-postgis-3 postgresql-12-postgis-3-scripts osm2pgsql gdal-bin libmapnik-dev mapnik-utils \
python3-mapnik apache2 apache2-dev libcurl4-gnutls-dev libiniparser-dev libmemcached-dev librados-dev \

View file

@ -5,7 +5,7 @@ set -x
set -e
# Install npm repos.
curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
npm --version || curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
# Update if we haven't updated in the last day.
[ -z "$(find -H /var/lib/apt/lists -maxdepth 0 -mtime -1)" ] && apt update
# Install dependencies
@ -14,8 +14,18 @@ apt install -y apt-transport-https ca-certificates curl gnupg-agent gcc libpq-de
ffmpeg hostapd nodejs chromium-browser chromium-chromedriver cpufrequtils network-manager
# Install Archiving tools.
npm install -g 'git+https://github.com/gildas-lormeau/SingleFile'
npm install -g 'git+https://github.com/pirate/readability-extractor'
SF_VERSION="1.0.15"
if [ "$(single-file --version)" != "${SF_VERSION}" ]; then
(
wget --continue https://github.com/gildas-lormeau/SingleFile/archive/refs/tags/v${SF_VERSION}.tar.gz -O \
/tmp/SingleFile.git.tar.gz
cd /tmp
tar xf SingleFile.git.tar.gz
cd SingleFile-${SF_VERSION}
npm install
) & # Install in background.
fi
readability-extractor --version || npm install -g 'git+https://github.com/pirate/readability-extractor'
# Setup the virtual environment that main.py expects
pip3 --version || (
@ -24,14 +34,16 @@ pip3 --version || (
python3 /tmp/get-pip.py
)
# Install python requirements files
pip3 install -r /opt/wrolpi/requirements.txt
# Build React app
# Build React app in background job.
[[ ! -f /usr/local/bin/serve || ! -f /usr/bin/serve ]] && npm -g install serve
cd /opt/wrolpi/app || exit 5
npm install || npm install || npm install || npm install # try install multiple times
npm run build
npm install || npm install || npm install || npm install # try install multiple times :(
npm run build &
# Install python requirements files in background job.
pip3 install -r /opt/wrolpi/requirements.txt &
wait $(jobs -p)
# Install the WROLPi nginx config over the default nginx config.
cp /opt/wrolpi/nginx.conf /etc/nginx/nginx.conf

View file

@ -26,7 +26,7 @@ Help() {
}
FORCE=false
while getopts ":hf:" option; do
while getopts ":hf" option; do
case $option in
h) # display Help
Help