├── config.rb.dst ├── .gitignore ├── vagrant ├── provisioning │ ├── composer.sh │ ├── developer.sh │ ├── blackfire.sh │ ├── shell.sh │ ├── disable-varnish.sh │ ├── magento2.sh │ ├── nfs.sh │ ├── hello.sh │ ├── unison.sh │ ├── magento2-developer.sh │ ├── magento2-install.sh │ └── hypernode.sh └── inline │ └── config.rb ├── composer.json ├── LICENSE ├── README.md └── Vagrantfile /config.rb.dst: -------------------------------------------------------------------------------- 1 | name 'magento-hypernode' 2 | hostname name + '.box' 3 | domains %w(www.magento-hypernode.box) 4 | profiler true 5 | developer true 6 | directory 'server' -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.* 2 | /* 3 | !/config.rb.dst 4 | !/vagrant/ 5 | !/.gitignore 6 | !/Vagrantfile 7 | !/README.md 8 | !/LICENSE 9 | !/composer.json 10 | 11 | /vendor/ 12 | -------------------------------------------------------------------------------- /vagrant/provisioning/composer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | [ -f "/usr/local/bin/composer" ] || php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/local/bin --filename=composer 5 | -------------------------------------------------------------------------------- /vagrant/provisioning/developer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | AS_USER="sudo -u ${VAGRANT_USER}" 5 | HOME_DIR=$(getent passwd ${VAGRANT_USER} | cut -d ':' -f6) 6 | 7 | $AS_USER tee ${HOME_DIR}/nginx/server.devmode <<"CONFIG" 8 | set $developermode "1"; 9 | CONFIG 10 | -------------------------------------------------------------------------------- /vagrant/provisioning/blackfire.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | wget -O - https://packagecloud.io/gpg.key | sudo apt-key add - 4 | echo "deb http://packages.blackfire.io/debian any main" | sudo tee /etc/apt/sources.list.d/blackfire.list 5 | 6 | sudo apt-get update 7 | sudo apt-get install blackfire-agent blackfire-php -y -f 8 | -------------------------------------------------------------------------------- /vagrant/provisioning/shell.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ! -f /usr/bin/fish ] 4 | then 5 | sudo apt-get install -y python-software-properties 6 | sudo apt-add-repository ppa:fish-shell/release-2 7 | sudo apt-get update 8 | sudo apt-get install -y fish 9 | sudo sh -c 'echo /usr/bin/fish >>/etc/shells' 10 | sudo chsh -s /usr/bin/fish app 11 | fi 12 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ecomdev/fast-hypernode", 3 | "description": "Fast Hypernode Project Setup", 4 | "type": "project", 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Ivan Chepurnyi", 9 | "email": "ivan.chepurnyi@ecomdev.org" 10 | } 11 | ], 12 | "minimum-stability": "stable", 13 | "require": {} 14 | } 15 | -------------------------------------------------------------------------------- /vagrant/provisioning/disable-varnish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | echo "Disabling Varnish caching..." 6 | 7 | # Create a vcl that tells Varnish to cache nothing 8 | cat > /etc/varnish/default.vcl <<- EOM 9 | vcl 4.0; 10 | backend default { 11 | .host = "127.0.0.1"; 12 | .port = "8080"; 13 | } 14 | 15 | sub vcl_recv { 16 | return(pass); 17 | } 18 | EOM 19 | 20 | service varnish restart 21 | -------------------------------------------------------------------------------- /vagrant/provisioning/magento2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | AS_USER="sudo -u ${VAGRANT_USER}" 6 | HOME_DIR=$(getent passwd ${VAGRANT_USER} | cut -d ':' -f6) 7 | MAGENTO_DIR=${VAGRANT_PROJECT_DIR:-magento2} 8 | 9 | $AS_USER touch ${HOME_DIR}/nginx/magento2.flag 10 | 11 | [ -d ${HOME_DIR}/${MAGENTO_DIR} ] || $AS_USER mkdir ${HOME_DIR}/${MAGENTO_DIR} 12 | [ -d ${HOME_DIR}/public ] || $AS_USER mkdir ${HOME_DIR}/public 13 | -------------------------------------------------------------------------------- /vagrant/provisioning/nfs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | echo "Changing user id" 6 | IS_HHVM_RUNNING=$(service hhvm status | grep "stop" > /dev/null && echo "" || echo "1") 7 | service nginx stop 8 | service ${VAGRANT_FPM_SERVICE} stop 9 | [ $IS_HHVM_RUNNING ] && service hhvm stop 10 | usermod -u ${VAGRANT_UID} ${VAGRANT_USER} 11 | service nginx start 12 | service ${VAGRANT_FPM_SERVICE} start 13 | [ $IS_HHVM_RUNNING ] && service hhvm start 14 | true # Return true at the end of the stack 15 | -------------------------------------------------------------------------------- /vagrant/provisioning/hello.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Welcome to Hypernode Vagrant Box!" 4 | echo "You can login now with in order to use your box:" 5 | echo "\$ ssh ${VAGRANT_USER}@${VAGRANT_HOSTNAME} -A" 6 | echo "To access database, you can use the following credentials in your app:" 7 | HOME_DIR=$(getent passwd ${VAGRANT_USER} | cut -d ':' -f6) 8 | MYSQLPASSWORD=$(awk -F "=" '/password/ {print $2}' ${HOME_DIR}/.my.cnf | sed -e 's/^[ \t]*//') 9 | 10 | echo "Username: ${VAGRANT_USER}" 11 | echo "Password: $MYSQLPASSWORD" -------------------------------------------------------------------------------- /vagrant/provisioning/unison.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | apt-get update 4 | apt-get install libdpkg-perl=1.18.4ubuntu1 -y -f --allow-downgrades 5 | apt-get install ocaml ocaml-native-compilers camlp4-extra opam -y -f 6 | 7 | mkdir -p /usr/src/unison/ 8 | cd /usr/src/unison/ 9 | 10 | wget https://www.seas.upenn.edu/~bcpierce/unison/download/releases/unison-2.51.2/unison-2.51.2.tar.gz -O unison.tar.gz 11 | tar xzvf unison.tar.gz --strip-components 1 12 | make UISTYLE=text || true 13 | 14 | chmod +x unison unison-* 15 | rm /usr/bin/unison 16 | rm /usr/bin/unison-* 17 | 18 | ln -s $PWD/unison /usr/bin/ 19 | ln -s $PWD/unison-* /usr/bin/ 20 | 21 | echo "fs.inotify.max_user_watches=262144" > /etc/sysctl.d/90-unison-notify.conf 22 | sysctl -p --system 23 | -------------------------------------------------------------------------------- /vagrant/provisioning/magento2-developer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | AS_USER="sudo -u ${VAGRANT_USER}" 5 | CUR_DIR=$(pwd) 6 | HOME_DIR=$(getent passwd ${VAGRANT_USER} | cut -d ':' -f6) 7 | MAGENTO_DIR=${VAGRANT_PROJECT_DIR:-magento2} 8 | 9 | cd $HOME_DIR/${MAGENTO_DIR} 10 | 11 | $AS_USER bin/magento cache:disable full_page 12 | $AS_USER bin/magento cache:disable full_page 13 | 14 | $AS_USER tee "dev/profiler-trigger.php" <<"PHPFILE1" 15 | ['dev/profiler-trigger.php']]; file_put_contents('composer.json', json_encode(\$composer, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));" 22 | $AS_USER composer dump-autoload 23 | 24 | cd $CUR_DIR 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 EcomDev B.V. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vagrant/provisioning/magento2-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | AS_USER="sudo -u ${VAGRANT_USER}" 6 | HOME_DIR=$(getent passwd ${VAGRANT_USER} | cut -d ':' -f6) 7 | MAGENTO_DIR=${VAGRANT_PROJECT_DIR:-magento2} 8 | 9 | cd ${HOME_DIR}/${MAGENTO_DIR} 10 | 11 | MYSQLPASSWORD=$(awk -F "=" '/password/ {print $2}' ${HOME_DIR}/.my.cnf | sed -e 's/^[ \t]*//') 12 | [ -f ${HOME_DIR}/${MAGENTO_DIR}/app/etc/env.php ] || mysql -u app -p${MYSQLPASSWORD} -e "create database magento2" 13 | 14 | echo "Downloading Magento 2..." 15 | 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 - 17 | $AS_USER chmod 755 bin/magento 18 | 19 | echo "Installing ..." 20 | 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 --admin-email=ivan@ecomdev.org --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 23 | $AS_USER bin/magento setup:static-content:deploy 24 | 25 | echo "Static content deployed ..." 26 | -------------------------------------------------------------------------------- /vagrant/provisioning/hypernode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | truncate -s 0 /var/mail/app 5 | 6 | AS_USER="sudo -u ${VAGRANT_USER}" 7 | HOME_DIR=$(getent passwd ${VAGRANT_USER} | cut -d ':' -f6) 8 | $AS_USER mkdir -p "${HOME_DIR}/.ssh" 9 | $AS_USER touch "${HOME_DIR}/.ssh/authorized_keys" 10 | chmod 700 "${HOME_DIR}/.ssh" 11 | chmod 600 "${HOME_DIR}/.ssh/authorized_keys" 12 | 13 | if ssh-add -L >/dev/null 2>/dev/null; then 14 | ssh-add -L >> ${HOME_DIR}/.ssh/authorized_keys; 15 | fi 16 | 17 | cat << EOF >> ${HOME_DIR}/.ssh/authorized_keys 18 | EOF 19 | 20 | rm -f "/var/lib/varnish/`hostname`" 21 | ln -s /var/lib/varnish/xxxxx-dummytag-vagrant.nodes.hypernode.io/ "/var/lib/varnish/`hostname`" 22 | 23 | rm -rf /etc/cron.d/hypernode-fpm-monitor 24 | 25 | # Copy default nginx configs to synced nginx directory if the files don't exist 26 | if [ -d /etc/hypernode/defaults/nginx/ ]; then 27 | su ${VAGRANT_USER} -c 'find /etc/hypernode/defaults/nginx -type f | xargs -I {} cp -n {} /data/web/nginx/' 28 | fi 29 | 30 | # Update magerun to the latest version 31 | /usr/local/bin/n98-magerun -q self-update || true 32 | /usr/local/bin/n98-magerun2 -q self-update || true 33 | 34 | usermod -a -G sudo app 35 | 36 | # for xenial switch to PHP7.1 37 | command -v hypernode-switch-php >/dev/null 2>&1 && hypernode-switch-php 7.2 2>&1 38 | 39 | 40 | -------------------------------------------------------------------------------- /vagrant/inline/config.rb: -------------------------------------------------------------------------------- 1 | module VagrantApp 2 | class Config < BasicObject 3 | @@options = ::Hash.new 4 | 5 | def self.option(option, default) 6 | @@options[option] = default 7 | class_eval do 8 | define_method option do |value = nil| 9 | access(option, value) 10 | end 11 | end 12 | self 13 | end 14 | 15 | def initialize 16 | @config = ::Hash.new 17 | @shell = [] 18 | end 19 | 20 | def set(key, value) 21 | @config[key] = value 22 | end 23 | 24 | def get(key) 25 | unless @@options.key?(key) 26 | raise 'Undefined configuration option: ' + key 27 | end 28 | 29 | unless @config.key?(key) 30 | return @@options[key] 31 | end 32 | 33 | @config[key] 34 | end 35 | 36 | # Configuration flag check 37 | def flag?(key, inverse = false) 38 | result = true 39 | if key.instance_of?(::Array) 40 | for sub_key in key 41 | result &&= flag?(sub_key, inverse) 42 | end 43 | elsif !key.nil? 44 | result = (get(key) === true) 45 | 46 | if inverse 47 | result = !result 48 | end 49 | end 50 | 51 | result 52 | end 53 | 54 | def access(key, value = nil) 55 | unless value === nil 56 | set(key, value) 57 | end 58 | 59 | get(key) 60 | end 61 | 62 | def self.method_missing(method, value = nil) 63 | access(method, value) 64 | end 65 | 66 | def load(file) 67 | unless ::File::exists?(file) 68 | return false 69 | end 70 | 71 | instance_eval ::File.read(file), file 72 | end 73 | 74 | def shell_add(script, flags = nil, inverse = false) 75 | @shell << {file: script, flags: flags, inverse: inverse} 76 | self 77 | end 78 | 79 | def shell_list 80 | scripts = @shell.select do |info| 81 | flag?(info[:flags], info[:inverse]) 82 | end 83 | scripts.collect do |info| 84 | info[:file] 85 | end 86 | end 87 | end 88 | end 89 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Fast Hypernode Vagrant Box 2 | 3 | **The fastest Magento Vagrant VM** 4 | Fast Byte Hypernode Box (Uses nfs_guest plugin for file shares) 5 | 6 | Based on images from https://github.com/byteinternet/hypernode-vagrant 7 | 8 | # Installation 9 | 10 | Installation is possible via composer: 11 | 12 | ```bash 13 | composer create-project --keep-vcs ecomdev/fast-hypernode 14 | ``` 15 | 16 | 17 | 18 | # Required Vagrant plugins 19 | 20 | * vagrant-hostmanager 21 | * vagrant-auto_network 22 | * vagrant-nfs_guest 23 | 24 | 25 | # Usage 26 | 27 | 1. Copy config.rb.dst to config.rb 28 | 2. Edit it to reflect your project settings 29 | ```ruby 30 | name 'your-project-name' 31 | hostname name + '.box' # will be your main url http://your-project-name.box/ 32 | domains %w(www.your-project-name-additional.box) # additional domain names separated by space 33 | profiler true # Add tideways-profiler ? 34 | developer true # Enable development mode? 35 | directory 'server' # Directory into which NFS share will be mounted on your host 36 | ``` 37 | 38 | # Configuration Options 39 | 40 | * `name` - name of your node 41 | * `hostname` - default project hostname 42 | * `domains` - list of additional domain names for your project 43 | * `varnish` - enable or disable varnish for your project (default: `false`) 44 | * `profiler` - enable or disable tideways-profiler (default: `false`) 45 | * `developer` - enable or disable developer mode in Magento (default: `false`) 46 | * `magento2` - Magento 2.0 installment? (default: `false`) 47 | * `install` - Shall Magento be installed? (default: `false`, only Magento 2.0 installation supported) 48 | * `shell` - Install FishShell? (default: `false`) 49 | * `php7` - PHP7 instead of PHP5? (default: `false`) 50 | * `cpu` - number of CPUs to dedicate to your VM (default: `1`) 51 | * `memory` - memory in MB to dedicate to your VM (default: `1024`) 52 | * `user` - User name for nfs share permissions (default: `app`) 53 | * `group` - Group name for nfs share permissions (default: `app`) 54 | * `uid` - User ID of your host to be mapped to linux VM (default: `Process.euid`) 55 | * `gid` - Group ID of your host to be mapped to linux VM (default: `Process.egid`) 56 | * `directory` - Directory to be used as mount on host machine (default: `server`) 57 | * `network` - Network mast for automatical network assignment to VM (default: `33.33.33.0/24`) 58 | 59 | # Adding custom shell provisioners 60 | 61 | You can easily add more provision shell scripts from configuration file (config.rb): 62 | ```ruby 63 | shell_add 'some-custom-shell-script.sh' 64 | 65 | # Will provision only if PHP7 flag is turned on 66 | shell_add 'some-custom-script-for-php7.sh', :php7 67 | ``` 68 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | %w(vagrant-hostmanager vagrant-auto_network).each do |plugin| 2 | unless Vagrant.has_plugin?(plugin) 3 | raise 'In order to use this box, you must install plugin: ' + plugin 4 | end 5 | end 6 | 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 | 20 | require_relative 'vagrant/inline/config' 21 | 22 | # Define Vagrantfile configuration options 23 | VagrantApp::Config.option(:varnish, false) # If varnish needs to be enabled 24 | .option(:profiler, false) # Is profiler needs to be installed 25 | .option(:developer, false) # Is developer mode should be enabled 26 | .option(:magento2, false) # Is it Magento 2.0 27 | .option(:install, false) # Install Magento? (for now only 2.0) 28 | .option(:shell, false) # Shell script? 29 | .option(:php7, false) # Is it PHP7? 30 | .option(:name, '') # Name 31 | .option(:hostname, '') # Hostname 32 | .option(:domains, []) # Domain list 33 | .option(:cpu, 1) # Number of dedicated CPU 34 | .option(:memory, 1024) # Number of dedicated memory in MB 35 | .option(:user, 'app') # User name for share 36 | .option(:group, 'app') # Group name for share 37 | .option(:uid, Process.euid) # User ID for mapping 38 | .option(:gid, Process.egid) # Group ID for mapping 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 44 | .option(:unison, mount_plugin == 'vagrant-unison2') # Unison plugin installation 45 | .option(:network, '33.33.33.0/24') # Directory to be used as mount on host machine 46 | 47 | Vagrant.configure("2") do |config| 48 | 49 | # Prepare configuration and setup shell scripts for it 50 | current_file = Pathname.new(__FILE__) 51 | box_config = VagrantApp::Config.new 52 | # Base hypernode provisioner 53 | box_config.shell_add('hypernode.sh') 54 | .shell_add('composer.sh') # Composer installer 55 | .shell_add('nfs.sh', :unison, true) # NFS server modifications to have proper permissions 56 | .shell_add('developer.sh', :developer) # Developer mode setting, depends on :developer configuration flag 57 | .shell_add('blackfire.sh', :profiler) # Profiler installer, depends on :profiler configuration flag 58 | .shell_add('disable-varnish.sh', :varnish, true) # Varnish disabler, depends on :varnish inverted flag 59 | .shell_add('magento2.sh', :magento2) # M2 Nginx Config Flag, depends on :magento2 flag 60 | .shell_add('magento2-install.sh', [:magento2, :install]) # M2 Installer, depends on :magento2 and :install 61 | .shell_add('magento2-developer.sh', [:magento2, :install, :developer]) # M2 Developer options, depends on :magento2, :install, :developer 62 | .shell_add('shell.sh', :shell) # Fish shell installer, depends on :shell flag 63 | .shell_add('unison.sh', :unison) 64 | .shell_add('hello.sh') # Final message with connection instructions 65 | 66 | # Loads config.rb from the same directory where Vagrantfile is in 67 | box_config.load(File.join(current_file.dirname, 'config.rb.dst')) 68 | box_config.load(File.join(current_file.dirname, 'config.rb')) 69 | 70 | AutoNetwork.default_pool = box_config.get(:network) 71 | 72 | if box_config.flag?(:php7) 73 | config.vm.box = 'hypernode_xenial' 74 | config.vm.box_url = 'http://vagrant.hypernode.com/customer/xenial/catalog.json' 75 | else 76 | config.vm.box = 'hypernode_php5' 77 | config.vm.box_url = 'http://vagrant.hypernode.com/customer/php5/catalog.json' 78 | end 79 | 80 | config.ssh.forward_agent = true 81 | 82 | config.vm.provider :virtualbox do |v, o| 83 | v.memory = box_config.get(:memory) 84 | v.cpus = box_config.get(:cpu) 85 | v.customize [ 86 | "modifyvm", :id, 87 | "--paravirtprovider", "kvm" # for linux guest 88 | ] 89 | end 90 | 91 | config.vm.provider :lxc do |lxc| 92 | lxc.customize 'cgroup.memory.limit_in_bytes', box_config.get(:memory).to_s + 'M' 93 | end 94 | 95 | # Disable default /vagrant mount as we use custom user for box 96 | config.vm.synced_folder '.', '/vagrant/', disabled: true 97 | 98 | unless box_config.flag?(:unison) 99 | project_dir = 'magento2' 100 | else 101 | project_dir = box_config.get(:unison_guest) 102 | end 103 | 104 | box_config.shell_list.each do |file| 105 | config.vm.provision 'shell', path: 'vagrant/provisioning/' + file, env: { 106 | VAGRANT_UID: box_config.get(:uid).to_s, 107 | VAGRANT_GID: box_config.get(:gid).to_s, 108 | VAGRANT_USER: box_config.get(:user), 109 | VAGRANT_GROUP: box_config.get(:group), 110 | VAGRANT_HOSTNAME: box_config.get(:hostname), 111 | VAGRANT_FPM_SERVICE: box_config.flag?(:php7) ? 'php7.0-fpm' : 'php5-fpm', 112 | VAGRNAT_PHP_ETC_DIR: box_config.flag?(:php7) ? '/etc/php/7.0/' : '/etc/php5/', 113 | VAGRNAT_PHP_PACKAGE_PREFIX: box_config.flag?(:php7) ? 'php7.0' : 'php5', 114 | VAGRANT_PROJECT_DIR: project_dir 115 | } 116 | end 117 | 118 | config.hostmanager.enabled = true 119 | config.hostmanager.manage_host = true 120 | config.hostmanager.ignore_private_ip = false 121 | config.hostmanager.include_offline = true 122 | 123 | config.vm.define 'hypernode' do |node| 124 | node.vm.hostname = box_config.get(:hostname) 125 | node.vm.network :private_network, auto_network: true 126 | node.hostmanager.aliases = box_config.get(:domains) 127 | 128 | 129 | unless box_config.get(:unison) 130 | node.vm.synced_folder box_config.get(:directory), '/data/web', type: 'nfs_guest', create: true, 131 | linux__nfs_options: %w(rw no_subtree_check all_squash insecure async), 132 | map_uid: box_config.get(:uid).to_s, 133 | map_gid: box_config.get(:gid).to_s, 134 | owner: box_config.get(:user), 135 | group: box_config.get(:group) 136 | else 137 | config.unison.host_folder = box_config.get(:unison_host) 138 | config.unison.guest_folder = box_config.get(:unison_guest) 139 | config.unison.ignore = box_config.get(:unison_ignore) 140 | config.unison.perm = box_config.flag?(:unison_manage_permissions) ? 1 : 0 141 | config.unison.ssh_host = box_config.get(:hostname) 142 | config.unison.ssh_user = 'app' 143 | config.unison.ssh_port = 22 144 | config.unison.ssh_use_agent = true 145 | config.unison.repeat = 'watch' 146 | end 147 | end 148 | 149 | end 150 | --------------------------------------------------------------------------------