setup 2.2 KB

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