Last active
December 4, 2019 08:38
-
-
Save luizventurote/83fddff8188851a117c6ead2c3ac4b4f to your computer and use it in GitHub Desktop.
Bash script to install a Magento store with sample data automatically using Valet Plus and n98-magerun.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
folderName=${PWD##*/} | |
magentoUser="MAGENTO_PUBLIC_KEY" | |
magentoPassword="MAGENTO_SECRET_KEY" | |
n98-magerun2.phar install --dbHost="localhost" --dbUser="root" --dbPass="root" --dbName="${folderName}" --installationFolder="magento-folder" --installSampleData=yes --baseUrl="http://${folderName}.test/" | |
mv magento-folder/* . | |
rm -r magento-folder | |
composer update | |
echo "{\"http-basic\": {\"repo.magento.com\": {\"username\": \"${magentoUser}\",\"password\": \"${magentoPassword}\"}}}" >> auth.json | |
php bin/magento sampledata:deploy | |
php bin/magento setup:upgrade | |
echo "UPDATE core_config_data SET value='0' WHERE path='web/secure/use_in_frontend';" >> update.sql | |
echo "UPDATE core_config_data SET value='en_US' WHERE path='general/locale/code';" >> update.sql | |
echo "UPDATE core_config_data SET value='0' WHERE path='dev/static/sign';" >> update.sql | |
echo "UPDATE core_config_data SET value='http://${folderName}.test' WHERE path='web/secure/base_url';" >> update.sql | |
mysql -uroot -proot ${folderName} < update.sql | |
rm update.sql | |
php bin/magento admin:user:create --admin-firstname luiz --admin-lastname venturote --admin-email [email protected] --admin-user luiz --admin-password admin123 | |
php bin/magento cache:disable layout | |
php bin/magento cache:disable block_html | |
php bin/magento cache:disable full_page | |
valet open | |
echo "Done 🚀" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Set the right permissions before if necessary:
chmod +x ./valet-sample-magento.sh