Compare commits

..

2 Commits

Author SHA1 Message Date
Francois Lesueur
2968582a74 ajout option NOKAZ 2023-01-18 12:13:48 +01:00
Francois Lesueur
08390feb38 petit sleep pour être sûr que kaz-prod est prêt 2023-01-17 11:51:38 +01:00
5 changed files with 34 additions and 29 deletions

View File

@ -44,19 +44,14 @@ Cette étape peut-être (très) longue. Notamment, la construction de kaz-prod s
## Mise au point ## Mise au point
(Non implémenté) Il est possible d'interrompre la création à la coquille vide (juste la VM sans les services KAZ) pour des question de mise au point avec la commande : Il est possible d'interrompre la création à la coquille vide (juste la VM sans les services KAZ) pour des question de mise au point avec la commande :
```bash ```bash
NOKAZ="true" vagrant up NOKAZ="true" vagrant up
``` ```
(Non implémenté) Dans ce cas, il faudra ensuite lancer dans la VM : Dans ce cas, il faudra ensuite lancer dans la VM :
```bash ```bash
snster -c /root/snster-kaz -t /root/templates attach kaz-prod -x /mnt/snster/root/snster-kaz/kaz/prod/kaz.sh KAZGUARD="true" /root/vm-install-kaz.sh
SETUP_MAIL="docker exec mailServ setup"
snster -c /root/snster-kaz -t /root/templates attach kaz-prod -x "${SETUP_MAIL} email add contact1@kaz.sns toto"
snster -c /root/snster-kaz -t /root/templates attach kaz-prod -x "${SETUP_MAIL} email add contact2@kaz.sns toto"
snster -c /root/snster-kaz -t /root/templates attach kaz-prod -x "${SETUP_MAIL} email add contact3@kaz.sns toto"
snster -c /root/snster-kaz -t /root/templates attach kaz-prod -x "${SETUP_MAIL} email add contact4@kaz.sns toto"
``` ```
Pour détruire la VM et recommencer : Pour détruire la VM et recommencer :

View File

@ -88,7 +88,7 @@ Vagrant.configure("2") do |config|
config.vm.synced_folder "/tmp/", "/tmp_host" config.vm.synced_folder "/tmp/", "/tmp_host"
config.vm.provision "shell" do |s| config.vm.provision "shell" do |s|
s.inline = "/vagrant/files/provision.sh" s.inline = "/vagrant/files/vm-provision.sh"
s.env = {"KAZGUARD" => "true", "HOSTLANG" => ENV['LANG'], "NOKAZ" => ENV['NOKAZ'], "KAZBRANCH" => ENV['KAZBRANCH']} s.env = {"KAZGUARD" => "true", "HOSTLANG" => ENV['LANG'], "NOKAZ" => ENV['NOKAZ'], "KAZBRANCH" => ENV['KAZBRANCH']}
end end
end end

View File

@ -61,13 +61,7 @@ export DebugLog="${OUTPUT_DIR}/log/log-kaz-$(date +%y-%m-%d-%T)-"
echo -e "\n #### secretGen\n" echo -e "\n #### secretGen\n"
/kaz/bin/secretGen.sh /kaz/bin/secretGen.sh
#possibilité de lancer vagrant up NOKAZ="true" quand on construit la machine
if [ "${NOKAZ}" == "true" ]; then
echo "on ne lance pas install.sh"
else
echo "on lance install.sh"
/kaz/bin/install.sh /kaz/bin/install.sh
fi
# clear apt cache # clear apt cache
DEBIAN_FRONTEND=noninteractive apt-get autoremove -y DEBIAN_FRONTEND=noninteractive apt-get autoremove -y

20
files/vm-install-kaz.sh Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash
# Installation de Kaz
if [ -z "${KAZGUARD}" ] ; then
exit 1
fi
snster -c /root/snster-kaz -t /root/templates start
sleep 10
snster -c /root/snster-kaz -t /root/templates 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 -t /root/templates attach kaz-prod -x "${SETUP_MAIL} email add contact1@kaz.sns toto"
snster -c /root/snster-kaz -t /root/templates attach kaz-prod -x "${SETUP_MAIL} email add contact2@kaz.sns toto"
snster -c /root/snster-kaz -t /root/templates attach kaz-prod -x "${SETUP_MAIL} email add contact3@kaz.sns toto"
snster -c /root/snster-kaz -t /root/templates 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

View File

@ -192,20 +192,16 @@ EOF
# Build SNSTER KAZ ! # Build SNSTER KAZ !
snster -c /root/snster-kaz -t /root/templates create snster -c /root/snster-kaz -t /root/templates create
snster -c /root/snster-kaz -t /root/templates start cp "${VAGRANT_SRC_DIR}/vm-install-kaz.sh" /root/
snster -c /root/snster-kaz -t /root/templates attach kaz-prod -x /mnt/snster/root/snster-kaz/kaz/prod/kaz.sh chmod +x /root/vm-install-kaz.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
# On crée quelques mails # On monte le filesystem de kaz-prod dans le /kaz de la VM pour le dév (en nofail)
SETUP_MAIL="docker exec mailServ setup"
snster -c /root/snster-kaz -t /root/templates attach kaz-prod -x "${SETUP_MAIL} email add contact1@kaz.sns toto"
snster -c /root/snster-kaz -t /root/templates attach kaz-prod -x "${SETUP_MAIL} email add contact2@kaz.sns toto"
snster -c /root/snster-kaz -t /root/templates attach kaz-prod -x "${SETUP_MAIL} email add contact3@kaz.sns toto"
snster -c /root/snster-kaz -t /root/templates 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
# On monte le filesystem de kaz-prod dans le /kaz de la VM pour le dév
mkdir /kaz-prod /kaz mkdir /kaz-prod /kaz
echo "overlay /kaz-prod overlay lowerdir=/var/lib/lxc/sr-masters-bullseye/rootfs,upperdir=/var/lib/lxc/kaz-kaz-prod/overlay/delta,workdir=/var/lib/lxc/kaz-kaz-prod/overlay/work,nofail 0 0" >> /etc/fstab echo "overlay /kaz-prod overlay lowerdir=/var/lib/lxc/sr-masters-bullseye/rootfs,upperdir=/var/lib/lxc/kaz-kaz-prod/overlay/delta,workdir=/var/lib/lxc/kaz-kaz-prod/overlay/work,nofail 0 0" >> /etc/fstab
echo "/kaz-prod/kaz /kaz none bind,nofail 0 0" >> /etc/fstab echo "/kaz-prod/kaz /kaz none bind,nofail 0 0" >> /etc/fstab