No Description
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 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/bash
  2. #
  3. # This file is part of Lodel 2 (https://github.com/OpenEdition)
  4. #
  5. # Copyright (C) 2015-2017 Cléo UMS-3287
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU Affero General Public License as published
  9. # by the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU Affero General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Affero General Public License
  18. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. #
  20. schroot_cmd="schroot --directory /tmp -c lodel2"
  21. chrootdir="/localdata/lodel2-chroot"
  22. chroot_tarball="/localdata/lodel2-chroot.raz.tar.gz"
  23. chroot_instance_dir="/tmp/lodel2_instances/"
  24. mongodb_host="147.94.102.23"
  25. mongodb_login="admin"
  26. mongodb_pass="pass"
  27. echo "##############"
  28. echo "# Chroot RAZ #"
  29. echo "##############"
  30. mv $chrootdir ${chrootdir}_bck
  31. tar -xf $chroot_tarball && rm -R ${chrootdir}_bck || echo "RAZ failed, backup can be found in lodel2-chroot_bck"
  32. echo "Installing lodel2 in chroot"
  33. cp -v /tmp/lodel2_0.1_amd64.deb $chrootdir/tmp/
  34. $schroot_cmd -- /bin/bash -c 'dpkg -i /tmp/lodel2_0.1_amd64.deb ; apt install -yf'
  35. echo "####################"
  36. echo "# Lodel2 installed #"
  37. echo "####################"
  38. echo ""
  39. echo "#########################"
  40. echo "# Installing other deps #"
  41. echo "#########################"
  42. $schroot_cmd -- apt -y install mongodb-clients pwgen wamerican vim
  43. echo "##########################################"
  44. echo "# Configuring mass_deploy mongodb access #"
  45. echo "##########################################"
  46. $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"
  47. $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"
  48. echo "####################################"
  49. echo "# Preparing lodel2 standalone mode #"
  50. echo "####################################"
  51. $schroot_cmd -- mkdir -vp $chroot_instance_dir
  52. $schroot_cmd -- cp -v /usr/lib/python3/dist-packages/lodel/plugins/multisite/loader.py $chroot_instance_dir
  53. echo -e "\n\nChroot RAZ and ready to run lodel2"
  54. #echo -e "\tYou are in chroot now\n\n"
  55. #$schroot_cmd