2023-02-24 17:31:08 -07:00
|
|
|
#! /usr/bin/env bash
|
2023-09-24 20:10:09 -06:00
|
|
|
# Installs any new dependencies of the App and API. Uses internet.
|
2023-02-24 17:31:08 -07:00
|
|
|
|
2023-09-24 20:10:09 -06:00
|
|
|
set -e
|
|
|
|
|
set -x
|
2023-05-23 16:41:48 -06:00
|
|
|
|
2025-12-06 13:35:32 -07:00
|
|
|
# Ensure help service is always restarted, even on failure
|
|
|
|
|
trap 'systemctl restart wrolpi-help.service || :' EXIT
|
|
|
|
|
|
2023-09-24 20:10:09 -06:00
|
|
|
# Install any App dependencies.
|
|
|
|
|
cd /opt/wrolpi/app || exit 1
|
|
|
|
|
npm install || npm install || npm install || npm install # try install multiple times :(
|
2023-05-01 13:00:23 -06:00
|
|
|
|
2023-09-24 20:10:09 -06:00
|
|
|
# Install any new Python requirements.
|
2024-07-31 15:01:31 -06:00
|
|
|
/opt/wrolpi/venv/bin/pip3 install --upgrade -r /opt/wrolpi/requirements.txt
|
2023-09-24 20:10:09 -06:00
|
|
|
# Upgrade the WROLPi database.
|
|
|
|
|
(cd /opt/wrolpi && /opt/wrolpi/venv/bin/python3 /opt/wrolpi/main.py db upgrade)
|
2023-07-11 17:23:56 -06:00
|
|
|
|
2023-11-23 16:20:28 -07:00
|
|
|
# Upgrade WROLPi Help.
|
2023-11-23 16:22:46 -07:00
|
|
|
/opt/wrolpi/scripts/install_help_service.sh || echo "Help install failed."
|
2023-11-23 16:20:28 -07:00
|
|
|
|
2025-01-02 12:02:35 -07:00
|
|
|
# Get map db blob, if it is missing.
|
|
|
|
|
MAP_DB_BLOB=/opt/wrolpi-blobs/map-db-gis.dump
|
|
|
|
|
if [[ ! -f ${MAP_DB_BLOB} || ! -s ${MAP_DB_BLOB} ]]; then
|
|
|
|
|
echo "Downloading new map blob (1.2 GB)..."
|
|
|
|
|
wget https://wrolpi.nyc3.cdn.digitaloceanspaces.com/map-db-gis.dump -O ${MAP_DB_BLOB}
|
|
|
|
|
fi
|
|
|
|
|
if [[ -f /opt/wrolpi-blobs/gis-map.dump.gz && -s ${MAP_DB_BLOB} ]]; then
|
|
|
|
|
# Remove old blob now that we have the new one.
|
2025-01-12 11:05:43 -07:00
|
|
|
rm /opt/wrolpi-blobs/gis-map.dump.gz
|
2025-01-02 12:02:35 -07:00
|
|
|
fi
|
|
|
|
|
|
2025-01-01 10:59:28 -07:00
|
|
|
# Migrate map DB if necessary. Do this before repair because it will reset map if map db is empty.
|
|
|
|
|
/opt/wrolpi/wrolpi/scripts/migrate_map_db.sh || echo "Map DB migration failed."
|
|
|
|
|
|
2023-09-24 20:10:09 -06:00
|
|
|
# Install any configs, restart services.
|
|
|
|
|
/opt/wrolpi/repair.sh
|