Skip to content

Commit

Permalink
introduce MANTICORE_HOSTNAME (#162)
Browse files Browse the repository at this point in the history
* Update start.sh

Change "manticore" to "${MANTICORE_HOSTNAME}"

* Update docker-compose.yaml

add env MANTICORE_HOSTNAME
  • Loading branch information
th-2021 authored Aug 20, 2024
1 parent 2ace7e3 commit 62bc020
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ services:
container_name: piler
init: true
environment:
- MANTICORE_HOSTNAME=manticore
- MEMCACHED_HOSTNAME=memcached
- MYSQL_HOSTNAME=mysql
- MYSQL_DATABASE=piler
Expand Down
7 changes: 4 additions & 3 deletions docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ CONFIG_SITE_PHP="${CONFIG_DIR}/config-site.php"
PILER_MY_CNF="${CONFIG_DIR}/.my.cnf"
RT="${RT:-0}"
MEMCACHED_HOSTNAME="${MEMCACHED_HOSTNAME:-memcached}"
MANTICORE_HOSTNAME="${MANTICORE_HOSTNAME:-manticore}"
TMP_CONF_DIR="/tmp/piler-conf"

error() {
Expand Down Expand Up @@ -108,7 +109,7 @@ fix_configs() {
fi

# Make sure that sphxhost is set
sed -i -e "s/sphxhost=.*/sphxhost=manticore/g" "$PILER_CONF"
sed -i -e "s/sphxhost=.*/sphxhost=${MANTICORE_HOSTNAME}/g" "$PILER_CONF"

if [[ ! -f "$CONFIG_SITE_PHP" ]]; then
log "Writing ${CONFIG_SITE_PHP}"
Expand Down Expand Up @@ -152,11 +153,11 @@ fix_configs() {
fi

if ! grep "'SPHINX_HOSTNAME'" "$CONFIG_SITE_PHP"; then
echo "\$config['SPHINX_HOSTNAME'] = 'manticore:9306';" >> "$CONFIG_SITE_PHP"
echo "\$config['SPHINX_HOSTNAME'] = '${MANTICORE_HOSTNAME}:9306';" >> "$CONFIG_SITE_PHP"
fi

if ! grep "'SPHINX_HOSTNAME_READONLY'" "$CONFIG_SITE_PHP"; then
echo "\$config['SPHINX_HOSTNAME_READONLY'] = 'manticore:9307';" >> "$CONFIG_SITE_PHP"
echo "\$config['SPHINX_HOSTNAME_READONLY'] = '${MANTICORE_HOSTNAME}:9307';" >> "$CONFIG_SITE_PHP"
fi
}

Expand Down

0 comments on commit 62bc020

Please sign in to comment.