2
0

setup 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/bash
  2. set -o errexit
  3. # shellcheck source=../env/db.env
  4. source env/db.env
  5. # shellcheck source=../env/magento.env
  6. source env/magento.env
  7. BASE_URL=${1:-magento2.test}
  8. ES_HOST=elasticsearch
  9. ES_PORT=9200
  10. bin/stop
  11. docker-compose -f docker-compose.yml up -d
  12. [ $? != 0 ] && echo "Failed to start Docker services" && exit
  13. bin/clinotty chmod u+x bin/magento
  14. mv .vscode src
  15. echo "Waiting for connection to Elasticsearch..."
  16. bin/clinotty timeout 100 bash -c "
  17. until curl --silent --output /dev/null http://$ES_HOST:$ES_PORT/_cat/health?h=st; do
  18. printf '.'
  19. sleep 2
  20. done"
  21. [ $? != 0 ] && echo "Failed to connect to Elasticsearch" && exit
  22. bin/clinotty bin/magento setup:install \
  23. --db-host="$MYSQL_HOST" \
  24. --db-name="$MYSQL_DATABASE" \
  25. --db-user="$MYSQL_USER" \
  26. --db-password="$MYSQL_PASSWORD" \
  27. --base-url=https://"$BASE_URL"/ \
  28. --base-url-secure=https://"$BASE_URL"/ \
  29. --backend-frontname="$MAGENTO_ADMIN_FRONTNAME" \
  30. --admin-firstname="$MAGENTO_ADMIN_FIRST_NAME" \
  31. --admin-lastname="$MAGENTO_ADMIN_LAST_NAME" \
  32. --admin-email="$MAGENTO_ADMIN_EMAIL" \
  33. --admin-user="$MAGENTO_ADMIN_USER" \
  34. --admin-password="$MAGENTO_ADMIN_PASSWORD" \
  35. --language="$MAGENTO_LOCALE" \
  36. --currency="$MAGENTO_CURRENCY" \
  37. --timezone="$MAGENTO_TIMEZONE" \
  38. --amqp-host=rabbitmq \
  39. --amqp-port=5672 \
  40. --amqp-user=guest \
  41. --amqp-password=guest \
  42. --amqp-virtualhost=/ \
  43. --cache-backend=redis \
  44. --cache-backend-redis-server=redis \
  45. --cache-backend-redis-db=0 \
  46. --page-cache=redis \
  47. --page-cache-redis-server=redis \
  48. --page-cache-redis-db=1 \
  49. --session-save=redis \
  50. --session-save-redis-host=redis \
  51. --session-save-redis-log-level=4 \
  52. --session-save-redis-db=2 \
  53. --search-engine=elasticsearch7 \
  54. --elasticsearch-host=$ES_HOST \
  55. --elasticsearch-port=$ES_PORT \
  56. --use-rewrites=1
  57. echo "Copying files from container to host after install..."
  58. bin/copyfromcontainer --all
  59. echo "Turning on developer mode.."
  60. bin/clinotty bin/magento deploy:mode:set developer
  61. echo "Forcing deploy of static content to speed up initial requests..."
  62. bin/clinotty bin/magento setup:static-content:deploy -f
  63. echo "Re-indexing with Elasticsearch..."
  64. bin/clinotty bin/magento indexer:reindex
  65. echo "Clearing the cache to apply updates..."
  66. bin/clinotty bin/magento cache:flush
  67. echo "Generating SSL certificate..."
  68. bin/setup-ssl "$BASE_URL"
  69. echo "Ensuring Composer auth.json is setup..."
  70. bin/setup-composer-auth
  71. echo "Docker development environment setup complete."
  72. echo "You may now access your Magento instance at https://${BASE_URL}/"