【发布时间】:2013-08-31 18:04:56
【问题描述】:
我正在使用 application 和 application_ruby 配方。我正在使用 migrate 'true' 来定义我的应用程序:
application 'railsapp' do
owner 'vagrant'
group 'vagrant'
path '/home/vagrant/railsapp'
revision 'master'
repository 'git@github.com:rohshall/railsreadings.git'
migrate true
rails do
bundler true
database do
host 'localhost'
username mysql_connection_info[:username]
password mysql_connection_info[:password]
database 'railsreadings_production'
adapter 'mysql2'
encoding 'utf8'
end
end
unicorn do
worker_processes 2
end
end
但是,我没有看到任何迁移正在运行。我认为这是因为 application_ruby 在运行后将其删除。但是,就我而言,数据库用户凭据存在问题,迁移不成功。除了手动运行迁移之外,还有什么方法可以让它运行吗?
ruby_block "remove_run_migrations" do
block do
if node.role?("#{new_resource.name}_run_migrations")
Chef::Log.info("Migrations were run, removing role[#{new_resource.name}_run_migrations]")
node.run_list.remove("role[#{new_resource.name}_run_migrations]")
end
end
end
【问题讨论】:
-
您找到解决方案了吗?请不要忘记将答案标记为正确! :)
标签: ruby-on-rails chef-infra chef-recipe