init 972 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. # Script to initialize a Magento development environment
  3. # Exit immediately if a command fails
  4. set -e
  5. echo ">>> Deploying Magento sample data..."
  6. bin/magento sampledata:deploy
  7. echo ">>> Disabling Two-Factor Authentication (for dev only)..."
  8. bin/composer require --dev markshust/magento2-module-disabletwofactorauth
  9. bin/magento module:enable MarkShust_DisableTwoFactorAuth
  10. echo ">>> Running setup upgrade (applies sample data + new modules)..."
  11. bin/magento setup:upgrade
  12. echo ">>> Setting long admin session lifetime (1 year)..."
  13. bin/magento config:set twofactorauth/general/enable 0
  14. bin/magento config:set admin/security/session_lifetime 31536000
  15. echo ">>> Generating URN catalog for IDEs..."
  16. bin/dev-urn-catalog-generate
  17. echo ">>> Running final optimizations (compile, reindex, cache flush)..."
  18. bin/magento setup:di:compile
  19. bin/magento indexer:reindex
  20. bin/magento cache:flush
  21. echo ">>> Magento development environment initialized successfully! 🎉"