claudiucreanga/magento2-vagrant

Magento2 hypernode vagrant 虚拟机

安装: 154

依赖项: 0

建议者: 0

安全: 0

星标: 1

关注者: 2

分支: 0

开放问题: 0

语言:Shell

类型:项目

v2.0 2016-06-17 22:49 UTC

This package is not auto-updated.

Last update: 2024-09-23 13:28:40 UTC


README

最快的 Magento2 Vagrant 虚拟机 快速字节 Hypernode 盒子(使用 nfs_guest 插件进行文件共享)

镜像

基于

安装

  1. 可以通过 composer 安装
composer create-project claudiucreanga/magento2-vagrant

所需的 Vagrant 插件

  • vagrant-hostmanager
  • vagrant-auto_network
  • vagrant-nfs_guest
2) vagrant plugin install vagrant-hostmanager vagrant-auto_network vagrant-nfs_guest

使用方法

  1. 编辑 config.rb 以反映您的项目设置(页面底部的配置选项)
name 'your-project-name'
hostname name + '.box' # will be your main url http://your-project-name.box/
profiler true # Add tideways-profiler ?
developer true # Enable development mode?
directory 'server' # Directory into which NFS share will be mounted on your host
php7 true
memory 3072
  1. 启动虚拟机(大约需要 45 分钟左右)
cd magento2-vagrant
vagrant up
  1. 构建您的 magento2 项目(安装 nodejs、npm 等。)
vagrant ssh
# install nodejs 5
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install nodejs

# inside /data/web/public/ you can find your files from server/public directory
cd /data/web/public/

# install npm packages and grunt globally
sudo npm install
sudo npm install -g grunt-cli
  1. 设置您的数据库
# find you MySQL password in /data/web/.my.cnf by loging in to SSH
cat /data/web/.my.cnf
mysql -u app -p
# create database and/or import an already existing one
  1. 克隆现有的项目或使用 composer 创建新的 magento2 项目。您可以在 vagrant 虚拟机内部或本地机器上执行,具体取决于您将在哪里进行 git 工作。

  2. Magento bash

# always work as the app user so that you will not get permission errors when magento generates files
sudo su app
# open your bash profile
sudo nano ~/.bashrc
# add this line into your bash profile
export PATH=$PATH:/data/web/public/bin
# then refresh your profile
source ~/.bashrc
# then give permissions to magento
sudo chmod a+x /data/web/public/bin/magento
# give permissions to magento folders
sudo chown -R app:app /data/web/public/
sudo chmod -R 777 var/ lib/ pub/ app/etc/
# test that everything is fine, inside /data/web/public/ directory type
magento list
# you should receive the list of magento commands, now deploy your static files
magento setup:static-content:deploy
# and visit the domain.box
  1. 日常工作
cd magento2-vagrant
vagrant ssh
cd /data/web/public/
sudo su app
grunt task

配置选项

  • name - 节点名称
  • hostname - 默认项目主机名
  • domains - 您项目的附加域名列表
  • varnish - 启用或禁用您项目的 varnish(默认:false
  • profiler - 启用或禁用 tideways-profiler(默认:false
  • developer - 启用或禁用 Magento 中的开发者模式(默认:false
  • magento2 - Magento 2.0 安装?(默认:false
  • install - 是否安装 Magento?(默认:false,仅支持 Magento 2.0 安装)
  • shell - 安装 FishShell?(默认:false
  • php7 - 使用 PHP7 而不是 PHP5?(默认:false
  • cpu - 分配给您的虚拟机的 CPU 数量(默认:1
  • memory - 分配给您的虚拟机的内存(MB)(默认:1024
  • user - nfs 共享权限的用户名(默认:app
  • group - nfs 共享权限的组名(默认:app
  • uid - 映射到 Linux 虚拟机的宿主机用户 ID(默认:Process.euid
  • gid - 映射到 Linux 虚拟机的宿主机组 ID(默认:Process.egid
  • directory - 在宿主机上用作挂载的目录(默认:server
  • network - 自动分配给虚拟机的网络网关(默认:33.33.33.0/24

添加自定义 shell 配置脚本

您可以从配置文件(config.rb)轻松添加更多的配置 shell 脚本。

shell_add 'some-custom-shell-script.sh'

# Will provision only if PHP7 flag is turned on
shell_add 'some-custom-script-for-php7.sh', :php7