Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Commit 3b4e5bb

Browse files
authored
Merge pull request #115 from paliarush/Magento-Upgrade
Add Magento Upgrade Support
2 parents 1691fab + 9b1a9b4 commit 3b4e5bb

21 files changed

+239
-76
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.vagrant
22
/.idea
3-
/log/debug.log
3+
/log/*.log
44
/scripts/.current_nesting_level
5-
.DS_Store
5+
/scripts/.current_log_path
6+
.DS_Store

CHANGELOG.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
2525

2626
### Added
2727

28+
- Added ability to configure number of CPUs for virtual machine via [etc/config.yaml](etc/config.yaml.dist)
29+
- Added generation of basic sample data for testing purposes
30+
- Ability to upgrade Magento using `m-switch-to-ce` and `m-switch-to-ee` (when `-u` flag is specified)
2831
- Redis support for Magento caching
29-
- Access to Magento developer mode and storefront/admin UI debugging features via [etc/config.yaml.dist](etc/config.yaml.dist)
32+
- Access to Magento developer mode and storefront/admin UI debugging features via [etc/config.yaml](etc/config.yaml.dist)
3033
- Composer-based installation support
31-
- Magento cache warming up after re-install and clearing cache
34+
- Magento cache warming up after re-install and clearing cache (when `-w` flag is specified)
3235
- Tests configuration files are generated during project initialization
3336
- Sample data support
3437
- ElasticSearch support
@@ -40,7 +43,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4043
- Removed requirement for public github token due to Composer limitations (issue is fixed on Composer side)
4144
- Changed requirement for minimum box version from 1.0 to 1.1
4245
- Upgraded PHP 5.5.9 to PHP 5.6
43-
- When [init_project.sh](init_project.sh) is executed, EE will be installed by default, if EE repository is specified in [etc/config.yaml.dist](etc/config.yaml.dist). Not supported on Windows hosts
46+
- When [init_project.sh](init_project.sh) is executed, EE will be installed by default, if EE repository is specified in [etc/config.yaml](etc/config.yaml.dist). Not supported on Windows hosts
4447

4548
### Fixed
4649

@@ -65,7 +68,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
6568

6669
- Moved provisioning scripts
6770
- Magento project directory moved to vagrant project root. Current structure is as follows: `vagrant-magento/magento2ce/magento2ee`
68-
- PHP 7.0 is installed by default instead of PHP 5.5.9 (can be configured in [etc/config.yaml.dist](etc/config.yaml.dist))
71+
- PHP 7.0 is installed by default instead of PHP 5.5.9 (can be configured in [etc/config.yaml](etc/config.yaml.dist))
6972
- Renamed configuration folder from `local.config` to `etc`
7073
- Set minimum Vagrant version as 1.8
7174
- Improved deployment speed in case of disabled NFS for folders sync
@@ -78,7 +81,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
7881
- Added [project initialization script](init_project.sh) and host scripts for routine flows (compatible with OSX, *nix and Windows)
7982
- Implemented static value of forwarded SSH port to prevent necessity to reconfigure software accessing guest via SSH
8083
- Implemented collision prevention for IP address and host name (in case when several machines are created at once)
81-
- Configuration file [etc/config.yaml.dist](etc/config.yaml.dist)
84+
- Configuration file [etc/config.yaml](etc/config.yaml.dist)
8285
- PHP 7.0 support
8386
- PHP Storm configuration during project initialization (particularly automatic deployment settings)
8487
- Automatic vagrant plugins installation

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* [Connecting to MySQL DB](#connecting-to-mysql-db)
2222
* [View emails sent by Magento](#view-emails-sent-by-magento)
2323
* [Accessing PHP and other config files](#accessing-php-and-other-config-files)
24+
* [Upgrading Magento](#upgrading-magento)
2425
* [Multiple Magento instances](#multiple-magento-instances)
2526
* [Update Composer dependencies](#update-composer-dependencies)
2627
* [Environment configuration](#environment-configuration)
@@ -139,18 +140,20 @@ Note, that semantic versioning is only used for `x.0` branches (not for `develop
139140
## Day-to-day development scenarios
140141

141142
### Reinstall Magento
142-
To save some time and get clear Magento installation, you can skip installation of software like web server or php.
143-
The following command will clear Magento DB, Magento caches and reinstall Magento instance.
144143

145-
Go to 'vagrant-magento' created earlier and run in command line:
144+
Use commands described in [Switch between CE and EE](#switch-between-ce-and-ee) section with `-f` flag. Before doing actual re-installation, these commands update linking of EE codebase, clear cache, update composer dependencies.
145+
146+
If no composer update and relinking of EE codebase is necessary, use the following command. It will clear Magento DB, Magento caches and reinstall Magento instance.
147+
148+
Go to the root of vagrant project in command line and execute:
146149

147150
```
148151
bash m-reinstall
149152
```
150153

151154
### Clear Magento cache
152155

153-
Go to 'vagrant-magento' created earlier and run in command line:
156+
Go to the root of vagrant project in command line and execute:
154157

155158
```
156159
bash m-clear-cache
@@ -170,6 +173,8 @@ bash m-switch-to-ee
170173

171174
Force switch can be done using `-f` flag even if already switched to the target edition. May be helpful to relink EE modules after switching between branches.
172175

176+
Upgrade can be performed instead of re-installation using `-u` flag.
177+
173178
:information_source: On Windows hosts (or when NFS mode is disabled in [config.yaml](etc/config.yaml.dist) explicitly) you will be asked to wait until code is uploaded to guest machine by PhpStorm (PhpStorm must be launched). To continue the process press any key.
174179

175180
### Sample data installation
@@ -226,6 +231,13 @@ Do not edit any symlinks using PhpStorm because it may break your installation.
226231

227232
After editing configs in IDE it is still required to restart related services manually.
228233

234+
### Upgrading Magento
235+
236+
Sometimes it is necessary to test upgrade flow. This can be easily done as follows (assuming that you have installed instance):
237+
238+
- For git-based installation - check out codebase corresponding to the target Magento version. Or modify your `composer.json` in case of composer-based installation
239+
- Use commands described in [Switch between CE and EE](#switch-between-ce-and-ee) section with `-u` flag
240+
229241
### Multiple Magento instances
230242

231243
To install several Magento instances based on different code bases, just follow [Installation steps](#installation-steps) to initialize project in another directory on the host.

Vagrantfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module Config
2020

2121
config_data_dist = YAML.load_file(config_dist_file)
2222
config_data = File.exists?(config_file) ? YAML.load_file(config_file) : {}
23-
return config_data_dist.merge!(config_data)
23+
return config_data_dist.deep_merge!(config_data)
2424
end
2525
end
2626

@@ -30,6 +30,7 @@ magento_host_name = config_data['magento']['host_name']
3030
magento_ip_address = config_data['guest']['ip_address']
3131
forwarded_ssh_port = config_data['guest']['forwarded_ssh_port']
3232
guest_memory = config_data['guest']['memory']
33+
guest_cpus = config_data['guest']['cpus']
3334

3435
# NFS will be used for *nix and OSX hosts, if not disabled explicitly in config
3536
use_nfs_for_synced_folders = !OS.is_windows && (config_data['guest']['use_nfs'] == 1)
@@ -44,6 +45,7 @@ Vagrant.configure(VAGRANT_API_VERSION) do |config|
4445

4546
config.vm.provider "virtualbox" do |vb|
4647
vb.memory = guest_memory
48+
vb.cpus = guest_cpus
4749
# Uncomment option below to avoid issues with VirtualBox on Windows 10
4850
# vb.gui=true
4951
end

etc/config.yaml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ guest:
2727
use_nfs: 1
2828
# [To apply changes: vagrant reload] Default is 2Gb, around 3Gb is necessary to run functional tests.
2929
memory: 2048
30+
# Recommended number of CPUs is 2
31+
cpus: 1
3032
ip_address: "192.168.10.2"
3133
forwarded_ssh_port: 3000
3234

init_project.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ vagrant_dir=$PWD
66

77
source "${vagrant_dir}/scripts/output_functions.sh"
88
resetNestingLevel
9+
current_script_name=`basename "$0"`
10+
initLogFile ${current_script_name}
911

1012
debug_vagrant_project="$(bash "${vagrant_dir}/scripts/get_config_value.sh" "debug_vagrant_project")"
1113
if [[ ${debug_vagrant_project} -eq 1 ]]; then
@@ -240,4 +242,4 @@ if [[ ${host_os} == "Windows" ]] || [[ ${use_nfs} == 0 ]]; then
240242
If not using PhpStorm, you can set up synchronization using rsync"
241243
fi
242244

243-
info "See detailed log in '${vagrant_dir}/log/debug.log'. For even more details you can set debug:vagrant_project to 1 in config.yaml"
245+
info "See detailed log in '${vagrant_dir}/log/${current_script_name}.log'. For even more details you can set debug:vagrant_project to 1 in config.yaml"

m-bin-magento

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ cd "$(dirname "${BASH_SOURCE[0]}")" && vagrant_dir=$PWD
66

77
source "${vagrant_dir}/scripts/output_functions.sh"
88
resetNestingLevel
9+
current_script_name=`basename "$0"`
10+
initLogFile ${current_script_name}
911

1012
debug_vagrant_project="$(bash "${vagrant_dir}/scripts/get_config_value.sh" "debug_vagrant_project")"
1113
if [[ ${debug_vagrant_project} -eq 1 ]]; then
@@ -18,4 +20,4 @@ vagrant ssh -c "\$MAGENTO_ROOT/bin/magento $arguments" 2> >(logError)
1820
# To debug, comment out line above and uncomment line below
1921
# vagrant ssh -c "php -d xdebug.remote_autostart=1 \$MAGENTO_ROOT/bin/magento $arguments" 2> >(logError)
2022

21-
info "See detailed log in '${vagrant_dir}/log/debug.log'. For even more details you can set 'debug:vagrant_project' to 1 in etc/config.yaml"
23+
info "See detailed log in '${vagrant_dir}/log/${current_script_name}.log'. For even more details you can set 'debug:vagrant_project' to 1 in etc/config.yaml"

m-clear-cache

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ cd "$(dirname "${BASH_SOURCE[0]}")" && vagrant_dir=$PWD
66

77
source "${vagrant_dir}/scripts/output_functions.sh"
88
resetNestingLevel
9+
current_script_name=`basename "$0"`
10+
initLogFile ${current_script_name}
11+
12+
warm_up_cache=0
13+
while getopts 'w' flag; do
14+
case "${flag}" in
15+
w) warm_up_cache=1 ;;
16+
*) error "Unexpected option" && exit 1;;
17+
esac
18+
done
919

1020
debug_vagrant_project="$(bash "${vagrant_dir}/scripts/get_config_value.sh" "debug_vagrant_project")"
1121
if [[ ${debug_vagrant_project} -eq 1 ]]; then
@@ -14,10 +24,12 @@ fi
1424

1525
bash "${vagrant_dir}/scripts/host/m_clear_cache.sh" "$@" 2> >(logError)
1626

17-
incrementNestingLevel
18-
19-
bash "${vagrant_dir}/scripts/host/warm_up_cache.sh" 2> >(logError)
20-
21-
decrementNestingLevel
27+
if [[ ${warm_up_cache} -eq 1 ]]; then
28+
incrementNestingLevel
29+
bash "${vagrant_dir}/scripts/host/warm_up_cache.sh" 2> >(logError)
30+
decrementNestingLevel
31+
else
32+
info "Use 'bash ./m-clear-cache -w' to get automatic cache warm up"
33+
fi
2234

23-
info "See detailed log in '${vagrant_dir}/log/debug.log'. For even more details you can set 'debug:vagrant_project' to 1 in etc/config.yaml"
35+
info "See detailed log in '${vagrant_dir}/log/${current_script_name}.log'. For even more details you can set 'debug:vagrant_project' to 1 in etc/config.yaml"

m-composer

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ cd "$(dirname "${BASH_SOURCE[0]}")" && vagrant_dir=$PWD
66

77
source "${vagrant_dir}/scripts/output_functions.sh"
88
resetNestingLevel
9+
current_script_name=`basename "$0"`
10+
initLogFile ${current_script_name}
911

1012
debug_vagrant_project="$(bash "${vagrant_dir}/scripts/get_config_value.sh" "debug_vagrant_project")"
1113
if [[ ${debug_vagrant_project} -eq 1 ]]; then
@@ -14,4 +16,4 @@ fi
1416

1517
bash "${vagrant_dir}/scripts/host/m_composer.sh" "$@" 2> >(logError)
1618

17-
info "See detailed log in '${vagrant_dir}/log/debug.log'. For even more details you can set 'debug:vagrant_project' to 1 in etc/config.yaml"
19+
info "See detailed log in '${vagrant_dir}/log/${current_script_name}.log'. For even more details you can set 'debug:vagrant_project' to 1 in etc/config.yaml"

m-reinstall

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ cd "$(dirname "${BASH_SOURCE[0]}")" && vagrant_dir=$PWD
66

77
source "${vagrant_dir}/scripts/output_functions.sh"
88
resetNestingLevel
9+
current_script_name=`basename "$0"`
10+
initLogFile ${current_script_name}
911

1012
debug_vagrant_project="$(bash "${vagrant_dir}/scripts/get_config_value.sh" "debug_vagrant_project")"
1113
if [[ ${debug_vagrant_project} -eq 1 ]]; then
@@ -14,4 +16,4 @@ fi
1416

1517
bash "${vagrant_dir}/scripts/host/m_reinstall.sh" "$@" 2> >(logError)
1618

17-
info "See detailed log in '${vagrant_dir}/log/debug.log'. For even more details you can set 'debug:vagrant_project' to 1 in etc/config.yaml"
19+
info "See detailed log in '${vagrant_dir}/log/${current_script_name}.log'. For even more details you can set 'debug:vagrant_project' to 1 in etc/config.yaml"

0 commit comments

Comments
 (0)