pg_hba.conf, setup.env, edex setup reconfig for localhost and external fqdn

This commit is contained in:
mjames-upc 2017-09-28 12:55:11 -06:00
parent f127f8895a
commit 666a9b37fe
3 changed files with 20 additions and 98 deletions

View file

@ -1,5 +1,6 @@
export AW_SITE_IDENTIFIER=OAX export AW_SITE_IDENTIFIER=OAX
export EDEX_SERVER=localhost export EDEX_SERVER=localhost
export EXT_ADDR=external
# database # database
export DC_DB_NAME=dc_ob7oax export DC_DB_NAME=dc_ob7oax
@ -12,19 +13,20 @@ export DATA_ARCHIVE_ROOT=/awips2/data_store
export DB_ADDR=${EDEX_SERVER} export DB_ADDR=${EDEX_SERVER}
export DB_PORT=5432 export DB_PORT=5432
# pypies hdf5 connection
export PYPIES_SERVER=http://${EDEX_SERVER}:9582
# qpid connection # qpid connection
export BROKER_ADDR=${EDEX_SERVER} export BROKER_ADDR=${EDEX_SERVER}
# pypies hdf5 connection
export PYPIES_SERVER=http://${EXT_ADDR}:9582
# these values are returned to clients that contact the localization service # these values are returned to clients that contact the localization service
export HTTP_PORT=9581 export HTTP_PORT=9581
export HTTP_SERVER_PATH=/services export HTTP_SERVER_PATH=/services
export HTTP_SERVER=http://${EDEX_SERVER}:${HTTP_PORT}${HTTP_SERVER_PATH} export HTTP_SERVER=http://${EXT_ADDR}:${HTTP_PORT}${HTTP_SERVER_PATH}
export JMS_SERVER=tcp://${EDEX_SERVER}:5672 export JMS_SERVER=tcp://${EXT_ADDR}:5672
export JMS_VIRTUALHOST=edex export JMS_VIRTUALHOST=edex
export JMS_CONNECTIONS_URL=http://${EDEX_SERVER}:8180/api/latest/connection/${JMS_VIRTUALHOST} export JMS_CONNECTIONS_URL=http://${EXT_ADDR}:8180/api/latest/connection/${JMS_VIRTUALHOST}
export RADAR_SERVER=tcp://${EXT_ADDR}:8813
# data delivery config # data delivery config
#export CLUSTER_ID=NCF #export CLUSTER_ID=NCF

View file

@ -76,25 +76,15 @@ local ebxml all trust
local replication replication trust local replication replication trust
# IPv4 local connections: # IPv4 local connections:
host fxatext all 127.0.0.1/32 trust host fxatext all 127.0.0.1/32 trust
host fxatext all 147.18.136.0/24 trust
host hd_ob92oax all 127.0.0.1/32 trust host hd_ob92oax all 127.0.0.1/32 trust
host hd_ob92oax all 147.18.136.0/24 trust
host dc_ob7oax all 127.0.0.1/32 trust host dc_ob7oax all 127.0.0.1/32 trust
host dc_ob7oax all 147.18.136.0/24 trust
host hmdb all 127.0.0.1/32 trust host hmdb all 127.0.0.1/32 trust
host hmdb all 147.18.136.0/24 trust
host metadata all 127.0.0.1/32 md5 host metadata all 127.0.0.1/32 md5
host metadata all 147.18.136.0/24 md5
host maps all 127.0.0.1/32 md5 host maps all 127.0.0.1/32 md5
host maps all 147.18.136.0/24 md5
host postgres all 127.0.0.1/32 md5 host postgres all 127.0.0.1/32 md5
host postgres all 147.18.136.0/24 md5
host ncep all 127.0.0.1/32 md5 host ncep all 127.0.0.1/32 md5
host ncep all 147.18.136.0/24 md5
host ebxml all 127.0.0.1/32 trust host ebxml all 127.0.0.1/32 trust
host ebxml all 147.18.136.0/24 trust
host replication replication 127.0.0.1/32 md5 host replication replication 127.0.0.1/32 md5
host replication replication 147.18.136.0/24 md5
# IPv6 local connections: # IPv6 local connections:
host all all ::1/128 md5 host all all ::1/128 md5
host replication replication ::1/128 md5 host replication replication ::1/128 md5

