templates/install/index.sh.twig line 1

Open in your IDE?
  1. #!/bin/bash
  2. #
  3. #
  4. #                           COSAVOSTRA
  5. #
  6. #                Installation/Mise à jour automatique de sites.
  7. #
  8. # Veuillez executer la commande :
  9. # bash <(curl -s '{{ absolute_url(path('install')) }}')
  10. #
  11. {# todo : set vhost first ! #}
  12. {# todo : install mailhog #}
  13. {# todo : set custom PHP version #}
  14. {# todo : verify git status on composer.json check #}
  15. {# todo : install phpmyadmin with mysql #}
  16. {# todo : verify WP & SF path access rights (wp-content / var) #}
  17. {# todo : ask database & username #}
  18. {# todo : set custom node version #}
  19. {# todo : rename script host like https://install.cosavostra.com #}
  20. {# todo : verify display in different terminal 'resolutions' #}
  21. {# todo : rsync with --omit-dir-times to prevent errors message ? #}
  22. {# todo : php7.4 repository need to be added for ubuntu 21.10 #}
  23. {# todo : notice if alias not present in . bashrc for current command . named install ? #}
  24. {# todo : set facl access rights #}
  25. clear
  26. {{ include('install/config.sh.twig') }}
  27. {{ include('install/functions.sh.twig') }}
  28. {{ include('install/logo.sh.twig') -}}
  29. {{ include('install/process.params.sh.twig') }}
  30. echo
  31. echo -e "\033[1mInstallation/Mise à jour automatique d'un projet depuis le serveur de DEV :\033[0m"
  32. echo
  33. # make some initials checks.
  34. {{ include('install/process.checks.sh.twig') }}
  35. # test wsl version
  36. {{ include('install/requirement.virtual.sh.twig') }}
  37. # test root access
  38. {{ include('install/requirement.root.sh.twig') }}
  39. # select project.
  40. {{ include('install/projects.list.sh.twig') }}
  41. # install requirements
  42. {{ include('install/requirement.common.sh.twig') }}
  43. {{ include('install/requirement.apache2.sh.twig') }}
  44. {{ include('install/requirement.tools.sh.twig') }}
  45. {{ include('install/requirement.php.sh.twig') }}
  46. {{ include('install/requirement.node.sh.twig') }}
  47. # verify mysql
  48. {{ include('install/requirement.mysql.sh.twig') }}
  49. # verify SSH access
  50. {{ include('install/requirement.ssh.sh.twig') }}
  51. # verify gitlab access
  52. {{ include('install/requirement.gitlab.sh.twig') }}
  53. # ask for final host
  54. {{ include('install/projects.host.sh.twig') }}
  55. # check project requirements.
  56. case $projectType in
  57.     "wordpress")
  58.         {{ include('install/requirement.wordpress.sh.twig') }}
  59.         ;;
  60.     "symfony")
  61.         {{ include('install/requirement.symfony.sh.twig') }}
  62.         ;;
  63.     *)
  64.         # nothing special
  65.         ;;
  66. esac
  67. # check source path
  68. {{ include('install/requirement.sourcepath.sh.twig') }}
  69. # verify destination path
  70. {{ include('install/process.destpath.sh.twig') }}
  71. # verify git access.
  72. {{ include('install/process.git.access.sh.twig') }}
  73. # create vhost
  74. {{ include('install/process.vhost.sh.twig') }}
  75. # import project
  76. case $projectType in
  77.     "wordpress")
  78.         {{ include('install/process.import.wordpress.sh.twig') }}
  79.         ;;
  80.     "symfony")
  81.         {{ include('install/process.import.symfony.sh.twig') }}
  82.         ;;
  83.     "react")
  84.         {{ include('install/process.import.react.sh.twig') }}
  85.         ;;
  86.     *)
  87.         echo
  88.         echo "##Erreur le type de projet ($projectType) n'est pas (encore) pris en compte. "
  89.         echo "Contactez un administrateur pour plus d'infos. "
  90.         exit 1
  91.         ;;
  92. esac
  93. # GIT reinitialisation
  94. {{ include('install/process.import.git.sh.twig') }}
  95. # get projects content
  96. case $projectType in
  97.     "wordpress")
  98.         {{ include('install/process.import.BDD.sh.twig') }}
  99.         {{ include('install/process.config.wordpress.sh.twig') }}
  100.         ;;
  101.     "symfony")
  102.         {{ include('install/process.import.BDD.sh.twig') }}
  103.         {{ include('install/process.config.symfony.sh.twig') }}
  104.         ;;
  105.     "react")
  106.         {# nothing to import. #}
  107.         ;;
  108.     *)
  109.         echo "Erreur le type de projet ($projectType) n'est pas (encore) pris en compte. "
  110.         echo "Contactez un administrateur pour plus d'infos. "
  111.         exit 1
  112.         ;;
  113. esac
  114. {{ include('install/process.finalise.sh.twig') }}
  115. echo
  116. echo
  117. echo "Site disponible vers : http://${siteDomain}"
  118. {{ include('install/logo.sh.twig') }}
  119. echo
  120. # detect if we are in a virtual machine with 'systemd-detect-virt'
  121. # display aditionnal informations
  122. {#{{ include('install/info.virtualmachine.sh.twig') }}#}
  123. # open localwebsite page
  124. xdg-open http://${siteDomain} >/dev/null 2>&1