Reputation: 9722
I am using application and application_ruby recipes. And I am defining my app like this with migrate 'true':
application 'railsapp' do
owner 'vagrant'
group 'vagrant'
path '/home/vagrant/railsapp'
revision 'master'
repository '[email protected]: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
However, I don't see any migration running. I think it is because application_ruby removes it once it is run. However, in my case, there was a problem in database user credentials and the migration was not successful. Apart from running the migration manually, is there any way I can make it run?
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
Upvotes: 2
Views: 792
Reputation: 592
I think I ran into the same issue, after declaring the migration command, it did work. So like this:
application 'railsapp' do
owner 'vagrant'
group 'vagrant'
path '/home/vagrant/railsapp'
revision 'master'
repository '[email protected]:rohshall/railsreadings.git'
migrate true
migration_command "bundle exec rake db:migrate"
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
Upvotes: 1