@@ -20,99 +20,74 @@ if [ -z ${HOST} ]; then
20
20
set -x
21
21
fi
22
22
23
- # Install Magento code base
24
- # Create Magento root dir
25
- magento_dir=" /var/www/magento2"
23
+ magento_dir=" /var/www/magento2ce"
24
+ cd ${magento_dir}
25
+
26
+ # Clear cache
27
+ mv var/.htaccess .var_htaccess.back && rm -rf var/* && mv .var_htaccess.back var/.htaccess
28
+ mv pub/static/.htaccess pub/static_htaccess.back && rm -rf pub/static/* && mv pub/static_htaccess.back pub/static/.htaccess
29
+ cd " ${magento_dir} /dev/tests/integration" && mv tmp/.gitignore tmp_gitignore.back && rm -rf tmp/* && mv tmp_gitignore.back tmp/.gitignore
30
+ cd " ${magento_dir} /dev/tests/unit" && rm -rf tmp/*
31
+
32
+ # Remove configuration files
33
+ rm -f " ${magento_dir} /app/etc/config.php"
34
+ rm -f " ${magento_dir} /app/etc/env.php"
26
35
27
36
# Create DB
28
37
db_name=" magento"
38
+ mysql -u root -ppassword -e " drop database if exists ${db_name} ; create database ${db_name} ;"
39
+ mysql -u root -ppassword -e " GRANT ALL ON ${db_name} .* TO magento@localhost IDENTIFIED BY 'magento';"
29
40
30
- # Install Magento code base
31
- # Create Magento root dir
32
- magento_dir=" /var/www/magento2"
33
- if [ ! -d " ${magento_dir} /app/code/Magento" ]; then
34
- if [ ! -d ${magento_dir} ]; then
35
- mkdir ${magento_dir}
36
- fi
37
- chown -R www-data:www-data ${magento_dir}
38
- chmod -R 775 ${magento_dir}
39
- usermod -a -G www-data vagrant # required to allow files modification via SSH
40
- echo "
41
- 1. To finish Magento installation, please create new PHPStorm project using 'magento2ce' directory on your host
42
- (this directory should already contain Magento repository cloned earlier)
41
+ # Install Magento application
42
+ cd ${magento_dir}
43
+ github_token=" /vagrant/local.config/github.oauth.token"
44
+ if [ -f ${github_token} ]; then
45
+ set +x
46
+ echo " Installing GitHub OAuth token from ${github_token} ..."
47
+ composer config -g github-oauth.github.com ` cat ${github_token} `
48
+ set -x
49
+ composer install
50
+ else
51
+ composer install --prefer-source
52
+ fi
43
53
44
- 2. Use instructions provided here https://github.com/paliarush/vagrant-magento/blob/master/docs/phpstorm-configuration.md
45
- to set up synchronization in PHPStorm (or using rsync) with ${magento_dir} directory and upload your project
54
+ admin_frontame=" admin"
55
+ install_cmd=" ./bin/magento setup:install \
56
+ --db-host=localhost \
57
+ --db-name=magento \
58
+ --db-user=magento \
59
+ --db-password=magento \
60
+ --backend-frontname=${admin_frontame} \
61
+ --base-url=http://${HOST} / \
62
+ --language=en_US \
63
+ --timezone=America/Chicago \
64
+ --currency=USD \
65
+ --admin-lastname=Admin \
66
+ --admin-firstname=Admin \
67
+ --admin-email=admin@example.com \
68
+ --admin-user=admin \
69
+ --admin-password=123123q \
70
+ --cleanup-database \
71
+ --use-rewrites=1"
72
+ chmod +x bin/magento
73
+ php ${install_cmd}
74
+
75
+ chown -R vagrant:vagrant ${magento_dir}
76
+
77
+ # Enable Magento cron jobs
78
+ echo " */1 * * * * php ${magento_dir} /bin/magento cron:run &" | crontab -u vagrant -
46
79
47
- 3. Then go to 'vagrant-magento' directory on the host (created earlier)
48
- and run 'vagrant provision --provision-with install_magento' in command line"
49
- else
50
- # Clear cache
51
- cd ${magento_dir}
52
- # Clear var
53
- mv var/.htaccess .var_htaccess.back && rm -rf var/* && mv .var_htaccess.back var/.htaccess
54
- # Clear pub/statics
55
- mv pub/static/.htaccess pub/static_htaccess.back && rm -rf pub/static/* && mv pub/static_htaccess.back pub/static/.htaccess
56
- # Clear integration tests tmp
57
- cd " ${magento_dir} /dev/tests/integration" && mv tmp/.gitignore tmp_gitignore.back && rm -rf tmp/* && mv tmp_gitignore.back tmp/.gitignore
58
- # Clear unit tests tmp
59
- cd " ${magento_dir} /dev/tests/unit" && rm -rf tmp/*
60
-
61
- # Remove configuration files
62
- rm -f " ${magento_dir} /app/etc/config.php"
63
- rm -f " ${magento_dir} /app/etc/env.php"
64
-
65
-
66
- mysql -u root -ppassword -e " drop database if exists ${db_name} ; create database ${db_name} ;"
67
- mysql -u root -ppassword -e " GRANT ALL ON ${db_name} .* TO magento@localhost IDENTIFIED BY 'magento';"
68
-
69
- cd ${magento_dir}
70
- usermod -a -G vagrant www-data # required to allow files modification by Apache, if they were uploaded from the host
71
-
72
- # Install Magento application
73
- github_token=" /vagrant/local.config/github.oauth.token"
74
- if [ -f ${github_token} ]; then
75
- set +x
76
- echo " Installing GitHub OAuth token from ${github_token} ..."
77
- composer config -g github-oauth.github.com ` cat ${github_token} `
78
- set -x
79
- composer install
80
- else
81
- composer install --prefer-source
82
- fi
83
-
84
- admin_frontame=" admin"
85
- install_cmd=" ./bin/magento setup:install \
86
- --db-host=localhost \
87
- --db-name=magento \
88
- --db-user=magento \
89
- --db-password=magento \
90
- --backend-frontname=${admin_frontame} \
91
- --base-url=http://${HOST} / \
92
- --language=en_US \
93
- --timezone=America/Chicago \
94
- --currency=USD \
95
- --admin-lastname=Admin \
96
- --admin-firstname=Admin \
97
- --admin-email=admin@example.com \
98
- --admin-user=admin \
99
- --admin-password=123123q \
100
- --cleanup-database \
101
- --use-rewrites=1"
102
- chmod +x bin/magento
103
- php ${install_cmd}
104
-
105
- chown -R www-data:www-data .
106
- usermod -a -G www-data vagrant # required to allow files modification via SSH
107
-
108
- # Enable Magento cron jobs
109
- echo " */1 * * * * php ${magento_dir} /bin/magento cron:run &" | crontab -u www-data -
80
+ set +x
81
+ echo "
82
+ Magento application was deployed in ${magento_dir} and installed successfully
83
+ Access storefront at http://${HOST} /
84
+ Access admin panel at http://${HOST} /${admin_frontame} /
110
85
111
- set +x
112
- echo " Magento application was deployed in ${magento_dir} and installed "
113
- echo " Access front store at http:// ${HOST} / "
114
- echo " Access admin panel at http:// ${HOST} / ${admin_frontame} / "
115
- if [ ${HOST} != ${IP} ] ; then
116
- echo " Don't forget to update your 'hosts' file with ' ${IP} ${HOST} ' "
117
- fi
118
- fi
86
+ Don't forget to update your 'hosts' file with ' ${IP} ${HOST} '
87
+
88
+ [Optional] To finish developer environment set up:
89
+ 1. Please create new PHPStorm project using 'magento2ce' directory on your host
90
+ (this directory should already contain Magento repository cloned earlier)
91
+
92
+ 2. Use instructions provided here https://github.com/paliarush/vagrant-magento/blob/master/docs/phpstorm-configuration.md
93
+ to set up synchronization in PHPStorm (or using rsync) with ${magento_dir} directory "
0 commit comments