2
0

setup 1.8 KB

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