Ingen beskrivning
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

redeploy_chrooted_lodel2.sh 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. schroot_cmd="schroot --directory /tmp -c lodel2"
  3. chrootdir="/localdata/lodel2-chroot"
  4. chroot_tarball="/localdata/lodel2-chroot.raz.tar.gz"
  5. chroot_instance_dir="/tmp/lodel2_instances/"
  6. mongodb_host="147.94.102.23"
  7. mongodb_login="admin"
  8. mongodb_pass="pass"
  9. echo "##############"
  10. echo "# Chroot RAZ #"
  11. echo "##############"
  12. mv $chrootdir ${chrootdir}_bck
  13. tar -xf $chroot_tarball && rm -R ${chrootdir}_bck || echo "RAZ failed, backup can be found in lodel2-chroot_bck"
  14. echo "Installing lodel2 in chroot"
  15. cp -v /tmp/lodel2_0.1_amd64.deb $chrootdir/tmp/
  16. $schroot_cmd -- /bin/bash -c 'dpkg -i /tmp/lodel2_0.1_amd64.deb ; apt install -yf'
  17. echo "####################"
  18. echo "# Lodel2 installed #"
  19. echo "####################"
  20. echo ""
  21. echo "#########################"
  22. echo "# Installing other deps #"
  23. echo "#########################"
  24. $schroot_cmd -- apt -y install mongodb-clients pwgen wamerican vim
  25. echo "##########################################"
  26. echo "# Configuring mass_deploy mongodb access #"
  27. echo "##########################################"
  28. $schroot_cmd -- bash -c "echo -e \"MONGODB_ADMIN_USER='$mongodb_login'\nMONGODB_ADMIN_PASSWORD='$mongodb_pass'\nMONGODB_HOST='$mongodb_host'\" >> /etc/lodel2/mass_deploy.cfg"
  29. $schroot_cmd -- bash -c "echo exit | mongo $mongodb_host --quiet -u $mongodb_login -p $mongodb_pass --authenticationDatabase admin && echo Connection to mongodb ok || echo connection fails"
  30. echo "####################################"
  31. echo "# Preparing lodel2 standalone mode #"
  32. echo "####################################"
  33. $schroot_cmd -- mkdir -vp $chroot_instance_dir
  34. $schroot_cmd -- cp -v /usr/lib/python3/dist-packages/lodel/plugins/multisite/loader.py $chroot_instance_dir
  35. echo -e "\n\nChroot RAZ and ready to run lodel2"
  36. #echo -e "\tYou are in chroot now\n\n"
  37. #$schroot_cmd