title: Deploying rails app on separate app server and database server (both Linode)
body: <p>I'm having trouble deploying a basic rails app (which works on local machine, which works on heroku) to a distributed architecture (web server on one box, database server on another).</p>
  
  <p>Here is my issue. It seems that Capistrano is not able to update the cached copy on my database server.</p>
  
  <pre><code>2013-05-12 11:32:57 executing `deploy:update_code'
  updating the cached checkout on all servers
  executing locally: "git ls-remote git@github.com:morgs32/treebook.git master"
  command finished in 1658ms
  * executing multiple commands in parallel
  -&gt; "else" :: "if [ -d /home/morgan/apps/treebook/shared/cached-copy ]; then cd  /home/morgan/apps/treebook/shared/cached-copy &amp;&amp; git fetch -q origin &amp;&amp; git fetch --tags -q origin &amp;&amp; git reset -q --hard 73b5a632d417b3a6863d542b174b30077265bc7c &amp;&amp; git clean -q -d -x -f; else git clone -q -b master git@github.com:morgs32/treebook.git /home/morgan/apps/treebook/shared/cached-copy &amp;&amp; cd /home/morgan/apps/treebook/shared/cached-copy &amp;&amp; git checkout -q -b deploy 73b5a632d417b3a6863d542b174b30077265bc7c; fi"
  -&gt; "else" :: "if [ -d /home/morgan/apps/treebook/shared/cached-copy ]; then cd /home/morgan/apps/treebook/shared/cached-copy &amp;&amp; git fetch -q origin &amp;&amp; git fetch --tags -q origin &amp;&amp; git reset -q --hard 73b5a632d417b3a6863d542b174b30077265bc7c &amp;&amp; git clean -q -d -x -f; else git clone -q -b master git@github.com:morgs32/treebook.git /home/morgan/apps/treebook/shared/cached-copy &amp;&amp; cd /home/morgan/apps/treebook/shared/cached-copy &amp;&amp; git checkout -q -b deploy 73b5a632d417b3a6863d542b174b30077265bc7c; fi"
  servers: ["*app server ip*", "*database ip*"]
  [*app server ip*] executing command
  [*database ip*] executing command
  ** [*database ip* :: out] sh: 1: git: not found
  command finished in 3072ms
  *** [deploy:update_code] rolling back
  * executing multiple commands in parallel
  -&gt; "else" :: "rm -rf /home/morgan/apps/treebook/releases/20130512183302; true"
  -&gt; "else" :: "rm -rf /home/morgan/apps/treebook/releases/20130512183302; true"
  servers: ["*app server ip*", "*database ip*"]
  [*app server ip*] executing command
  [*database ip*] executing command
  command finished in 201ms
  failed: "sh -c 'if [ -d /home/morgan/apps/treebook/shared/cached-copy ]; then cd /home/morgan/apps/treebook/shared/cached-copy &amp;&amp; git fetch -q origin &amp;&amp; git fetch --tags -q origin &amp;&amp; git reset -q --hard 73b5a632d417b3a6863d542b174b30077265bc7c &amp;&amp; git clean -q -d -x -f; else git clone -q -b master git@github.com:morgs32/treebook.git /home/morgan/apps/treebook/shared/cached-copy &amp;&amp; cd /home/morgan/apps/treebook/shared/cached-copy &amp;&amp; git checkout -q -b deploy 73b5a632d417b3a6863d542b174b30077265bc7c; fi'" on *database ip*
  </code></pre>
  
  <p>Of course wherever you see <em>app server ip</em>, or <em>database ip</em> I have the actual ips for those servers. Any ideas?</p>