Added RT support for docker image

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2023-11-22 08:16:50 +01:00
parent 4f948d3d5c
commit 68fed34a53
2 changed files with 11 additions and 2 deletions

View File

@ -45,6 +45,7 @@ services:
- MYSQL_HOSTNAME=mysql
- PILER_HOSTNAME=archive.example.com
- MEMCACHED_HOST=memcached
- RT=1
ports:
- "25:25"
- "80:80"

View File

@ -13,7 +13,7 @@ PILER_NGINX_CONF="${CONFIG_DIR}/piler-nginx.conf"
SPHINX_CONF="${CONFIG_DIR}/manticore.conf"
CONFIG_SITE_PHP="${CONFIG_DIR}/config-site.php"
PILER_MY_CNF="${CONFIG_DIR}/.my.cnf"
RT="${RT:-0}"
error() {
echo "ERROR:" "$*" 1>&2
@ -126,6 +126,14 @@ fix_configs() {
-e "s%MYSQL_USERNAME%${MYSQL_USER}%" \
-e "s%MYSQL_PASSWORD%${MYSQL_PASSWORD}%" \
-i "$SPHINX_CONF"
# Fixes for RT index
if [[ $RT -eq 1 ]]; then
sed -i "s/define('RT', 0)/define('RT', 1)/" "$SPHINX_CONF"
echo "\$config['RT'] = 1;" >> "$CONFIG_SITE_PHP"
sed -i "s%rtindex=.*%rtindex=1%" "$PILER_CONF"
fi
}
@ -177,7 +185,7 @@ start_services() {
start_piler() {
if [[ ! -f "${VOLUME_DIR}/manticore/main1.spp" ]]; then
if [[ $RT -eq 0 && ! -f "${VOLUME_DIR}/manticore/main1.spp" ]]; then
log "main1.spp does not exist, creating index files"
su -c "indexer --all --config ${SPHINX_CONF}" "$PILER_USER"
fi