setup 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/env bash
  2. set -o errexit
  3. if [ -f "../env/magento.env" ]; then
  4. source "../env/magento.env"
  5. else
  6. echo "Warning: magento.env file not found."
  7. fi
  8. MEM_BYTES=$(docker info -f '{{.MemTotal}}')
  9. MEM_MB=$(( MEM_BYTES / 1000000 ))
  10. # When Docker Desktop is set to 6GB in the GUI, it is reported as 6227 MB
  11. (( MEM_MB < 6227 )) && echo "There must be at least 6GB of RAM allocated to Docker in order to continue." && exit
  12. DOMAIN=${1:-magento.test}
  13. bin/stop
  14. bin/start --no-dev
  15. [ $? != 0 ] && echo "Failed to start Docker services" && exit
  16. bin/clinotty chmod u+x bin/magento
  17. rm -rf src && mkdir src
  18. echo "Adding Magento modules to Composer allow-plugins directive..."
  19. bin/clinotty composer config --no-plugins allow-plugins.magento/magento-composer-installer true
  20. bin/clinotty composer config --no-plugins allow-plugins.magento/inventory-composer-installer true
  21. bin/clinotty composer config --no-plugins allow-plugins.laminas/laminas-dependency-plugin true
  22. echo "Running, Magento setup:install..."
  23. bin/setup-install "${DOMAIN}"
  24. echo "Copying files from container to host after install..."
  25. bin/copyfromcontainer --all
  26. echo "Forcing deploy of static content to speed up initial requests..."
  27. bin/clinotty bin/magento setup:static-content:deploy -f
  28. echo "Re-indexing with Elasticsearch..."
  29. bin/clinotty bin/magento indexer:reindex
  30. echo "Setting basic URL and generating SSL certificate..."
  31. bin/setup-domain "${DOMAIN}"
  32. echo "Fixing owner and permissions..."
  33. bin/fixowns
  34. bin/fixperms
  35. echo "Clearing the cache to apply updates..."
  36. bin/clinotty bin/magento cache:flush
  37. echo "Installing cron, run 'bin/cron start' to enable..."
  38. bin/clinotty bin/magento cron:install
  39. echo "Turning on developer mode..."
  40. bin/clinotty bin/magento deploy:mode:set developer
  41. cp -r .vscode src/
  42. echo "Docker development environment setup complete."
  43. echo "You may now access your Magento instance at https://${DOMAIN}/"
  44. echo "You may now access your Magento backend instance at https://${DOMAIN}/admin/"
  45. echo "Use the following default credentials to log in:"
  46. echo "Username: $MAGENTO_ADMIN_USER"
  47. echo "Password: $MAGENTO_ADMIN_PASSWORD"