I can't understand how am I supposed to handle 'Deploy' event that happens on instance start. The stack has two layers (Node.js and Rails) and two apps with distinct recipes to handle 'Deploy' events. The problems is, when the instance is started, OpsWorks tries to deploy both these apps to an instance and obviously fails. Currently the deployment recipe looks like this:
search('aws_opsworks_app').each do |app|
Chef::Log.info("Deploying app #{app.name}")
app_dir = '/srv/www/js_app'
application app_dir do
git app['app_source']['url'] do
revision app['app_source']['revision']
deploy_key app['app_source']['ssh_key']
end
execute 'Install dependencies' do
command 'npm install --dev'
cwd app_dir
end
execute 'Build' do
command 'npm run build'
cwd app_dir
end
npm_start
end
end