- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试按照以下文本教程进行操作,但我的设置在他键入“bundle install”时中断,我的设置没有安装 bundle,很明显我的 Chef 东西有问题 - https://gorails.com/guides/using-vagrant-for-rails-development
编辑:为什么这个问题被否决了?我没有提供一些背景吗?
我运行了前两个命令。
vagrant plugin install vagrant-vbguest
vagrant plugin install vagrant-librarian-chef-nochef
我创建了一个文件夹并制作了 Cheffile 和 Vagrantfile,如下所示:
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Use Ubuntu 14.04 Trusty Tahr 64-bit as our operating system
config.vm.box = "ubuntu/trusty64"
# Configurate the virtual machine to use 2GB of RAM
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
# Forward the Rails server default port to the host
config.vm.network :forwarded_port, guest: 3000, host: 3000
# Use Chef Solo to provision our virtual machine
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "apt"
chef.add_recipe "nodejs"
chef.add_recipe "ruby_build"
chef.add_recipe "rbenv::vagrant"
chef.add_recipe "rbenv::user"
chef.add_recipe "vim"
chef.add_recipe "mysql::server"
chef.add_recipe "mysql::client"
# Install Ruby 2.2.1 and Bundler
# Set an empty root password for MySQL to make things simple
chef.json = {
rbenv: {
user_installs: [{
user: 'vagrant',
rubies: ["2.2.1"],
global: "2.2.1",
gems: {
"2.2.1" => [
{ name: "bundler" }
]
}
}]
},
mysql: {
server_root_password: ''
}
}
end
end
Chef 文件
site "http://community.opscode.com/api/v1"
cookbook 'apt'
cookbook 'build-essential'
cookbook 'mysql', '5.5.3'
cookbook 'ruby_build'
cookbook 'nodejs'
cookbook 'rbenv', git: 'https://github.com/aminin/chef-rbenv'
cookbook 'vim'
到目前为止,我已经花了 3 天时间整日整夜摆弄这个,但我无法让它工作。我启动了我的 vagrant box,但未安装 bundler ,所以我无法捆绑安装。
显然 chef.json 不工作。我尝试过查看错误输出,我一直在谷歌搜索并打开了数百个选项卡,此时我完全迷路了。
在我的 chef.json 中,它是如何工作的?我如何开始了解如何制作我自己的 chef.json?看不懂,怎么知道写user_installs
之类的?
下面有区别吗:
a) config.vm.provision :chef_solo do |chef|
b) config.vm.provision "chef solo"do |chef|
最佳答案
哎呀。那里有很多问题..所以我会尝试一次去 1
*) 在本地,您安装的是 chef-client 还是 chef dk?Chefclient 没有 bundler ,而 chefdk 有。这通常也是一种更流畅的体验。
如果您使用的是 chef-client。你必须得到 bundler gem install bundler
如果您使用的是 chefdk。您可以将 chefdk ruby 添加到您的路径,使用临时环境设置(eval "$(chef shell-init bash)"
)或只使用 chef exec bundle ...
*) 半无关。但该博客上的评论可以追溯到 10 多个月前。我建议你看看https://learn.chef.io/index.html获取最新教程
*) chef_solo 和'chef solo' 是不同的东西。 :chef_solo
是一个符号。将其视为 Vagrant 语言中具有特殊含义的事物。 chef solo
没有任何意义 - a) 它里面有一个空格,所以它是两个不同的东西 - 要么是变量(在你的例子中未定义),要么是“chef solo”一个字符串,它有对提供者没有意义。
*) 谷歌搜索 Chef 相关的结果,我建议使用 http://docs.chef.io或包括工具名称“chef vagrant nil error”
最后,为开始学习这个工具集鼓掌。太棒了,但这是一个全新的宇宙。
关于ruby - 使用 Chef 配置构建 Vagrantfile 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29708664/
Vagrant Multi-Machine 功能看起来很酷,但是困扰我的一件事(或者不是立即明显的)是,似乎没有一种好的方法可以在“父”Vagrantfile 和“ child ”Vagrantfil
我正在尝试使用厨房来自动测试厨师食谱和 Vagrant 环境,但是当我运行厨房时,它会忽略存在的 Vagrantfile 并根据 .kitchen.yml 文件执行所有操作。我想知道是否有人知道告诉厨
我用了packer创建一个 vagrant我正在运行和包装的车间的盒子 vagrantfile通过 Vagrant 后处理器中的 vagrantfile_template 指令在框中输入,如下所示:
如果我在 Vagrantfile 的适当位置添加类似这样的内容: vm.provision "shell", path: "my_node.sh", env: {"MY_VARIABLE"=>ENV[
我有一个通过 Vagrant 实例化的非常旧的 VM。我有我所有的开发堆栈。配置是这样的: config.vm.box = "ubuntu/trusty64" config.vm.networ
我想在运行 vagrant up 时在屏幕上显示一些文本(或 vagrant provision 等)当且仅当 正在配置。 (对于 vagrant up 它只在第一次运行,或者如果特别强制使用 --p
我的 Vagrant 文件中设置了以下规定。 config.vm.provision :shell, :path => "provision/bootstrap.sh" config.vm.pro
我正在尝试调整我的 Vagrantfile,因此如果它丢失,它会自动在项目根目录中创建一个文件夹。创建文件夹没问题,但我无法找到创建该文件夹的位置。 我发现此信息可在 Vagrant::Environ
我有一个用于 lucid32 盒子的特定 Vagrantfile,它安装了一些非常标准的包(PHP/MySQL/Apache),进行一些特定的端口转发等等,我设置它,从 git checkout 一个
我对 Vagrantfile 进行了更改(添加了 config.vm.share_folder 、 config.vm.customize 行),现在我希望它们显示在盒子上。我需要运行吗 vagran
我想直接在 vagrantfile 中指定每个虚拟机默认使用哪个提供程序。 例如,给定这个 vagrantfile: # Vagrantfile [...] config.vm.define 'dev
我们有多个项目,每个项目都将使用 Vagrant 来管理其开发环境。我们很高兴使用 Chef 进行配置,一切都运行良好。但是,我们发现我们的 Vagrantfiles 之间有很多剪切和粘贴的内容。我们
我不确定是否应该使用 Puppet 来实现此目的。我通过provision.sh更新并安装。 我的 Vagrant 文件 Vagrant.configure("2") do |config| co
当我查看 Vagrant 文档时 https://www.vagrantup.com/docs/networking/forwarded_ports.html它给出了一个这样的例子: Vagrant.
根据文档,您可以解决运行多个环境以重现您的产品的需求(例如一台数据库机器、一台网络机器等): Vagrant.configure("2") do |config| config.vm.define
我已经设置了一个带有两个虚拟机的虚拟机 a) Ubuntu b) Windows 10。我从头开始为这些虚拟机中的每一个创建了 vagrant box。每个 vagrant box 都单独运行良好。但
我使用的是 JHipster 的 DevBox,它是一个 XUbuntu Vagrant box。 我想在设置盒子的时候改变键盘布局,让它在登录页面也有效,不需要重启,所以用户可以在第一次启动虚拟机后
我希望能够更改我的人偶 list 的行为,具体取决于它们运行的位置。目前,我正在使用这个 hack 来导出 vagrant provider(通过 facter): Vagrant.configu
我对用于配置 Vagrant 的 ruby 语法感到困惑。特别是对于这种结构。这是一个赋值、一个方法调用,还是其他什么?是纯 ruby 还是 vagrant 特定方言? config.vm.n
谁能指导我如何在我的 VagrantFile 中包含变量?我正在尝试从外部文件将配置注入(inject) Vagrantfile,这样我就可以将配置分发给我的同事,而无需他们直接在 Vagrantfi
我是一名优秀的程序员,十分优秀!