代码拉取完成,页面将自动刷新
#!/usr/bin/env bash
# Enable trace printing and exit on the first error
set -ex
get_config_value="/vagrant/scripts/get_config_value.sh"
magento_host_name=$(bash ${get_config_value} "magento_host_name")
vagrant_dir="/vagrant"
declare -A setupOptions
setupOptions[admin_frontname]=$(bash ${get_config_value} "magento_admin_frontname")
setupOptions[language]=$(bash ${get_config_value} "magento_language")
setupOptions[timezone]=$(bash ${get_config_value} "magento_timezone")
setupOptions[currency]=$(bash ${get_config_value} "magento_currency")
setupOptions[admin_user]=$(bash ${get_config_value} "magento_admin_user")
setupOptions[admin_password]=$(bash ${get_config_value} "magento_admin_password")
setupOptions[db_host]='localhost'
setupOptions[db_name]='magento'
setupOptions[db_user]='root'
setupOptions[base_url]="http://${magento_host_name}/"
setupOptions[admin_lastname]='Admin'
setupOptions[admin_firstname]='Admin'
setupOptions[admin_email]='admin@example.com'
setupOptions[amqp_host]='localhost'
setupOptions[amqp_port]='5672'
setupOptions[amqp_user]='guest'
setupOptions[amqp_password]='guest'
cd ${MAGENTO_ROOT}
# Clear cache
m-clear-cache
# Remove configuration files
rm -f "${MAGENTO_ROOT}/app/etc/config.php"
rm -f "${MAGENTO_ROOT}/app/etc/env.php"
# Create DB
db_names=(${setupOptions[db_name]} "magento_integration_tests" )
for db_name in "${db_names[@]}"; do
mysql -e "drop database if exists ${db_name}; create database ${db_name};"
done
# Install Magento application
cd ${MAGENTO_ROOT}
install_cmd="./bin/magento setup:install \
--db-host=${setupOptions[db_host]} \
--db-name=${setupOptions[db_name]} \
--db-user=${setupOptions[db_user]} \
--backend-frontname=${setupOptions[admin_frontname]} \
--base-url=${setupOptions[base_url]} \
--language=${setupOptions[language]} \
--timezone=${setupOptions[timezone]} \
--currency=${setupOptions[currency]} \
--admin-lastname=${setupOptions[admin_lastname]} \
--admin-firstname=${setupOptions[admin_firstname]} \
--admin-email=${setupOptions[admin_email]} \
--admin-user=${setupOptions[admin_user]} \
--admin-password=${setupOptions[admin_password]} \
--cleanup-database \
--use-rewrites=1"
# Configure Rabbit MQ
if [ -f "${MAGENTO_ROOT}/app/code/Magento/Amqp/registration.php" ]; then
install_cmd="${install_cmd} \
--amqp-host=${setupOptions[amqp_host]} \
--amqp-port=${setupOptions[amqp_port]} \
--amqp-user=${setupOptions[amqp_user]} \
--amqp-password=${setupOptions[amqp_password]}"
fi
chmod +x bin/magento
php ${install_cmd}
# Comment out the line above and uncomment the one below to debug Magento Setup script
# php -d xdebug.remote_host=192.168.10.1 -d xdebug.idekey=PHPSTORM -d xdebug.remote_connect_back=0 -d xdebug.remote_autostart=1 ${install_cmd}
# Enable Magento cron jobs
echo "* * * * * php ${MAGENTO_ROOT}/bin/magento cron:run &" | crontab -u vagrant -
use_nfs=$(bash "${vagrant_dir}/scripts/get_config_value.sh" "guest_use_nfs")
is_windows_host=${IS_WINDOWS_HOST}
if [[ ${is_windows_host} == 1 || ${use_nfs} == 0 ]]; then
chown -R vagrant:vagrant ${MAGENTO_ROOT}
fi
# Generate XSD references for PHP Storm
php bin/magento dev:urn-catalog:generate /vagrant/.idea/misc.xml
sed -i "s|${MAGENTO_ROOT}|${MAGENTO_ROOT_HOST}|g" "/vagrant/.idea/misc.xml"
set +x
echo "
Magento application was deployed to ${MAGENTO_ROOT} and installed successfully
Access storefront at ${setupOptions[base_url]}
Access admin panel at ${setupOptions[base_url]}${setupOptions[admin_frontname]}/"
if [[ ${is_windows_host} == 1 || ${use_nfs} == 0 ]]; then
echo "
[Optional] To finish developer environment set up:
1. Please create new PhpStorm project using 'magento2ce' directory on your host
(this directory should already contain Magento repository cloned earlier)
2. Use instructions provided here https://github.com/paliarush/vagrant-magento/blob/2.0/docs/phpstorm-configuration-windows-hosts.md
to set up synchronization in PhpStorm (or using rsync) with ${MAGENTO_ROOT} directory"
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。