include_recipe 'img-basic::default'

include_recipe 'img-basic::chef-client'

include_recipe 'img-trials::alfresco'

include_recipe 'img-basic::rsyslog-config'

# TODO: - we desperately need supervisord
#
# We don't want to register the service
# We just want to run alfresco once so that DB is created
['tomcat-alfresco', 'tomcat-share', 'tomcat-solr'].each do |service_name|
  execute "start-#{service_name}" do
    command "service #{service_name} start"
    not_if "service #{service_name} status | grep 'active (running)'"
    notifies :run, 'execute[wait-services-to-start]', :delayed
  end
end

execute 'wait-services-to-start' do
  command 'sleep 400'
  action :nothing
end
