Run component updates in the background

pull/143/head
Øivind Hoel 2024-09-03 11:45:51 +00:00 committed by Stefano Ortolani
parent 24690cafe5
commit 7e595ff585
5 changed files with 18 additions and 6 deletions

View File

@ -351,11 +351,18 @@ init_settings() {
}
update_components() {
sudo -u www-data /var/www/MISP/app/Console/cake Admin updateGalaxies
sudo -u www-data /var/www/MISP/app/Console/cake Admin updateTaxonomies
sudo -u www-data /var/www/MISP/app/Console/cake Admin updateWarningLists
sudo -u www-data /var/www/MISP/app/Console/cake Admin updateNoticeLists
sudo -u www-data /var/www/MISP/app/Console/cake Admin updateObjectTemplates "$CRON_USER_ID"
UPDATE_SUDO_CMD="sudo -u www-data"
if [ ! -z "${DB_ALREADY_INITIALISED}" ]; then
if [[ "$ENABLE_BACKGROUND_UPDATES" = "true" ]]; then
echo "... updates will run in the background"
UPDATE_SUDO_CMD="sudo -b -u www-data"
fi
fi
${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateGalaxies
${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateTaxonomies
${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateWarningLists
${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateNoticeLists
${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateObjectTemplates "$CRON_USER_ID"
}
update_ca_certificates() {
@ -431,7 +438,7 @@ echo "MISP | Init default user and organization ..." && init_user
echo "MISP | Resolve critical issues ..." && apply_critical_fixes
echo "MISP | Update components ..." && update_components
echo "MISP | Start component updates ..." && update_components
echo "MISP | Resolve non-critical issues ..." && apply_optional_fixes

View File

@ -30,6 +30,7 @@ export AUTOCONF_ADMIN_KEY=${AUTOCONF_ADMIN_KEY:-true}
export OIDC_ENABLE=${OIDC_ENABLE:-false}
export LDAP_ENABLE=${LDAP_ENABLE:-false}
export ENABLE_DB_SETTINGS=${ENABLE_DB_SETTINGS:-false}
export ENABLE_BACKGROUND_UPDATES=${ENABLE_BACKGROUND_UPDATES:-false}
export PROXY_ENABLE=${PROXY_ENABLE:-false}
export DEBUG=${DEBUG:-0}

View File

@ -37,6 +37,7 @@ init_mysql(){
if [ $(isDBinitDone) -eq 0 ]; then
echo "... database has already been initialized"
export DB_ALREADY_INITIALISED=true
else
echo "... database has not been initialized, importing MySQL scheme..."
$MYSQLCMD < /var/www/MISP/INSTALL/MYSQL.sql

View File

@ -101,6 +101,7 @@ services:
- "DISABLE_IPV6=${DISABLE_IPV6}"
- "DISABLE_SSL_REDIRECT=${DISABLE_SSL_REDIRECT}"
- "ENABLE_DB_SETTINGS=${ENABLE_DB_SETTINGS}"
- "ENABLE_BACKGROUND_UPDATES=${ENABLE_BACKGROUND_UPDATES}"
- "ENCRYPTION_KEY=${ENCRYPTION_KEY}"
# standard settings
- "ADMIN_EMAIL=${ADMIN_EMAIL}"

View File

@ -49,6 +49,8 @@ BASE_URL=
ENABLE_DB_SETTINGS=
# encryption key. defaults to empty string
ENCRYPTION_KEY=
# enable background updates. defaults to false
ENABLE_BACKGROUND_UPDATES=
# defines the FQDN of the mail sub-system (defaults to 'mail')
# SMTP_FQDN=