Gestion des paramètres par des variables d'environnement

This commit is contained in:
Michael RICOIS 2015-11-05 15:57:24 +00:00
parent a49cabee36
commit 72fc6522ba
16 changed files with 65 additions and 45 deletions

12
README
View File

@ -1,4 +1,3 @@
USAGE
=====
@ -13,7 +12,18 @@ Sphinx Engine configuration
- Data storage
/var/lib/sphinxsearch/log : Log
/var/lib/sphinxsearch/idx : Data index
Environment variables
ENV_MYSQLHOST
ENV_MYSQLUSER
ENV_MYSQLPASS
sed -i -e 's/ENV_MYSQLHOST/VALUE/g' sphinx.*.conf
sed -i -e 's/ENV_MYSQLUSER/VALUE/g' sphinx.*.conf
sed -i -e 's/ENV_MYSQLPASS/VALUE/g' sphinx.*.conf
sed -i -e 's/ENV_MYSQLHOST/VALUE/g' indexer/*.sh
sed -i -e 's/ENV_MYSQLUSER/VALUE/g' indexer/*.sh
sed -i -e 's/ENV_MYSQLPASS/VALUE/g' indexer/*.sh
Indexing
--------
indexer-*.sh : Index on master database with rotation

View File

@ -2,10 +2,10 @@
source act
{
type = mysql
sql_host = 192.168.3.30
sql_host = ENV_MYSQLHOST
sql_port = 3306
sql_user = sphinx
sql_pass = indexer
sql_user = ENV_MYSQLUSER
sql_pass = ENV_MYSQLPASS
sql_db = jo
sql_query_pre = SET NAMES utf8
sql_query = SELECT l.id, l.idPar, l.idAct, r.siren, r.actif, r.PpPm, r.RS, r.adresse_cp, r.adresse_ville, \

View File

@ -2,10 +2,10 @@
source ciblage
{
type = mysql
sql_host = 192.168.3.30
sql_host = ENV_MYSQLHOST
sql_port = 3306
sql_user = sphinx
sql_pass = indexer
sql_user = ENV_MYSQLUSER
sql_pass = ENV_MYSQLPASS
sql_db = jo
sql_query_pre = SET NAMES utf8
sql_query = \

View File

@ -2,10 +2,10 @@
source ciblage
{
type = mysql
sql_host = 192.168.3.30
sql_host = ENV_MYSQLHOST
sql_port = 3306
sql_user = sphinx
sql_pass = indexer
sql_user = ENV_MYSQLUSER
sql_pass = ENV_MYSQLPASS
sql_db = jo
sql_query_pre = SET NAMES utf8
sql_query = \

View File

@ -2,10 +2,10 @@
source dir
{
type = mysql
sql_host = 192.168.3.30
sql_host = ENV_MYSQLHOST
sql_port = 3306
sql_user = sphinx
sql_pass = indexer
sql_user = ENV_MYSQLUSER
sql_pass = ENV_MYSQLPASS
sql_db = jo
sql_query_pre = SET NAMES utf8
sql_query = \

View File

@ -2,10 +2,10 @@
source dir
{
type = mysql
sql_host = 192.168.3.30
sql_host = ENV_MYSQLHOST
sql_port = 3306
sql_user = sphinx
sql_pass = indexer
sql_user = ENV_MYSQLUSER
sql_pass = ENV_MYSQLPASS
sql_db = jo
sql_query_pre = SET NAMES utf8
sql_query = \

View File

@ -2,10 +2,10 @@
source ent
{
type = mysql
sql_host = 192.168.3.30
sql_host = ENV_MYSQLHOST
sql_port = 3306
sql_user = sphinx
sql_pass = indexer
sql_user = ENV_MYSQLUSER
sql_pass = ENV_MYSQLPASS
sql_db = jo
sql_query_pre = SET NAMES utf8
sql_query = SELECT id, siren, nic, siege, \

View File

@ -2,10 +2,10 @@
source ent
{
type = mysql
sql_host = 192.168.3.30
sql_host = ENV_MYSQLHOST
sql_port = 3306
sql_user = sphinx
sql_pass = indexer
sql_user = ENV_MYSQLUSER
sql_pass = ENV_MYSQLPASS
sql_db = jo
sql_query_pre = SET NAMES utf8
sql_query = SELECT id, siren, nic, siege, \

View File

@ -2,14 +2,13 @@
source histo
{
type = mysql
sql_host = 192.168.3.30
sql_host = ENV_MYSQLHOST
sql_port = 3306
sql_user = sphinx
sql_pass = indexer
sql_user = ENV_MYSQLUSER
sql_pass = ENV_MYSQLPASS
sql_db = histobodacc
sql_query_pre = SET NAMES utf8
sql_query = SELECT id, nomFichier, annee1, dateBod, texte FROM bodacc_ocr;
sql_query_info = SELECT * FROM bodacc_ocr WHERE id=$id
sql_attr_uint = annee1
}

12
env.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
ENV_MYSQLHOST=192.168.3.28
ENV_MYSQLUSER=sphinx
ENV_MYSQLPASS=indexer
sed -i -e s/ENV_MYSQLHOST/"$ENV_MYSQLHOST"/g sphinx.*.conf
sed -i -e s/ENV_MYSQLUSER/"$ENV_MYSQLUSER"/g sphinx.*.conf
sed -i -e s/ENV_MYSQLPASS/"$ENV_MYSQLPASS"/g sphinx.*.conf
sed -i -e s/ENV_MYSQLHOST/"$ENV_MYSQLHOST"/g indexer/*.sh
sed -i -e s/ENV_MYSQLUSER/"$ENV_MYSQLUSER"/g indexer/*.sh
sed -i -e s/ENV_MYSQLPASS/"$ENV_MYSQLPASS"/g indexer/*.sh

View File

@ -1,7 +1,7 @@
#!/bin/bash
MYSQL_HOST=192.168.3.30
MYSQL_USER=sphinx
MYSQL_PASS=indexer
MYSQL_HOST=ENV_MYSQLHOST
MYSQL_USER=ENV_MYSQLUSER
MYSQL_PASS=ENV_MYSQLPASS
PATH_LOG=/var/lib/sphinxsearch/log
PATH_BIN=/usr/bin
PATH_SQL=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/sql

View File

@ -1,7 +1,7 @@
#!/bin/bash
MYSQL_HOST=192.168.3.30
MYSQL_USER=sphinx
MYSQL_PASS=indexer
MYSQL_HOST=ENV_MYSQLHOST
MYSQL_USER=ENV_MYSQLUSER
MYSQL_PASS=ENV_MYSQLPASS
PATH_LOG=/var/lib/sphinxsearch/log
PATH_BIN=/usr/bin
PATH_SQL=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/sql
@ -71,7 +71,6 @@ if [ -n "$idx" ]; then
mysql -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASS sdv1 -e "UPDATE sphinx_idx SET indexingEnd=NOW() WHERE id=$idx" >> $PATH_LOG/indexer.log
echo "FIN $(date '+%Y-%m-%d %H:%M:%S')" >> $FILEINDEX
echo "$(date '+%Y-%m-%d %H:%M:%S') === FIN INDEXATION DIR" >> $PATH_LOG/indexer.log
fi

View File

@ -1,7 +1,7 @@
#!/bin/bash
MYSQL_HOST=192.168.3.30
MYSQL_USER=sphinx
MYSQL_PASS=indexer
MYSQL_HOST=ENV_MYSQLHOST
MYSQL_USER=ENV_MYSQLUSER
MYSQL_PASS=ENV_MYSQLPASS
PATH_LOG=/var/lib/sphinxsearch/log
PATH_BIN=/usr/bin
PATH_SQL=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/sql

View File

@ -1,7 +1,7 @@
#!/bin/bash
MYSQL_HOST=192.168.3.30
MYSQL_USER=sphinx
MYSQL_PASS=indexer
MYSQL_HOST=ENV_MYSQLHOST
MYSQL_USER=ENV_MYSQLUSER
MYSQL_PASS=ENV_MYSQLPASS
PATH_LOG=/var/lib/sphinxsearch/log
PATH_BIN=/usr/bin
PATH_SQL=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/sql

View File

@ -1,7 +1,7 @@
#!/bin/bash
MYSQL_HOST=192.168.3.30
MYSQL_USER=sphinx
MYSQL_PASS=indexer
MYSQL_HOST=ENV_MYSQLHOST
MYSQL_USER=ENV_MYSQLUSER
MYSQL_PASS=ENV_MYSQLPASS
PATH_LOG=/var/lib/sphinxsearch/log
PATH_BIN=/usr/bin
PATH_SQL=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/sql

View File

@ -1,7 +1,7 @@
#!/bin/bash
MYSQL_HOST=192.168.3.30
MYSQL_USER=sphinx
MYSQL_PASS=indexer
MYSQL_HOST=ENV_MYSQLHOST
MYSQL_USER=ENV_MYSQLUSER
MYSQL_PASS=ENV_MYSQLPASS
PATH_LOG=/var/lib/sphinxsearch/log
PATH_BIN=/usr/bin
PATH_SQL=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/sql