Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

79 строки
2.3 KiB

  1. #!/bin/bash
  2. TARGET_PATH="/var/www/crm-api/httpdocs"
  3. GIT_PATH="/var/www/matsen-git-repository/matsen-tool-be"
  4. create_directories() {
  5. # Erstelle notwendige Verzeichnisse falls sie nicht existieren
  6. mkdir -p ${TARGET_PATH}/config
  7. mkdir -p ${TARGET_PATH}/public
  8. mkdir -p ${TARGET_PATH}/var/cache
  9. }
  10. copy_files() {
  11. cd ${GIT_PATH}
  12. sudo GIT_SSH_COMMAND="ssh -i /home/service-spawntree/.ssh/id_rsa -p 1122" git pull
  13. echo "$(tput setab 2)matsen api has been PULLED$(tput sgr 0)"
  14. CONFIG_FILES="bundles.php preload.php routes.yaml services.yaml"
  15. CONFIG_DIRS="packages routes"
  16. ROOT_DIRS="bin migrations src"
  17. # Erstelle zuerst alle notwendigen Verzeichnisse
  18. create_directories
  19. rm -rf ${TARGET_PATH}/composer.lock
  20. rm -rf ${TARGET_PATH}/composer.json
  21. cp -rf ${GIT_PATH}/composer.json ${TARGET_PATH}
  22. for file in $CONFIG_FILES; do
  23. rm -rf ${TARGET_PATH}/config/$file
  24. cp -rf ${GIT_PATH}/config/$file ${TARGET_PATH}/config/
  25. done
  26. for dir in $CONFIG_DIRS; do
  27. rm -rf ${TARGET_PATH}/config/$dir
  28. cp -rf ${GIT_PATH}/config/$dir ${TARGET_PATH}/config/
  29. done
  30. for dir in $ROOT_DIRS; do
  31. rm -rf ${TARGET_PATH}/$dir
  32. cp -rf ${GIT_PATH}/$dir ${TARGET_PATH}/
  33. done
  34. # Stelle sicher, dass der public Ordner existiert
  35. mkdir -p ${TARGET_PATH}/public
  36. rm -rf ${TARGET_PATH}/public/index.php
  37. cp -rf ${GIT_PATH}/public/index.php ${TARGET_PATH}/public/
  38. echo "$(tput setab 2)Files have been copied$(tput sgr 0)"
  39. }
  40. if [ "$1" = "init" ]; then
  41. copy_files
  42. echo "$(tput setab 2)Init completed - files copied$(tput sgr 0)"
  43. else
  44. copy_files
  45. cd ${TARGET_PATH}
  46. composer update --no-scripts
  47. echo "$(tput setab 2)COMPOSER UPDATED updated$(tput sgr 0)"
  48. php ${TARGET_PATH}/bin/console doctrine:migrations:migrate
  49. echo "$(tput setab 2)DATABASE SCHEMA updated$(tput sgr 0)"
  50. cd ${TARGET_PATH}/var/cache/
  51. rm -R *
  52. php ${TARGET_PATH}/bin/console cache:clear
  53. php ${TARGET_PATH}/bin/console cache:warmup
  54. echo "$(tput setab 2)CACHE HAS BEEN CLEARED$(tput sgr 0)"
  55. cd ${TARGET_PATH}/var/
  56. sudo chmod 777 -R *
  57. sudo chmod 777 cache/ *
  58. sudo chmod 777 cache/
  59. echo "$(tput setab 7)$(tput setaf 1)THINK ABOUT POSSIBLE PATCHES!"
  60. echo "You have updated matsen api!$(tput sgr 0)"
  61. fi