setup 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/bash
  2. BASE_URL=${1:-magento2.test}
  3. bin/stop
  4. # get rid of vertex/module-tax, not required and causes checksum errors on composer install
  5. # https://github.com/markshust/docker-magento/issues/135
  6. sed -e 's/"conflict": {/"replace": { "vertex\/module-tax": "*" },\ "conflict": {/' src/composer.json > composer.json && mv composer.json src/composer.json
  7. docker-compose -f docker-compose.yml up -d
  8. sleep 1 #Ensure containers are started...
  9. echo "Copying all files from host to container..."
  10. rm -rf src/vendor #Clear for step below
  11. bin/copytocontainer --all
  12. bin/clinotty chmod u+x bin/magento
  13. echo "Forcing reinstall of composer deps to ensure perms & reqs..."
  14. bin/clinotty composer install
  15. bin/clinotty bin/magento setup:install \
  16. --db-host=db \
  17. --db-name=magento \
  18. --db-user=magento \
  19. --db-password=magento \
  20. --base-url=https://$BASE_URL/ \
  21. --admin-firstname=John \
  22. --admin-lastname=Smith \
  23. --admin-email=john.smith@gmail.com \
  24. --admin-user=john.smith \
  25. --admin-password=password123 \
  26. --language=en_US \
  27. --currency=USD \
  28. --timezone=America/New_York \
  29. --use-rewrites=1
  30. echo "Turning on developer mode.."
  31. bin/clinotty bin/magento deploy:mode:set developer
  32. bin/clinotty bin/magento indexer:reindex
  33. echo "Forcing deploy of static content to speed up initial requests..."
  34. bin/clinotty bin/magento setup:static-content:deploy -f
  35. echo "Enabling redis for cache..."
  36. bin/clinotty bin/magento setup:config:set --no-interaction --cache-backend=redis --cache-backend-redis-server=redis --cache-backend-redis-db=0
  37. echo "Enabling Redis for session..."
  38. bin/clinotty bin/magento setup:config:set --no-interaction --session-save=redis --session-save-redis-host=redis --session-save-redis-log-level=4 --session-save-redis-db=1
  39. echo "Clearing the cache for good measure..."
  40. bin/clinotty bin/magento cache:flush
  41. echo "Copying files from container to host after install..."
  42. bin/copyfromcontainer app
  43. bin/copyfromcontainer vendor
  44. echo "Restarting containers with host bind mounts for dev..."
  45. bin/restart
  46. echo "Docker development environment setup complete."
  47. echo "You may now access your Magento instance at https://${BASE_URL}/"