start 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. ## The following lines are commented oout per https://github.com/markshust/docker-magento/issues/351
  3. << 'COMMENTING-OUT'
  4. function parseYaml {
  5. local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
  6. sed -ne "s|,$s\]$s\$|]|" \
  7. -e ":1;s|^\($s\)\($w\)$s:$s\[$s\(.*\)$s,$s\(.*\)$s\]|\1\2: [\3]\n\1 - \4|;t1" \
  8. -e "s|^\($s\)\($w\)$s:$s\[$s\(.*\)$s\]|\1\2:\n\1 - \3|;p" $1 | \
  9. sed -ne "s|,$s}$s\$|}|" \
  10. -e ":1;s|^\($s\)-$s{$s\(.*\)$s,$s\($w\)$s:$s\(.*\)$s}|\1- {\2}\n\1 \3: \4|;t1" \
  11. -e "s|^\($s\)-$s{$s\(.*\)$s}|\1-\n\1 \2|;p" | \
  12. sed -ne "s|^\($s\):|\1|" \
  13. -e "s|^\($s\)-$s[\"']\(.*\)[\"']$s\$|\1$fs$fs\2|p" \
  14. -e "s|^\($s\)-$s\(.*\)$s\$|\1$fs$fs\2|p" \
  15. -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
  16. -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" | \
  17. awk -F$fs '{
  18. indent = length($1)/2;
  19. vname[indent] = $2;
  20. for (i in vname) {if (i > indent) {delete vname[i]; idx[i]=0}}
  21. if (length($2) == 0) {vname[indent] = ++idx[indent] };
  22. if (length($3) > 0) {
  23. vn=""; for (i=0; i<indent; i++) {vn = (vn)(vname[i])("_")}
  24. if ("'$2'_" == vn) {
  25. print substr($3 ,1 , match($3,":")-1)
  26. }
  27. }
  28. }'
  29. }
  30. # Check if volume files exist to avoid creating an empty folder
  31. VOLUME_LIST=`parseYaml docker-compose.dev.yml services_app_volumes`
  32. IGNORE_LIST="./src/app/code ./src/m2-hotfixes ./src/patches ./src/var/log ./src/var/report ./src"
  33. IS_VALID=true
  34. # Loop through all files missing from the docker-compose.dev.yml file
  35. for file in $VOLUME_LIST; do
  36. if [ ! -e $file ] && [[ ! " $IGNORE_LIST " =~ " $file " ]]; then
  37. echo "$file: No such file or directory"
  38. IS_VALID=false
  39. fi
  40. done
  41. # Wait to exit until all missing files have been outputted to the user
  42. [ $IS_VALID = false ] && echo "Failed to start docker for missing volume files" && exit
  43. COMMENTING-OUT
  44. docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d --remove-orphans "$@"
  45. ## Blackfire support
  46. # ------------------
  47. ## First register the blackfire agent with:
  48. #bin/root blackfire-agent --register --server-id={YOUR_SERVER_ID} --server-token={YOUR_SERVER_TOKEN}
  49. ## Then uncomment the below line (and leave uncommented) to start the agent automatically with bin/start:
  50. #bin/root /etc/init.d/blackfire-agent start