Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 9fda7b7

Browse files
committed
Merge branch 'release/1.2.0'
2 parents 0121465 + c54a6b9 commit 9fda7b7

File tree

6 files changed

+56
-42
lines changed

6 files changed

+56
-42
lines changed

Vagrantfile

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
1-
%w(vagrant-hostmanager vagrant-auto_network vagrant-nfs_guest).each do |plugin|
1+
%w(vagrant-hostmanager vagrant-auto_network).each do |plugin|
22
unless Vagrant.has_plugin?(plugin)
33
raise 'In order to use this box, you must install plugin: ' + plugin
44
end
55
end
66

7+
mount_plugin=nil
8+
9+
%w(vagrant-unison2 vagrant-nfs_guest).each do |plugin|
10+
if Vagrant.has_plugin?(plugin)
11+
mount_plugin=plugin
12+
break
13+
end
14+
end
15+
16+
if mount_plugin.nil?
17+
raise 'No efficient shared mount plugins found, please install vagrant-unison2 or vagrant-nfs_guest'
18+
end
19+
720
require_relative 'vagrant/inline/config'
8-
require_relative 'vagrant/inline/nfs-plugin'
921

1022
# Define Vagrantfile configuration options
1123
VagrantApp::Config.option(:varnish, false) # If varnish needs to be enabled
@@ -24,7 +36,11 @@ VagrantApp::Config.option(:varnish, false) # If varnish needs to be enabled
2436
.option(:group, 'app') # Group name for share
2537
.option(:uid, Process.euid) # User ID for mapping
2638
.option(:gid, Process.egid) # Group ID for mapping
27-
.option(:directory, 'server') # Directory to be used as mount on host machine
39+
.option(:directory, 'server') # Directory to be used as mount on host machine for NFS guest plugin
40+
.option(:unison_host, 'project') # Directory for project code
41+
.option(:unison_guest, 'project') # Directory for project code
42+
.option(:unison_ignore, 'Name {.DS_Store,.git}') # Unison ignore pattern
43+
.option(:unison_manage_permissions, false) # Unison manage permissions
2844
.option(:network, '33.33.33.0/24') # Directory to be used as mount on host machine
2945

3046
Vagrant.configure("2") do |config|
@@ -78,12 +94,11 @@ Vagrant.configure("2") do |config|
7894
# Disable default /vagrant mount as we use custom user for box
7995
config.vm.synced_folder '.', '/vagrant/', disabled: true
8096

81-
config.vm.synced_folder box_config.get(:directory), '/data/web', type: 'nfs_guest', create: true,
82-
linux__nfs_options: %w(rw no_subtree_check all_squash insecure async),
83-
map_uid: box_config.get(:uid).to_s,
84-
map_gid: box_config.get(:gid).to_s,
85-
owner: box_config.get(:user),
86-
group: box_config.get(:group)
97+
if mount_plugin == 'vagrant_nfs-guest'
98+
project_dir = 'magento2'
99+
else
100+
project_dir = box_config.get(:unison_guest)
101+
end
87102

88103
box_config.shell_list.each do |file|
89104
config.vm.provision 'shell', path: 'vagrant/provisioning/' + file, env: {
@@ -94,7 +109,8 @@ Vagrant.configure("2") do |config|
94109
VAGRANT_HOSTNAME: box_config.get(:hostname),
95110
VAGRANT_FPM_SERVICE: box_config.flag?(:php7) ? 'php7.0-fpm' : 'php5-fpm',
96111
VAGRNAT_PHP_ETC_DIR: box_config.flag?(:php7) ? '/etc/php/7.0/' : '/etc/php5/',
97-
VAGRNAT_PHP_PACKAGE_PREFIX: box_config.flag?(:php7) ? 'php7.0' : 'php5'
112+
VAGRNAT_PHP_PACKAGE_PREFIX: box_config.flag?(:php7) ? 'php7.0' : 'php5',
113+
VAGRANT_PROJECT_DIR: box_config.get(:unison_guest)
98114
}
99115
end
100116

@@ -107,6 +123,24 @@ Vagrant.configure("2") do |config|
107123
node.vm.hostname = box_config.get(:hostname)
108124
node.vm.network :private_network, auto_network: true
109125
node.hostmanager.aliases = box_config.get(:domains)
126+
127+
128+
if mount_plugin == 'vagrant_nfs-guest'
129+
node.vm.synced_folder box_config.get(:directory), '/data/web', type: 'nfs_guest', create: true,
130+
linux__nfs_options: %w(rw no_subtree_check all_squash insecure async),
131+
map_uid: box_config.get(:uid).to_s,
132+
map_gid: box_config.get(:gid).to_s,
133+
owner: box_config.get(:user),
134+
group: box_config.get(:group)
135+
else
136+
config.unison.host_folder = box_config.get(:unison_host)
137+
config.unison.guest_folder = box_config.get(:unison_guest)
138+
config.unison.ignore = box_config.get(:unison_ignore)
139+
config.unison.perm = box_config.flag?(:unison_manage_permissions) ? 1 : 0
140+
config.unison.ssh_host = box_config.get(:hostname)
141+
config.unison.ssh_user = 'app'
142+
config.unison.ssh_port = 22
143+
end
110144
end
111145

