diff --git a/files/snster-kaz/kaz/prod/kaz/config/container-mail.list b/files/snster-kaz/kaz/prod/kaz-config/container-mail.list similarity index 100% rename from files/snster-kaz/kaz/prod/kaz/config/container-mail.list rename to files/snster-kaz/kaz/prod/kaz-config/container-mail.list diff --git a/files/snster-kaz/kaz/prod/kaz/config/container-orga.list b/files/snster-kaz/kaz/prod/kaz-config/container-orga.list similarity index 100% rename from files/snster-kaz/kaz/prod/kaz/config/container-orga.list rename to files/snster-kaz/kaz/prod/kaz-config/container-orga.list diff --git a/files/snster-kaz/kaz/prod/kaz/config/container-proxy.list b/files/snster-kaz/kaz/prod/kaz-config/container-proxy.list similarity index 100% rename from files/snster-kaz/kaz/prod/kaz/config/container-proxy.list rename to files/snster-kaz/kaz/prod/kaz-config/container-proxy.list diff --git a/files/snster-kaz/kaz/prod/kaz/config/container-withMail.list b/files/snster-kaz/kaz/prod/kaz-config/container-withMail.list similarity index 100% rename from files/snster-kaz/kaz/prod/kaz/config/container-withMail.list rename to files/snster-kaz/kaz/prod/kaz-config/container-withMail.list diff --git a/files/snster-kaz/kaz/prod/kaz/config/container-withoutMail.list b/files/snster-kaz/kaz/prod/kaz-config/container-withoutMail.list similarity index 100% rename from files/snster-kaz/kaz/prod/kaz/config/container-withoutMail.list rename to files/snster-kaz/kaz/prod/kaz-config/container-withoutMail.list diff --git a/files/snster-kaz/kaz/prod/kaz/config/dockers.env b/files/snster-kaz/kaz/prod/kaz-config/dockers.env similarity index 100% rename from files/snster-kaz/kaz/prod/kaz/config/dockers.env rename to files/snster-kaz/kaz/prod/kaz-config/dockers.env diff --git a/files/snster-kaz/kaz/prod/kaz.sh b/files/snster-kaz/kaz/prod/kaz.sh index c0d234a..26f9c63 100755 --- a/files/snster-kaz/kaz/prod/kaz.sh +++ b/files/snster-kaz/kaz/prod/kaz.sh @@ -22,47 +22,30 @@ export DebugLog="${OUTPUT_DIR}/log/log-kaz-$(date +%y-%m-%d-%T)-" fi echo -e "\n #### git checkout ${KAZBRANCH}\n" - # copie des sources cd / - [ -f kaz ] || git clone https://git.kaz.bzh/KAZ/kaz.git + git clone https://git.kaz.bzh/KAZ/kaz.git (cd /kaz ; git checkout "${KAZBRANCH}" ) - find /kaz -name \*.sh -exec chmod a+x {} \; - # pour ceux qui disposent d'un cache apt local et pas la fibre - if [ -f "${DIR}/.apt-mirror-config" ]; then - rsync -a "${DIR}/.apt-mirror-config" /kaz/ - fi - if [ -f "${DIR}/.proxy-config" ]; then - rsync -a "${DIR}/.proxy-config" /etc/profile.d/proxy.sh - rsync -a "${DIR}/.proxy-config" /kaz/ - fi - if [ -f "${DIR}/.docker-config.json" ]; then - mkdir -p /root/.docker - rsync -a "${DIR}/.docker-config.json" /root/.docker/config.json - fi - - - - echo -e "\n #### rsync download\n" - [ -d "${DIR}/kaz/download" ] && - rsync -a "${DIR}/kaz/download/" /kaz/download/ - [ -d "${DIR}/kaz/git" ] && - rsync -a "${DIR}/kaz/git/" /kaz/git/ - [ -f "${DIR}/kaz/config/dockers.env" ] && - [ ! -f "/kaz/config/dockers.env" ] && - rsync -a "${DIR}/kaz/config/dockers.env" /kaz/config/dockers.env + cp "${DIR}/kaz-config/dockers.env" /kaz/config/dockers.env for type in mail orga proxy withMail withoutMail ; do - [ -f "${DIR}/kaz/config/container-${type}.list" ] && - [ ! -f "/kaz/config/config/container-${type}.list" ] && - rsync -a "${DIR}/kaz/config/container-${type}.list" /kaz/config/ + [ -f "${DIR}/kaz-config/container-${type}.list" ] && + cp "${DIR}/kaz-config/container-${type}.list" /kaz/config/ done echo -e "\n #### secretGen\n" /kaz/bin/secretGen.sh + echo -e "\n #### install\n" /kaz/bin/install.sh + # On crée quelques mails + SETUP_MAIL="docker exec mailServ setup" + ${SETUP_MAIL} email add contact1@kaz.sns toto + ${SETUP_MAIL} email add contact2@kaz.sns toto + ${SETUP_MAIL} email add contact3@kaz.sns toto + ${SETUP_MAIL} email add contact4@kaz.sns toto + # clear apt cache DEBIAN_FRONTEND=noninteractive apt-get autoremove -y DEBIAN_FRONTEND=noninteractive apt-get clean diff --git a/files/snster-kaz/kaz/prod/provision.sh b/files/snster-kaz/kaz/prod/provision.sh index 107649c..de95521 100644 --- a/files/snster-kaz/kaz/prod/provision.sh +++ b/files/snster-kaz/kaz/prod/provision.sh @@ -55,12 +55,6 @@ if [ -d letsencrypt ]; then /usr/sbin/update-ca-certificates --fresh fi -# ./kaz.sh - -# On démarre au boot -echo -e '#!/bin/sh\n/kaz/bin/container.sh start' >> /etc/rc.local -chmod +x /etc/rc.local - # On sauve le proxy APT proxy=$(/sbin/ip route | awk '/default/ { print $3 }' | head -1) sed -i -e "s/^proxy.*$/proxy=$proxy/" /usr/local/sbin/detect_proxy.sh @@ -98,6 +92,23 @@ service docker restart DEBIAN_FRONTEND=noninteractive apt-get autoremove -y DEBIAN_FRONTEND=noninteractive apt-get clean +# On installe Kaz +ifconfig lo:0 100.80.0.2 +ifconfig lo:1 100.80.1.2 +echo "100.80.0.2 smtp imap www mail cloud cloud.kaz.sns tableur tableur.kaz.sns webmail webmail.kaz.sns garradin garradin.kaz.sns wiki wiki.kaz.sns git git.kaz.sns office office.kaz.sns depot depot.kaz.sns ldap ldap.kaz.sns" >> /etc/hosts +echo "100.80.1.2 listes listes.kaz.sns" >> /etc/hosts +cp "${DIR}/kaz.sh" /root/kaz.sh +cp -ar "${DIR}/kaz-config" /root/ +chmod +x /root/kaz.sh +bash "/root/kaz.sh" +sed -i -e "s/100.80.0.2.*//g" /etc/hosts +sed -i -e "s/100.80.1.2.*//g" /etc/hosts + + +# On démarre au boot +echo -e '#!/bin/sh\n/kaz/bin/container.sh start' >> /etc/rc.local +chmod +x /etc/rc.local + # notes fuse-overlayfs : #mknod -m 666 /dev/fuse c 10 229 diff --git a/files/vm-install-kaz.sh b/files/vm-install-kaz.sh deleted file mode 100644 index ace8725..0000000 --- a/files/vm-install-kaz.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# Installation de Kaz - -if [ -z "${KAZGUARD}" ] ; then - exit 1 -fi - -snster -c /root/snster-kaz start -sleep 10 -snster -c /root/snster-kaz attach kaz-prod -x /mnt/snster/root/snster-kaz/kaz/prod/kaz.sh - -# On crée quelques mails -SETUP_MAIL="docker exec mailServ setup" -snster -c /root/snster-kaz attach kaz-prod -x "${SETUP_MAIL} email add contact1@kaz.sns toto" -snster -c /root/snster-kaz attach kaz-prod -x "${SETUP_MAIL} email add contact2@kaz.sns toto" -snster -c /root/snster-kaz attach kaz-prod -x "${SETUP_MAIL} email add contact3@kaz.sns toto" -snster -c /root/snster-kaz attach kaz-prod -x "${SETUP_MAIL} email add contact4@kaz.sns toto" - -echo -e '#!/bin/sh\nsnster -c /root/snster-kaz start' >> /etc/rc.local -chmod +x /etc/rc.local diff --git a/files/vm-provision.sh b/files/vm-provision.sh index df3732e..6ef948b 100755 --- a/files/vm-provision.sh +++ b/files/vm-provision.sh @@ -200,16 +200,11 @@ auth: # Build SNSTER KAZ ! snster -c /root/snster-kaz create - cp "${VAGRANT_SRC_DIR}/vm-install-kaz.sh" /root/ - chmod +x /root/vm-install-kaz.sh cp "${VAGRANT_SRC_DIR}/vm-upgrade.sh" /root/ chmod +x /root/vm-upgrade.sh - if [ "${NOKAZ}" == "true" ]; then - echo "on ne fait pas l'install de kaz sur kaz-prod" - else - echo "on installe kaz sur kaz-prod" - bash "/root/vm-install-kaz.sh" - fi + + echo -e '#!/bin/sh\nsnster -c /root/snster-kaz start' >> /etc/rc.local + chmod +x /etc/rc.local echo "########## ********** End Vagrant $(date +%D-%T)" ) > >(tee ${DebugLog}stdout.log) 2> >(tee ${DebugLog}stderr.log >&2)