我正在使用vagrant托管几个环境。几周前,一次电涌毁掉了我的VM,它工作得很好。一个后端开发人员为我创建了一个新的Vagrantfile,但它的速度太慢了。在我支持的最大的站点上运行drush cc all可能需要10分钟。我尝试了许多解决方案,但都没有起到作用。值得注意的是,加载正面页面比加载管理页面要快得多。使用drush和git也非常慢。
这是我的Vagrantfile:
Vagrant.configure(2) do |config|
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
end
# config.vm.box = "ubuntu/xenial64"
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder "www", "/var/www",
# config.vm.synced_folder "./", "/var/sites/dev.query-auth", id: "vagrant-root"
owner: "vagrant",
group: "www-data",
mount_options: ["dmode=775,fmode=664"]
config.vm.provision "fix-no-tty", type: "shell" do |s|
s.privileged = false
s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
end
config.vm.provision :shell, path: "provision.sh"
end我见过的一种常见的修复方法是将NFS设置为true,但这对性能没有影响。任何关于如何提高我的表现的提示都是非常有帮助的。
发布于 2017-01-17 23:36:58
这是我的,工作得很好。尝试使用它,或者结合使用这两种方法。
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu/trusty64"
# Create a private network, which allows host-only access to the machine using a specific IP.
config.vm.network "private_network", ip: "192.168.33.22"
# Share an additional folder to the guest VM. The first argument is the path on the host to the actual folder.
# The second argument is the path on the guest to mount the folder.
config.vm.synced_folder "./", "/var/www/html", nfs: true
# Define the bootstrap file: A (shell) script that runs after first setup of your box (= provisioning)
config.vm.provision :shell, path: "bootstrap.sh"
config.vm.boot_timeout = 3000
config.vm.provider "virtualbox" do |v|
# v.gui = true
v.memory = 3072
v.cpus = 2
end
endhttps://stackoverflow.com/questions/41699076
复制相似问题