#!/bin/bash ######################################## # setup KAZ_ROOT=$(cd "$(dirname $0)/../.."; pwd) . "${KAZ_ROOT}/bin/.commonFunctions.sh" setKazVars #TMPL=html/index.tmpl.html #CONF=html/index.html TEST_TMPL="${DOCK_VOL}/web_html/_data/status/allServices.tmpl.html" TEST_CONF="${DOCK_VOL}/web_html/_data/status/allServices.html" declare -A siteNames=( [prod1]="Rennes" [prod2]="Nantes A" [prod3]="Nantes B" ) declare -A siteSSH=( [prod1]="" [prod2]="ssh -p 2201 root@prod2.kaz.bzh" [prod3]="ssh -p 2201 root@kazoulet.kaz.bzh" ) siteKeys=$(echo "${!siteNames[@]}"|tr ' ' '\n'|sort|tr '\n' ' ') declare -a availableServices . "${DOCKERS_ENV}" # XXX A reprendre de ce qui est attendu par container.sh availableServices=( www ${calcHost} # ${castopodHost} : need orga ${cloudHost} ${dateHost} ${dokuwikiHost} ${fileHost} ${gitHost} # ${gravHost} ${imapsyncHost} # ${ldapHost} ${ldapUIHost} ${matterHost} ${mobilizonHost} ${padHost} # paheko : need orga ${sympaHost} ${vigiloHost} ${vaultwardenHost} ${webmailHost} # wordpress : need orga ) echo -e "create status/allServices.html" mkdir -p "$(dirname ${TEST_TMPL})" ######################################## # commun echo -e "${BLUE}${BOLD} * Base${NC}" cat > "${TEST_TMPL}" < KAZ : test des services

Commun

EOF for service in ${availableServices[@]} ; do echo "

${service}

" >> "${TEST_TMPL}" done for service in prod1-office prod2-office kazoulet-office; do echo "

${service}

" >> "${TEST_TMPL}" done echo "
" >> "${TEST_TMPL}" ######################################## # All sites for siteKey in ${siteKeys}; do echo -e "${BLUE}${BOLD} * Orgas ${siteNames[$siteKey]}${NC}" declare -a availableOrga availableOrga=( $(${siteSSH[$siteKey]} cat "${KAZ_CONF_DIR}/container-orga.list" | sed -e "s/\(.*\)[ \t]*#.*$/\1/" -e "s/^[ \t]*\(.*\)$/\1/" -e "/^$/d") ) echo "

Le(s) ${#availableOrga[@]} orga(s) de ${siteNames[$siteKey]} :

" >> "${TEST_TMPL}" for orga in ${availableOrga[@]} ; do orgaName=${orga%-orga} echo " ${orgaName}" services=$(${siteSSH[$siteKey]} "${KAZ_COMP_DIR}/${orga}/orga-gen.sh" -l | sed -e "s/collabora/office/") for service in ${services}; do echo "

${orgaName}-${service}

" done echo "
" done >> "${TEST_TMPL}" done ######################################## # foreign domains echo -e "${BLUE}${BOLD} * Extern${NC}" echo "

Les redirections

" >> "${TEST_TMPL}" for siteKey in ${siteKeys}; do echo -e "${BLUE}${BOLD} * Orgas ${siteNames[$siteKey]}${NC}" echo "

${siteNames[$siteKey]}

" >> "${TEST_TMPL}" for extrenal in $( ${siteSSH[$siteKey]} "${KAZ_BIN_DIR}/foreign-domain.sh" -l | sort -u) ; do echo "

${extrenal}

" done >> "${TEST_TMPL}" done echo "


" >> "${TEST_TMPL}" ######################################## #"${APPLY_TMPL}" "${TMPL}" "${CONF}" "${APPLY_TMPL}" "${TEST_TMPL}" "${TEST_CONF}"