app = search(:aws_opsworks_app).first

app_path = "/srv/#{app['shortname']}"
application app_path do
  javascript "4"

  app_tarball_path = ::File.join(Chef::Config[:file_cache_path], "#{app['shortname']}.tar.gz")
  remote_file app_tarball_path do
    source app["app_source"]["url"]
  end

  execute "tar xfz #{app_tarball_path} -C #{app_path} --strip-components=1"

  npm_install
  npm_start
end

app = search(:aws_opsworks_app).first

execute "ssh-keyscan -H github.com >> /root/.ssh/known_hosts"

application "/srv/#{app['shortname']}" do
  javascript "4"

  file "/root/.ssh/id_rsa" do
    content app["app_source"]["ssh_key"]
    mode 0600
  end

  git "/srv/#{app['shortname']}" do
    repository app["app_source"]["url"]
    revision app["app_source"]["revision"]
  end

  npm_install
  npm_start
end

--- 
+++ 
@@ -1,19 +1,15 @@
 app = search(:aws_opsworks_app).first
 
-execute "ssh-keyscan -H github.com >> /root/.ssh/known_hosts"
-
-application "/srv/#{app['shortname']}" do
+app_path = "/srv/#{app['shortname']}"
+application app_path do
   javascript "4"
 
-  file "/root/.ssh/id_rsa" do
-    content app["app_source"]["ssh_key"]
-    mode 0600
+  app_tarball_path = ::File.join(Chef::Config[:file_cache_path], "#{app['shortname']}.tar.gz")
+  remote_file app_tarball_path do
+    source app["app_source"]["url"]
   end
 
-  git "/srv/#{app['shortname']}" do
-    repository app["app_source"]["url"]
-    revision app["app_source"]["revision"]
-  end
+  execute "tar xfz #{app_tarball_path} -C #{app_path} --strip-components=1"
 
   npm_install
   npm_start
Switch deployment from Git repo to tarball on S3
