承接 best-it/shopware-vagrant 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

best-it/shopware-vagrant

Composer 安装命令:

composer require best-it/shopware-vagrant

包简介

Vagrant setup mainly used for shopware (5)

README 文档

README

Installation

Virtualbox and Vagrant (min. Version 2.0) have to be installed on your local machine:

Vagrant installation for Debian / Ubuntu

$ wget https://releases.hashicorp.com/vagrant/2.0.1/vagrant_2.0.1_x86_64.deb
$ sudo dpkg -i vagrant_2.0.1_x86_64.deb

Usage

Composer

Clone the repository to your local machine.

$ composer require --dev best-it/shopware-vagrant

Generate a Vagrantfile that looks like this and modify it to your needs:

shopware_vagrant = File.expand_path('./vendor/best-it/shopware-vagrant/Vagrantfile')
load shopware_vagrant

confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))
afterScriptPath = confDir + "/after.sh"
customizationScriptPath = confDir + "/user-customizations.sh"

Vagrant.configure("2") do |config|

    config.vm.synced_folder "./shopware", "/home/vagrant/www",
        type: "rsync",
        rsync__exclude: [
            "/.env",
            "/engine/Library",
            "/var/*",
            "/web/*",
            "/media/.htaccess",
            "/.htaccess",
            "/themes/Backend",
            "/themes/Frontend/Bare",
            "/themes/Frontend/Responsive",
            "/themes/Frontend/Session/node_modules",
            "/Plugins/Local/Backend/SwagImportExport/psh",
            "/custom/plugins/SwagPaymentPayPalUnified/psh"
        ]

    config.ssh.forward_agent = true

    if File.exist? afterScriptPath then
        config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
    end

    if File.exist? customizationScriptPath then
        config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
    end
end

userVagrantfilePath = confDir + "/user-vagrantfile"
load userVagrantfilePath if File.exists?(userVagrantfilePath)

Generate an ansible folder

$ mkdir ansible

Add a playbook that looks like this:

---
- name: apply common configuration to all nodes
  hosts: all
  roles:
    - role: '../vendor/best-it/shopware-vagrant/ansible/roles/common'
    - role: '../vendor/best-it/shopware-vagrant/ansible/roles/apache'
    - role: '../vendor/best-it/shopware-vagrant/ansible/roles/mysql'
    - role: '../vendor/best-it/shopware-vagrant/ansible/roles/adminer'
    - role: '../vendor/best-it/shopware-vagrant/ansible/roles/ioncube'
    - role: '../vendor/best-it/shopware-vagrant/ansible/roles/composer'
    - role: '../vendor/best-it/shopware-vagrant/ansible/roles/nodejs'
    - role: '../vendor/best-it/shopware-vagrant/ansible/roles/sw-cli-tools'
    - role: '../vendor/best-it/shopware-vagrant/ansible/roles/grunt'

Without composer

Clone the repository to your local machine.

$ git clone https://github.com/shopwareLabs/shopware-vagrant
$ cd shopware-vagrant

Boot up your vagrant virtual machine:

$ vagrant up

The first boot may take a while, so feel free to get a cup of coffee.

Your machine will be available at http://192.168.33.10/ All required tools like the LAMP stack are already installed.

To SSH into the created VM:

$ vagrant ssh

If you use Putty the ssh configuration can be obtained via:

$ vagrant ssh-config

To reprovision your machine:

$ vagrant provision

Access files on Host machine

To start local development, it is recommended to sync the source shopware folder to a local folder. To do this, uncomment one of the config.vm.synced_folder lines in the Vagrantfile file.

#config.vm.synced_folder "../src", "/home/vagrant/www/shopware", create: true, type: "smb"
#config.vm.synced_folder "../src", "/home/vagrant/www/shopware", create: true, type: "nfs"
#config.vm.synced_folder "../src", "/home/vagrant/www/shopware", create: true;

For example, for MacOS:

config.vm.synced_folder "src", "/home/vagrant/www/shopware", create: true, type: "nfs"

After editing the vagrant file, make sure to reload your instance.

$ vagrant reload

Troubleshooting

  • Error message "The 'ansible_local' provisioner could not be found.":

Make sure vagrant is at least at version 2.0:

$ vagrant -v
  • Unable to mount directory (MacOS), given error message:

      Got different reports about installed GuestAdditions version:
      Virtualbox on your host claims:   5.0.18
      VBoxService inside the vm claims: 6.0.8
      Going on, assuming VBoxService is correct..."
    

Make sure GuestAdditions are same versions:

$ vagrant vbguest --do install    
$ vagrant reload

Change PHP Version

The following PHP Versions are installed by default:

  • PHP 7.0
  • PHP 7.1
  • PHP 7.2

Call one of the following commands to change the PHP Version:

$ changephp_7.0
$ changephp_7.1
$ changephp_7.2

This will change the PHP Version used by the Apache webserver as well as the Version of the php command.

You can also call the PHP versions directly using their full path

$ /usr/bin/php7.0 -v
$ /usr/bin/php7.1 -v
$ /usr/bin/php7.2 -v

Installing Shopware

SSH first into your VM:

$ vagrant ssh

Call the install_shopware script:

$ install_shopware

This will download the latest git version of shopware and install it into /home/vagrant/www/shopware.

Download test images:

$ cd /home/vagrant/www/shopware
$ wget -O test_images.zip http://releases.s3.shopware.com/test_images_since_5.1.zip
$ unzip test_images.zip

Configure your online store in a web browser with the credentials demo/demo:

You can then access your storefront at:

Notes for Arch Linux users

$ sudo pacman -S virtualbox ansible net-tools nfs-utils
$ sudo modprobe -a vboxdrv vboxnetadp vboxnetflt
$ sudo systemctl start nfs-server

License

The MIT License (MIT). Please see License File for more information.

best-it/shopware-vagrant 适用场景与选型建议

best-it/shopware-vagrant 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.53k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 10 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 best-it/shopware-vagrant 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 best-it/shopware-vagrant 我们能提供哪些服务?
定制开发 / 二次开发

基于 best-it/shopware-vagrant 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 4.53k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 28
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-27