#!/bin/bash
|
|
# Solr configuration
|
cd "${SOLR_PREFIX}/solr/server"
|
if [ ! -f solr/solr.xml ]; then
|
cp -Rf solr.bak/* solr/
|
chown -R solr:solr solr
|
chown -R solr:solr "${SOLR_PREFIX}/solr-data"
|
fi
|
|
cd "${CASEBOX_PREFIX}/casebox"
|
|
# Casebox file ownership
|
if [ "`stat -c %U data`" != "${APACHE_USER}" ]; then
|
chown -Rf "${APACHE_USER}:${APACHE_GROUP}" data logs
|
fi
|
|
# Apache configuration
|
if [ ! -f ${APACHE_VHOST_CONFIG} ]; then
|
envsubst < docker/apache.conf > "${APACHE_VHOST_CONFIG}"
|
fi
|
|
# Casebox configuration template
|
if [ ! -f config_install.ini ]; then
|
envsubst < docker/casebox.ini > config_install.ini
|
fi
|
|
# Solr schemas (not mentioned in installation guide)
|
if [ ! -L "${SOLR_PREFIX}/solr/server/solr/configsets/cb_default" ]; then
|
ln -s "${CASEBOX_PREFIX}/casebox/sys/solr_configsets/default_config" \
|
"${SOLR_PREFIX}/solr/server/solr/configsets/cb_default"
|
fi
|
if [ ! -L "${SOLR_PREFIX}/solr/server/solr/configsets/cb_log" ]; then
|
ln -s "${CASEBOX_PREFIX}/casebox/sys/solr_configsets/log_config" \
|
"${SOLR_PREFIX}/solr/server/solr/configsets/cb_log"
|
fi
|
|
# Solr
|
sudo -u solr "${SOLR_PREFIX}/solr/bin/solr" start
|
|
# Casebox configuration
|
if [ ! -f httpsdocs/config.ini ]; then
|
php bin/install.php -f config_install.ini
|
|
# Fix file uploads (not mentioned in installation guide)
|
mkdir -p "data/tmp/${CASEBOX_CORE}/incomming"
|
chown -Rf "${APACHE_USER}:${APACHE_GROUP}" data
|
fi
|
|
# Cron daemon
|
cron
|
|
# Cron jobs
|
if [ ! -f casebox_crontab ]; then
|
echo "*/2 * * * * php -f '${CASEBOX_PREFIX}/casebox/sys/crons/run_cron.php' -- -n send_notifications -c all" > casebox_crontab
|
echo "*/2 * * * * php -f '${CASEBOX_PREFIX}/casebox/sys/crons/run_cron.php' -- -n extract_files_content -c all" >> casebox_crontab
|
echo "*/5 * * * * php -f '${CASEBOX_PREFIX}/casebox/sys/crons/run_cron.php' -- -n check_mail -c all" >> casebox_crontab
|
echo "*/2 * * * * php -f '${CASEBOX_PREFIX}/casebox/sys/crons/cron_receive_comments.php'" >> casebox_crontab
|
crontab -u ${APACHE_USER} casebox_crontab
|
fi
|
|
# LibreOffice (file conversion)
|
sudo -u "${APACHE_USER}" unoconv --listener &
|
|
# Apache
|
APACHE_ARGUMENTS=-DFOREGROUND apache2ctl start
|