View file

@ -17,7 +17,6 @@
# edex log [ingest|request|grib|text|satellite|radar|ldm] # # edex log [ingest|request|grib|text|satellite|radar|ldm] #
# Monitors the current day's requested log. Defaults to ingest. # # Monitors the current day's requested log. Defaults to ingest. #
# # # #
# #
# edex setup # # edex setup #
# Adds server IP and hostname to EDEX config files if they don't # # Adds server IP and hostname to EDEX config files if they don't #
# contain the correct setting already (requires user prompt) # # contain the correct setting already (requires user prompt) #
@ -29,18 +28,14 @@
# 11/2015 M.James/Unidata Added CAVE user count as "edex users" # # 11/2015 M.James/Unidata Added CAVE user count as "edex users" #
# 10/2016 M.James/Unidata No longer need to edit ldmd.conf # # 10/2016 M.James/Unidata No longer need to edit ldmd.conf #
# 06/2017 M.James/Unidata Restart # # 06/2017 M.James/Unidata Restart #
# 09/2017 M.James/Unidata Rudimentary remote db password control, #
# remove pg_hba.conf edits #
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
. /etc/profile.d/awips2.sh . /etc/profile.d/awips2.sh
# directories definitions # directories definitions
AWIPS_HOME=/awips2 EDEX_PATH=/awips2/edex
EDEX_PATH=${AWIPS_HOME}/edex DATA_PATH=/awips2/data
DATA_PATH=${AWIPS_HOME}/data
LOG_PATH=${EDEX_PATH}/logs LOG_PATH=${EDEX_PATH}/logs
# files
if [ -d "/awips2/data" ]; then
PG_FILE=${DATA_PATH}/pg_hba.conf
fi
EDEX_ENV_FILE=${EDEX_PATH}/bin/setup.env EDEX_ENV_FILE=${EDEX_PATH}/bin/setup.env
# valid options # valid options
@ -53,15 +48,9 @@ IP=`/sbin/ifconfig $usedev | grep -v "inet6" | grep "inet" | awk '{ print $2 }'
# truncate # truncate
IP_CIDR="${IP%.*}" IP_CIDR="${IP%.*}"
if [ -d "/awips2/data" ]; then editFiles=($EDEX_ENV_FILE)
editFiles=($PG_FILE $EDEX_ENV_FILE) boolFiles=(true)
boolFiles=(true true) editFuncs=(edit_setup)
editFuncs=(edit_pg edit_edex)
else
editFiles=($EDEX_ENV_FILE)
boolFiles=(true)
editFuncs=(edit_edex)
fi
YMD=`date '+%Y%m%d'` YMD=`date '+%Y%m%d'`
@ -156,7 +145,7 @@ edex_log() { # display todays log, default to ingest
echo '' echo ''
# LDM log # LDM log
if [ "${args[1]}" == 'ldm' ]; then if [ "${args[1]}" == 'ldm' ]; then
LOG_FILE=${AWIPS_HOME}/ldm/logs/ldmd.log LOG_FILE=/awips2/ldm/logs/ldmd.log
tail_log tail_log
exit; exit;
fi fi
@ -217,16 +206,9 @@ edex_log() { # display todays log, default to ingest
fi fi
} }
edit_pg() { # edex pg_hba.conf # See /awips2/edex/bin/setup.env
schStr=`grep "\/24" $PG_FILE | head -1 | awk '{ print $4 }' | cut -d/ -f1` edit_setup() {
subStr=$IP_CIDR'.0' sed -i.setup_$YMD 's/external/'$HOSTNAME'/g' $EDEX_ENV_FILE
sed -i.setup_$YMD 's/'$schStr'/'$subStr'/g' $PG_FILE
echo '[edit] '$subStr' added to '$PG_FILE
echo ' File backed up to '$PG_FILE'.setup_'$YMD
}
edit_edex() { # setup.env automatic edit
sed -i.setup_$YMD 's/localhost/'$HOSTNAME'/g' $EDEX_ENV_FILE
echo '[edit] '$HOSTNAME' added to '$EDEX_ENV_FILE echo '[edit] '$HOSTNAME' added to '$EDEX_ENV_FILE
echo ' File backed up to '$EDEX_ENV_FILE'.setup_'$YMD echo ' File backed up to '$EDEX_ENV_FILE'.setup_'$YMD
} }
@ -252,9 +234,6 @@ edex_ipexit() { # abandon ip editing, post msg to guide manual edits
echo -e ' You may need to MANUALLY EDIT the following files' echo -e ' You may need to MANUALLY EDIT the following files'
echo -e '\n'$editCom echo -e '\n'$editCom
echo -e ' for EDEX to work properly. \n' echo -e ' for EDEX to work properly. \n'
echo -e ' Special notes:'
echo -e ' '$PG_FILE' *must* contain your subdomain.'
echo ''
} }
edex_setup() { # setup IP subnet and domains for EDEX, prompt user for confirm edex_setup() { # setup IP subnet and domains for EDEX, prompt user for confirm
@ -291,29 +270,7 @@ edex_setup() { # setup IP subnet and domains for EDEX, prompt user for confirm
fi fi
continue=false continue=false
# pg_hba.conf # ldm regutil
if [ -d "/awips2/data" ]; then
pgGrep=`grep $IP_CIDR $PG_FILE | head -1`
echo -n ' Checking '$PG_FILE
if [[ ! -z ${pgGrep} ]]; then
echo ' [OK]'
boolFiles[0]=false
else
echo -e '\n ** Missing '$IP_CIDR
continue=true
fi
fi
# EDEX env
envGrep=`grep $HOSTNAME $EDEX_ENV_FILE | head -1`
echo -n ' Checking '$EDEX_ENV_FILE
if [[ ! -z ${envGrep} ]]; then
echo ' [OK]'
boolFiles[1]=false
else
echo ' ** Missing '$HOSTNAME
continue=true
fi
if [ -d "/awips2/ldm" ]; then if [ -d "/awips2/ldm" ]; then
#echo '[edit] ldm regutil...' #echo '[edit] ldm regutil...'
su - awips -c 'regutil -s '$HOSTNAME' /hostname' su - awips -c 'regutil -s '$HOSTNAME' /hostname'
@ -326,34 +283,7 @@ edex_setup() { # setup IP subnet and domains for EDEX, prompt user for confirm
echo '' echo ''
} }
edex_conf_check() { # check that IP and hostname are set correctly. if not, call setup
if [[ -z `grep $IP_CIDR $PG_FILE` ]]; then
echo '[WARN] *** File ['$PG_FILE'] contains incorrect IP addresses'
while true; do
echo ''
read -p "Run setup now? [y/n]" eyn
case $eyn in
[Yy]* ) edex_setup; break;;
[Nn]* ) echo 'exiting'; exit;;
* ) echo "Please answer yes or no.";;
esac
echo ''
done
echo ' Run "edex setup" to configure'
exit
fi
#if [[ -z `grep $HOSTNAME $EDEX_ENV_FILE` ]]; then
# echo '[WARN] *** File ['$EDEX_ENV_FILE'] contains localhost'
# echo ' *** Run "edex setup" to configure'
# exit
#fi
}
edex_start() { # start all edex services edex_start() { # start all edex services
#if [ -d "/awips2/data" ]; then
# edex_conf_check
#fi
edex_cleanup edex_cleanup
if [ -f "/etc/init.d/edex_postgres" ]; then if [ -f "/etc/init.d/edex_postgres" ]; then
su -c "service edex_postgres start" su -c "service edex_postgres start"