Skip to content

Vagrant environment for Magento 2 development tailored to Linux hosts

Notifications You must be signed in to change notification settings

Marko-M/magento2-vagrant-nux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Magento 2 Vagrant for Unix based hosts

This Vagrant environment was crafted to run best on Linux hosts. Due to mounting shares through NFSv4 to improve performance, Windows is not supported. Mac OS X hasn't been tested yet.

Guest

  • Ubuntu 14.04 LTS 64-bit
  • NFSv4 with FS-Cache
  • Nginx 1.8
  • PHP-FPM 5.6
  • MySQL 5.6
  • Varnish 3.0
  • Redis 3.0
  • phpMyAdmin
  • Mailcatcher
  • By default 2 cores, 2048 MB of RAM (configurable)

Varnish reverse proxy will not get installed by default, but it can be enabled before provisioning by setting VARNISH = 'Y' inside Vagrantfile.local configuration file.

Host

NFS server

In order to provide performance document root sharing between host and guest, NFS server with FS-Cache is used.

Ubuntu

To install on recent Ubuntu distributions:

sudo apt-get install nfs-kernel-server

Last several Ubuntu versions encounter difficulties with group permissions, combined with Magento 2 permissions scheme, this creates difficulties when loading static resources. It's required to disable --manage-gids on rpc.mountd:

sudo sed -i -e 's|--manage-gids||g' /etc/default/nfs-kernel-server
sudo service nfs-kernel-server restart

/etc/hosts

If you adjusted domain using Vagrantfile.local, you should adjust following line as well:

echo "192.168.56.6 magento2.loc phpmyadmin.magento2.loc" | sudo tee -a /etc/hosts

Configuration

This Vagrant environment can be adjusted by copying Vagrantfile.local.sample to Vagrantfile.local, and making adjustments there. Here's what's adjustable:

# -*- mode: ruby -*-
# vi: set ft=ruby :

# https://github.com/Marko-M/magento2-vagrant-nux
# Marko Martinović (http://www.techytalk.info)

# Copy into Vagrantfile.local and modify

# Add "$IP $DOMAIN phpmyadmin.$DOMAIN" to your host /etc/hosts
DOMAIN = 'magento2.loc'
TIMEZONE = 'America/Los_Angeles'

# Private network IP address
IP = '192.168.56.6'

# Hardware
RAM = 2048
CPU = 2

# Install and configure Varnish
VARNISH = 'N'

# MySQL
# Due to MySQL limitations, up to 16 characters here, more will get truncated
MYSQL_DBNAME = 'magento2'
MYSQL_USER = 'magento2'
MYSQL_PASSWORD = 'magento2'

# Magento
MAGENTO_INSTALL = 'Y'
MAGENTO_LANGUAGE = 'en_US'
MAGENTO_CURRENCY = 'USD'
MAGENTO_SAMPLE_DATA = 'Y'

# Composer auth (required if MAGENTO_INSTALL == 'Y')
AUTH_NAME = ''
AUTH_PASSWORD = ''

By default both Magento 2 (MAGENTO_INSTALL) and Magento 2 sample data (MAGENTO_SAMPLE_DATA) will be installed. Make sure you provide AUTH_NAME and AUTH_PASSWORD if want Magento 2 installed, because it's required for authentication with Magento composer repository access.

PHP

Relevant php.ini directives:

; General
max_input_time = 600
max_execution_time = 600
max_input_vars = 5000
memory_limit = 1024M
error_reporting = E_ALL
display_errors = On
display_startup_errors = On
upload_max_filesize = 32M
post_max_size = 32M
session.gc_maxlifetime = 14400
date.timezone = {{PHP_TIMEZONE}}

; Xdebug
xdebug.remote_enable = on
xdebug.remote_handler= dbgp
xdebug.remote_host= localhost
xdebug.remote_port = 9000

xdebug.profiler_enable=0
xdebug.profiler_output_dir=/tmp
xdebug.profiler_enable_trigger=1
xdebug.max_nesting_level = 1000

; Xdebug Vagrant specific
xdebug.remote_connect_back = on

MySQL

  • Root user: root
  • Root password: root
  • Magento database: magento2
  • Magento user: magento2
  • Magento password: magento2

Magento

  • Magento Frontend: http://magento2.loc
  • Magento Admin: http://magento2.loc/admin
  • Admin user: magento2
  • Admin password: magento2

MAGE_MODE is set to developer.

phpMyAdmin

  • http://phpmyadmin.magento2.loc

Mailcatcher

  • http://magento2.loc:1080

About

Vagrant environment for Magento 2 development tailored to Linux hosts

Resources

Stars

Watchers

Forks

Packages

No packages published