This repository was archived by the owner on Oct 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinstall_magento.sh
executable file
·98 lines (79 loc) · 2.65 KB
/
install_magento.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env bash
# vagrant provision --provision-with install_magento
# Enable trace printing and exit on the first error
set -ex
is_windows_host=$1
guest_magento_dir=$2
# Determine external IP address
set +x
ip=`ifconfig eth1 | grep inet | awk '{print $2}' | sed 's/addr://'`
echo "IP address is '${ip}'"
set -x
# Determine hostname for Magento web-site
host=`hostname -f`
if [ -z ${host} ]; then
# Use external IP address as hostname
set +x
host=${ip}
echo "Use IP address '${host}' as hostname"
set -x
fi
cd ${guest_magento_dir}
# Clear cache
magento_clear_cache
# Remove configuration files
rm -f "${guest_magento_dir}/app/etc/config.php"
rm -f "${guest_magento_dir}/app/etc/env.php"
# Create DB
db_names=("magento" "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 ${guest_magento_dir}
admin_frontame="admin"
install_cmd="./bin/magento setup:install \
--db-host=localhost \
--db-name=magento \
--db-user=root \
--backend-frontname=${admin_frontame} \
--base-url=http://${host}/ \
--language=en_US \
--timezone=America/Chicago \
--currency=USD \
--admin-lastname=Admin \
--admin-firstname=Admin \
--admin-email=admin@example.com \
--admin-user=admin \
--admin-password=123123q \
--cleanup-database \
--use-rewrites=1"
# Configure Rabbit MQ
if [ -f "${guest_magento_dir}/app/code/Magento/Amqp/registration.php" ]; then
install_cmd="${install_cmd} \
--amqp-host=localhost \
--amqp-port=5672 \
--amqp-user=guest \
--amqp-password=guest"
fi
chmod +x bin/magento
php ${install_cmd}
# Enable Magento cron jobs
echo "* * * * * php ${guest_magento_dir}/bin/magento cron:run &" | crontab -u vagrant -
if [ ${is_windows_host} -eq 1 ]; then
chown -R vagrant:vagrant ${guest_magento_dir}
fi
set +x
echo "
Magento application was deployed to ${guest_magento_dir} and installed successfully
Access storefront at http://${host}/
Access admin panel at http://${host}/${admin_frontame}/
Don't forget to update your 'hosts' file with '${ip} ${host}'"
if [ ${is_windows_host} -eq 1 ]; 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/master/docs/phpstorm-configuration-windows-hosts.md
to set up synchronization in PhpStorm (or using rsync) with ${guest_magento_dir} directory"
fi