Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have to create a bare repository on the server with <code>git init --bare</code>. Then use a <code>post-receive</code> hook to trigger your deploy. How you deploy is up to you.</p> <h2>My Deployment Strategy</h2> <p>I usually place a <code>deploy</code> director, somewhere logical. Then each checkout, I unpack the latest branch to <code>deploy/COMMIT_ID</code> where <code>COMMIT_ID</code> is the hash of the latest push. Once the checkout is complete, you can re-point a symlink to the latest deployment directory.</p> <p>My usual directory structure:</p> <pre><code>deploy.git/ deploy/ a7922231/ b2f0a2af/ latest -&gt; b2f0a2af </code></pre> <h3>Unpacking the Update</h3> <p>Rather than use a <code>git-checkout</code>, I usually use <code>git-archive</code> to unpack a branch into a directory.</p> <pre><code># Assuming current directory is deploy.git HEAD=`cat refs/heads/master` mkdir -p ../deploy/${HEAD} git archive master | tar -x -C ../deploy/${HEAD} </code></pre> <p>Your web-server can point to <code>deploy/latest</code>, updates will be more-or-less atomic.</p> <p>I use this often in production, and has a few benefits over unpacking over the same directory.</p> <ol> <li>rollbacks are easy</li> <li>you can do post-unpack procedures, like compile or install dependencies without interrupting the current deployment</li> </ol> <h3>Tips</h3> <ol> <li>each update, append to a <strong>deploy log</strong> that says when updates occurred, and what their hash ids are. This makes rollbacks <em>much</em> easier.</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload