setup 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/bin/bash
  2. set -o errexit
  3. source env/db.env
  4. BASE_URL=${1:-magento2.test}
  5. bin/stop
  6. docker-compose -f docker-compose.yml up -d
  7. [ $? != 0 ] && echo "Failed to start Docker services" && exit
  8. sleep 5 #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. bin/setup-composer-auth
  14. echo "Forcing reinstall of composer deps to ensure perms & reqs..."
  15. bin/clinotty composer global require hirak/prestissimo
  16. bin/clinotty composer update
  17. bin/clinotty bin/magento setup:install \
  18. --db-host=$MYSQL_HOST \
  19. --db-name=$MYSQL_DATABASE \
  20. --db-user=$MYSQL_USER \
  21. --db-password=$MYSQL_PASSWORD \
  22. --base-url=https://$BASE_URL/ \
  23. --base-url-secure=https://$BASE_URL/ \
  24. --backend-frontname=admin \
  25. --admin-firstname=John \
  26. --admin-lastname=Smith \
  27. --admin-email=john.smith@gmail.com \
  28. --admin-user=john.smith \
  29. --admin-password=password123 \
  30. --language=en_US \
  31. --currency=USD \
  32. --timezone=America/New_York \
  33. --amqp-host=rabbitmq \
  34. --amqp-port=5672 \
  35. --amqp-user=guest \
  36. --amqp-password=guest \
  37. --amqp-virtualhost=/ \
  38. --cache-backend=redis \
  39. --cache-backend-redis-server=redis \
  40. --cache-backend-redis-db=0 \
  41. --page-cache=redis \
  42. --page-cache-redis-server=redis \
  43. --page-cache-redis-db=1 \
  44. --session-save=redis \
  45. --session-save-redis-host=redis \
  46. --session-save-redis-log-level=4 \
  47. --session-save-redis-db=2 \
  48. --search-engine=elasticsearch7 \
  49. --elasticsearch-host=elasticsearch \
  50. --use-rewrites=1
  51. echo "Turning on developer mode.."
  52. bin/clinotty bin/magento deploy:mode:set developer
  53. bin/clinotty bin/magento indexer:reindex
  54. echo "Forcing deploy of static content to speed up initial requests..."
  55. bin/clinotty bin/magento setup:static-content:deploy -f
  56. echo "Re-indexing with Elasticsearch..."
  57. bin/clinotty bin/magento indexer:reindex
  58. echo "Clearing the cache to apply updates..."
  59. bin/clinotty bin/magento cache:flush
  60. echo "Copying files from container to host after install..."
  61. bin/copyfromcontainer app
  62. bin/copyfromcontainer vendor
  63. echo "Generating SSL certificate..."
  64. bin/setup-ssl $BASE_URL
  65. echo "Docker development environment setup complete."
  66. echo "You may now access your Magento instance at https://${BASE_URL}/"