- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
当 chef-solo 尝试启动 AFW 防火墙时,我的 vagrant provision 失败了 - 调查显示/etc/init.d/firewall 文件的每一行末尾都有 ^M 个字符。
配置日志的输出是:
Compiled Resource:
==> default: ------------------
==> default: # Declared in /tmp/vagrant-chef-solo/65fec65b9f544271ce41fa26d9a1fc6f/cookbooks/afw/recipes/default.rb:85:in `from_file'
==> default:
==> default: service("firewall") do
==> default: action [:enable, :start]
==> default: supports {:restart=>false, :reload=>false, :status=>true}
==> default: retries 0
==> default: retry_delay 2
==> default: service_name "firewall"
==> default: enabled true
==> default: pattern "firewall"
==> default: startup_type :automatic
==> default: cookbook_name :afw
==> default: recipe_name "default"
==> default: end
==> default:
任何其他创建的文件都不会发生这种情况。
AFW 是从另一个配方加载的
Vagrant 文件:
project_directory = Dir.pwd.split(File::SEPARATOR)[-3]
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "CentOS-6.5-x86_64-virtualbox-minimal-0.1.1.box"
config.vm.box_url = "http://ib-vagrant-vms.s3.amazonaws.com/CentOS-6.5-x86_64-virtualbox-minimal-0.1.1.box"
# Boot with a GUI so you can see the screen. (Default is headless)
# config.vm.boot_mode = :gui
config.vm.host_name = "XXXXX.development.local"
config.hostsupdater.aliases = [
"YYYYY.development.local",
]
# Assign this VM to a host-only network IP, allowing you to access it
# via the IP. Host-only networks can talk to the host machine as well as
# any other machines on the same network, but cannot be accessed (through this
# network interface) by any external networks.
config.vm.network :private_network, ip: "192.168.1.11"
config.vm.provider :virtualbox do |vb|
vb.gui = false
vb.name = "New Server"
vb.memory = "2048"
end
# Assign this VM to a bridged network, allowing you to connect directly to a
# network using the host's network device. This makes the VM appear as another
# physical device on your network.
# config.vm.network :bridged
# Forward a port from the guest to the host, which allows for outside
# computers to access the VM, whereas host only networking does not.
# config.vm.forward_port 80, 8080
# Share an additional folder to the guest VM. The first argument is
# an identifier, the second is the path on the guest to mount the
# folder, and the third is the path on the host to the actual folder.
# config.vm.share_folder "v-data", "/vagrant_data", "../data"
# The following configuration supports shared folders with host
# aware configuration of NFS for performance benefits on unix based hosts
require 'ffi'
config.vm.synced_folder "../../", File.join("/mnt/Sites", project_directory), :nfs => ! FFI::Platform::IS_WINDOWS
# Enable the cachier plugin if available, so we can cache composer dependencies, yum packages, etc.
if Vagrant.has_plugin?("vagrant-cachier")
# Configure cached packages to be shared between instances of the same base box.
# More info on http://fgrehm.viewdocs.io/vagrant-cachier/usage
config.cache.scope = :box
if ! FFI::Platform::IS_WINDOWS then
# OPTIONAL: If you are using VirtualBox, you might want to use that to enable
# NFS for shared folders. This is also very useful for vagrant-libvirt if you
# want bi-directional sync
config.cache.synced_folder_opts = {
type: :nfs,
# The nolock option can be useful for an NFSv3 client that wants to avoid the
# NLM sideband protocol. Without this option, apt-get might hang if it tries
# to lock files needed for /var/cache/* operations. All of this can be avoided
# by using NFSv4 everywhere. Please note that the tcp option is not the default.
mount_options: ['rw', 'vers=3', 'tcp', 'nolock']
}
end
config.cache.enable :composer
config.cache.enable :chef
config.cache.enable :generic, {
rbenv: {
cache_dir: '/usr/local/rbenv'
}
}
end
# Enable provisioning with chef solo, specifying a cookbooks path, roles
# path, and data_bags path (all relative to this Vagrantfile), and adding
# some recipes and/or roles.
#
if Vagrant.has_plugin?("vagrant-berkshelf")
config.berkshelf.enabled = true
config.berkshelf.berksfile_path = "../chef/Berksfile"
end
config.vm.provision :chef_solo do |chef|
# logging
chef.log_level = :debug
chef.arguments = '--force-formatter'
if ! FFI::Platform::IS_WINDOWS then
# Mount chef folders via NFS for speed
chef.synced_folder_type = 'nfs'
end
if Vagrant::VERSION.to_f > 1.0
chef.provisioning_path = "/tmp/vagrant-chef-solo"
if !Vagrant.has_plugin?("vagrant-cachier") then
chef.file_cache_path = chef.provisioning_path
end
end
chef.cookbooks_path = ["../chef/cookbooks", "../chef/site-cookbooks"]
chef.roles_path = "../chef/roles"
chef.environments_path = "../chef/environments"
chef.environment = "dev"
chef.data_bags_path = ["../chef/data_bags/"]
# Uncomment the following line and copy in the encryption key if you need to work
# with encrypted data bag data in your local environment
chef.encrypted_data_bag_secret_key_path = "../chef/.chef/#{chef.environment}_encrypted_data_bag_secret"
chef.add_recipe "data-bag-merge::environment"
chef.add_recipe "yum-ius-XXXXX"
chef.add_role "base"
chef.add_recipe "resolver"
chef.add_role "mysql-server-56"
chef.add_recipe "database-XXXXX"
chef.add_role "self-signed-ssl"
chef.add_role "ssl-offloading-server"
chef.add_role "memcached"
chef.add_role "redis"
chef.add_role "varnish"
chef.add_role "solr-server"
chef.add_role "admin-server"
chef.add_role "api-server"
chef.add_role "developer"
chef.add_role 'maintenance'
#add chef attributes that rely on project_directory variable
chef.json = {
'resolver' => {
'nameservers' => ['8.8.8.8', '8.8.4.4']
},
'xdebug' => {
'is_extension_enabled' => true
},
}
end
end
最佳答案
因为我最初运行了 vagrant up --provision
命令 git
将所有 Recipe 依赖项下载到我的本地驱动器并放置了 CRLF
在它下载的文本文件中。
在gitconfig文件中设置autocrlf=input
:
c:\users\JonM\Appdata\local\GitHub\portablegit'''''\etc
删除所有下载的 Recipe :
c:\users\JonM\.berkshelf\cookbooks`
运行
vagrant up --provision
再次下载所有 Recipe - 这次没有 CRLF
。
关于linux - Windows vagrant chef-solo provision 在 Linux guest 中创建 CRLF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35081405/
由于我在一个团队中工作,我想让与 vagrant(和 Chef-solo)一起工作的过程尽可能顺利。 当团队中的某人更改厨师食谱、角色或其他任何内容时,我希望所有其他团队成员通过在下一个“Vagran
在学习了几天之后,我很高兴能够成功设置我的 VM 并运行 Laravel 起始页。在那里很开心:) 有人可以澄清“何时”使用 Vagrant 函数。我的问题: 如果我打算关闭我的电脑,你应该使用 ha
如果我更改了配置脚本或更糟的基本操作系统,有没有办法强制 vagrant 重新配置或重新下载基本框?我试图改变 config.vm.box和 config.vm.box_url ,但是 vagrant
默认情况下,vagrant将框提取到用户主驱动器-%HOMEDRIVE%\.vagrant.d\boxes。这是在网络位置上。虽然有利于可靠存储,但速度非常慢。 如何更改盒子的位置? 最佳答案 当然。
我的系统上有许多测试 Vagrant 盒,我正在整理它们。我安装了插件,例如vagrant plugin install vagrant-hostsupdater和vagrant plugin ins
我的系统上有许多测试 Vagrant 盒,我正在整理它们。我安装了插件,例如vagrant plugin install vagrant-hostsupdater和vagrant plugin ins
我在理解他们网站上的 vagrant 工作流程时遇到了一些麻烦。 我之前一直在做一个项目,经历了更改目录和设置 vagrant box 等的整个过程。我什至运行了 bundle install 来安装
我在一个盒子上有一些相当复杂的配置,之后我想以编程方式做等效于 vagrant reload 的事情。 . 我见过的最好的解决方案是 here ,但是该链接上的代码似乎在 Vagrant 1.4+ 上
我无法在 Windows 7 机器上在我们的公司代理后面执行 vagrant up(或 vagrant add)。我尝试过使用和不使用 http_proxy/https_proxy 环境变量。我尝试将
是否可以将配置脚本中的值返回给 vagrant? response = config.vm.provision( "shell", path: "script.sh" ) if response =
这两个 Vagrant 插件有什么区别?我正在使用 vagrant-hostmanager,它可以更新主机上的/etc/hosts 文件,以及 guest 机器上的文件,支持多机 vagrant 设置
我正在使用vagrant和ansible来配置虚拟机,并且工作正常。这个可笑的剧本克隆了一个git repo,安装了它并运行了一个服务守护进程。 我还希望有一个无所事事的命令,该命令执行一个单独的“更
在浏览 Vagrant 教程时,我看到了两种在主机和 guest 计算机之间共享文件夹的选项 - 共享文件夹和同步文件夹。它们之间有什么区别? 或者,在 Vagrant 2 中,同步文件夹是共享文件夹
我在 Vagrant 中遇到同步文件夹的问题。我的配置非常简单: Vagrant.configure(2) do |config| config.vm.box = "ubuntu/xenial64
我正在尝试提供一个主-主MySQL对,并且只有它们都启动时才能正确配置它们。 Vagrant.configure("2") do |config| web.vm.box = "centos/7"
我已经在目录D:\vagrant\precise32\02-lamp\中执行了以下命令(在Windows中,使用Git Bash) $ vagrant box add precise32 http:/
尝试使用 Vagrant 的安装程序在 Windows 7 X64 上安装 Vagrant - vagrant_1.7.0.msi 安装正常,但无法使用 vagrant。在任何命令上,例如 vagra
我想禁用VirtualBox Guest Additions。我不会将它们用于文件夹同步等操作,对于我正在使用的盒子(例如centos / 7),无论如何它们都无法构建。有什么办法告诉流浪汉不要尝试在
我在 VirtualBox 上使用 Vagrant。昨天,我通过运行保存了我的项目的快照: $ vagrant snapshot save 'my-project-date-time' 今天,我对我想
我使用来自 vagrant init 的默认配置配置了 Vagrant (1.7.4)在 OS X (10.11.4) 上使用最新版本的 VirtualBox (5.0.16 r105871) 和最新
我是一名优秀的程序员,十分优秀!