112146
end

vagrant/inline/nfs-plugin.rb

Lines changed: 0 additions & 22 deletions
This file was deleted.

vagrant/provisioning/hypernode.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ fi
3333

3434
usermod -a -G admin app
3535

36-
# Remove mysql user from cgroup limitation, as hardcoded ones during deployment of hypernode box swap all stuff out
37-
tee /etc/cgrules.conf <<"CONFIG"
38-
solr memory limited
39-
CONFIG
36+
# delete cgroups for memory
37+
truncate -s 0 /etc/cgrules.conf
38+
cgdelete -r limited || true

vagrant/provisioning/magento2-developer.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ set -e
44
AS_USER="sudo -u ${VAGRANT_USER}"
55
CUR_DIR=$(pwd)
66
HOME_DIR=$(getent passwd ${VAGRANT_USER} | cut -d ':' -f6)
7+
MAGENTO_DIR=${VAGRANT_PROJECT_DIR:-magento2}
78

8-
cd $HOME_DIR/magento2
9+
cd $HOME_DIR/${MAGENTO_DIR}
910

1011
$AS_USER bin/magento cache:disable full_page
1112
$AS_USER bin/magento cache:disable full_page

vagrant/provisioning/magento2-install.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,22 @@ set -e
44

55
AS_USER="sudo -u ${VAGRANT_USER}"
66
HOME_DIR=$(getent passwd ${VAGRANT_USER} | cut -d ':' -f6)
7+
MAGENTO_DIR=${VAGRANT_PROJECT_DIR:-magento2}
78

8-
cd ${HOME_DIR}/magento2
9+
cd ${HOME_DIR}/${MAGENTO_DIR}
910

1011
MYSQLPASSWORD=$(awk -F "=" '/password/ {print $2}' ${HOME_DIR}/.my.cnf | sed -e 's/^[ \t]*//')
1112
mysql -u app -p${MYSQLPASSWORD} -e "create database magento2"
1213

1314
echo "Downloading Magento 2..."
1415

15-
[ -d ${HOME_DIR}/magento2/bin ] || $AS_USER wget -qO- https://magento.mirror.hypernode.com/releases/magento2-latest.tar.gz | $AS_USER tar xfz -
16+
[ -d ${HOME_DIR}/${MAGENTO_DIR}/bin ] || $AS_USER wget -qO- https://magento.mirror.hypernode.com/releases/magento2-latest.tar.gz | $AS_USER tar xfz -
1617
$AS_USER chmod 755 bin/magento
1718

1819
echo "Installing ..."
1920

20-
[ -f ${HOME_DIR}/magento2/app/etc/env.php ] || $AS_USER bin/magento setup:install --db-host=localhost --db-name=magento2 --db-user=app --db-password=${MYSQLPASSWORD} --admin-firstname=Admin --admin-lastname=user --admin-user=admin --admin-password=Password123 [email protected] --base-url=http://${VAGRANT_HOSTNAME}/ --language=en_US --timezone=Europe/Amsterdam --currency=EUR --use-rewrites=1
21-
$AS_USER ln -fs ../magento2/pub/* ../public
21+
[ -f ${HOME_DIR}/${MAGENTO_DIR}/app/etc/env.php ] || $AS_USER bin/magento setup:install --db-host=localhost --db-name=magento2 --db-user=app --db-password=${MYSQLPASSWORD} --admin-firstname=Admin --admin-lastname=user --admin-user=admin --admin-password=Password123 [email protected] --base-url=http://${VAGRANT_HOSTNAME}/ --language=en_US --timezone=Europe/Amsterdam --currency=EUR --use-rewrites=1
22+
$AS_USER ln -fs ../${MAGENTO_DIR}/pub/* ../public
2223
$AS_USER bin/magento setup:static-content:deploy
2324

2425
echo "Static content deployed ..."

vagrant/provisioning/magento2.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ set -e
44

55
AS_USER="sudo -u ${VAGRANT_USER}"
66
HOME_DIR=$(getent passwd ${VAGRANT_USER} | cut -d ':' -f6)
7+
MAGENTO_DIR=${VAGRANT_PROJECT_DIR:-magento2}
78

89
$AS_USER touch ${HOME_DIR}/nginx/magento2.flag
910

10-
[ -d ${HOME_DIR}/magento2 ] || $AS_USER mkdir ${HOME_DIR}/magento2
11+
[ -d ${HOME_DIR}/${MAGENTO_DIR} ] || $AS_USER mkdir ${HOME_DIR}/${MAGENTO_DIR}
1112
[ -d ${HOME_DIR}/public ] || $AS_USER mkdir ${HOME_DIR}/public

0 commit comments

Comments
 (0)