Skip to content

Commit 7e595ff

Browse files
oivindohostefano
authored andcommitted
Run component updates in the background
1 parent 24690ca commit 7e595ff

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

core/files/configure_misp.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,18 @@ init_settings() {
351351
}
352352

353353
update_components() {
354-
sudo -u www-data /var/www/MISP/app/Console/cake Admin updateGalaxies
355-
sudo -u www-data /var/www/MISP/app/Console/cake Admin updateTaxonomies
356-
sudo -u www-data /var/www/MISP/app/Console/cake Admin updateWarningLists
357-
sudo -u www-data /var/www/MISP/app/Console/cake Admin updateNoticeLists
358-
sudo -u www-data /var/www/MISP/app/Console/cake Admin updateObjectTemplates "$CRON_USER_ID"
354+
UPDATE_SUDO_CMD="sudo -u www-data"
355+
if [ ! -z "${DB_ALREADY_INITIALISED}" ]; then
356+
if [[ "$ENABLE_BACKGROUND_UPDATES" = "true" ]]; then
357+
echo "... updates will run in the background"
358+
UPDATE_SUDO_CMD="sudo -b -u www-data"
359+
fi
360+
fi
361+
${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateGalaxies
362+
${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateTaxonomies
363+
${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateWarningLists
364+
${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateNoticeLists
365+
${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateObjectTemplates "$CRON_USER_ID"
359366
}
360367

361368
update_ca_certificates() {
@@ -431,7 +438,7 @@ echo "MISP | Init default user and organization ..." && init_user
431438

432439
echo "MISP | Resolve critical issues ..." && apply_critical_fixes
433440

434-
echo "MISP | Update components ..." && update_components
441+
echo "MISP | Start component updates ..." && update_components
435442

436443
echo "MISP | Resolve non-critical issues ..." && apply_optional_fixes
437444

core/files/entrypoint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export AUTOCONF_ADMIN_KEY=${AUTOCONF_ADMIN_KEY:-true}
3030
export OIDC_ENABLE=${OIDC_ENABLE:-false}
3131
export LDAP_ENABLE=${LDAP_ENABLE:-false}
3232
export ENABLE_DB_SETTINGS=${ENABLE_DB_SETTINGS:-false}
33+
export ENABLE_BACKGROUND_UPDATES=${ENABLE_BACKGROUND_UPDATES:-false}
3334
export PROXY_ENABLE=${PROXY_ENABLE:-false}
3435
export DEBUG=${DEBUG:-0}
3536

core/files/entrypoint_nginx.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ init_mysql(){
3737

3838
if [ $(isDBinitDone) -eq 0 ]; then
3939
echo "... database has already been initialized"
40+
export DB_ALREADY_INITIALISED=true
4041
else
4142
echo "... database has not been initialized, importing MySQL scheme..."
4243
$MYSQLCMD < /var/www/MISP/INSTALL/MYSQL.sql

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ services:
101101
- "DISABLE_IPV6=${DISABLE_IPV6}"
102102
- "DISABLE_SSL_REDIRECT=${DISABLE_SSL_REDIRECT}"
103103
- "ENABLE_DB_SETTINGS=${ENABLE_DB_SETTINGS}"
104+
- "ENABLE_BACKGROUND_UPDATES=${ENABLE_BACKGROUND_UPDATES}"
104105
- "ENCRYPTION_KEY=${ENCRYPTION_KEY}"
105106
# standard settings
106107
- "ADMIN_EMAIL=${ADMIN_EMAIL}"

template.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ BASE_URL=
4949
ENABLE_DB_SETTINGS=
5050
# encryption key. defaults to empty string
5151
ENCRYPTION_KEY=
52+
# enable background updates. defaults to false
53+
ENABLE_BACKGROUND_UPDATES=
5254

5355
# defines the FQDN of the mail sub-system (defaults to 'mail')
5456
# SMTP_FQDN=

0 commit comments

Comments
 (0)