No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

67 líneas
1.9 KiB

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