Tag: 主厨

如何在vagranted虚拟机上访问postgresql?

我使用postgresql通过Vagrant虚拟机制作,并希望将其用作我的rails应用程序数据库。 我使用类似的Vagrantfile: Vagrant.configure(“2”) do |config| config.vm.network :private_network, ip: “192.168.33.18” config.vm.provision :chef_solo do |chef| # I take cookbook from https://github.com/opscode-cookbooks/postgresql chef.add_recipe “postgresql::server” chef.json = { postgresql: { config: { ssl: false, listen_addresses: ‘*’ }, password: { postgres: ‘postgres’ } } } end end 接下来我vagrant up并期望下一个database.yml将工作: development: database: app_development adapter: postgresql host: ‘192.168.33.18’ username: root 但这不会发生.. Rake任务失败并出现错误: […]

在Amazon OpsWorks上使用Ruby 2.0

我想在Amazon OpsWorks上使用Ruby 2.0,所以我正在尝试以下方法: 选择自定义cookbook并将它们设置为我的https://github.com/aws/opsworks-cookbooks的分支 将https://github.com/aws/opsworks-cookbooks/blob/master/ruby/attributes/ruby.rb中的所有版本号更新为2.0值。 但这似乎没有任何影响。 自定义烹饪书是否覆盖了他们的内置对应物? OpsWorks是否使用菜谱中的Ruby配方进行基本的Ruby设置? 同样的问题也适用于Nginx – 我可以通过更改我的食谱叉来控制版本和设置吗?

拆分字符串以仅获取前5个字符

我想去位置/var/log/src/ap-kernelmodule-10.001-100 但看起来我的代码必须处理ap-kernelmodule-10.002-100,ap-kernelmodule-10.003-101等。我想用拆分字符串到达​​该位置并执行我的命令。 例如:/var/log/src/ap-kernelmodule-10./ 这个Linux机器的ruby脚本,所以我使用了Mixlib :: ShellOut。 begin cmd = Mixlib::ShellOut.new(“command run here” , :cwd => ‘/var/cache/acpchef/src/ap-kernelmodule-10xxx’) cmd.run_command end