mirror of https://github.com/MISP/misp-docker
Merge branch 'master' of github.com:coolacid/docker-misp
commit
eae2c7e27b
|
@ -43,7 +43,7 @@ services:
|
||||||
# Database Configuration (And their defaults)
|
# Database Configuration (And their defaults)
|
||||||
# - "MYSQL_HOST=db"
|
# - "MYSQL_HOST=db"
|
||||||
# - "MYSQL_USER=misp"
|
# - "MYSQL_USER=misp"
|
||||||
# - "MYSQL_PASSWORD=example"
|
# - "MYSQL_PASSWORD=example" # NOTE: This should be AlphaNum with no Special Chars. Otherwise, edit config files after first run.
|
||||||
# - "MYSQL_DATABASE=misp"
|
# - "MYSQL_DATABASE=misp"
|
||||||
# Optional Settings
|
# Optional Settings
|
||||||
# - "NOREDIR=true" # Do not redirect port 80
|
# - "NOREDIR=true" # Do not redirect port 80
|
||||||
|
|
|
@ -73,6 +73,12 @@ init_mysql(){
|
||||||
echo $?
|
echo $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDBinitDone () {
|
||||||
|
# Table attributes has existed since at least v2.1
|
||||||
|
echo "DESCRIBE attributes" | $MYSQLCMD 1>/dev/null
|
||||||
|
echo $?
|
||||||
|
}
|
||||||
|
|
||||||
RETRY=100
|
RETRY=100
|
||||||
until [ $(isDBup) -eq 0 ] || [ $RETRY -le 0 ] ; do
|
until [ $(isDBup) -eq 0 ] || [ $RETRY -le 0 ] ; do
|
||||||
echo "Waiting for database to come up"
|
echo "Waiting for database to come up"
|
||||||
|
@ -84,7 +90,12 @@ init_mysql(){
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $(isDBinitDone) -eq 0 ]; then
|
||||||
|
echo "Database has already been initialized"
|
||||||
|
else
|
||||||
|
echo "Database has not been initialized, importing MySQL scheme..."
|
||||||
$MYSQLCMD < /var/www/MISP/INSTALL/MYSQL.sql
|
$MYSQLCMD < /var/www/MISP/INSTALL/MYSQL.sql
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_files(){
|
sync_files(){
|
||||||
|
@ -104,7 +115,7 @@ done
|
||||||
|
|
||||||
# Things we should do when we have the INITIALIZE Env Flag
|
# Things we should do when we have the INITIALIZE Env Flag
|
||||||
if [[ "$INIT" == true ]]; then
|
if [[ "$INIT" == true ]]; then
|
||||||
echo "Import MySQL scheme..." && init_mysql
|
echo "Setup MySQL..." && init_mysql
|
||||||
echo "Setup MISP files dir..." && init_misp_files
|
echo "Setup MISP files dir..." && init_misp_files
|
||||||
echo "Ensure SSL certs exist..." && init_ssl
|
echo "Ensure SSL certs exist..." && init_ssl
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue