{"id":14,"date":"2007-03-22T12:33:47","date_gmt":"2007-03-22T17:33:47","guid":{"rendered":"https:\/\/xkahn.zoned.net\/blog\/2007\/03\/22\/howto-creating-an-automated-staging-server-using-cvs\/"},"modified":"2007-03-22T12:33:47","modified_gmt":"2007-03-22T17:33:47","slug":"howto-creating-an-automated-staging-server-using-cvs","status":"publish","type":"post","link":"https:\/\/xkahn.zoned.net\/blog\/2007\/03\/22\/howto-creating-an-automated-staging-server-using-cvs\/","title":{"rendered":"HOWTO: Creating An Automated Staging Server using CVS"},"content":{"rendered":"<p>It&#8217;s easy to create an automated staging server for content that doesn&#8217;t need to be compiled (like most web content.)  The trick is that CVS has a very flexible logging system.  All you need to do is have your CVS server send an email on each check in and have the staging server take that email and check out the files that changed.<\/p>\n<p><a href=\"https:\/\/xkahn.zoned.net\/blog\/wp-content\/uploads\/2007\/03\/cvs-stage.png\" title=\"CVS Automated Staging Process\"><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/xkahn.zoned.net\/blog\/wp-content\/uploads\/2007\/03\/cvs-stage.png\" title=\"CVS Automated Staging Process\"><img decoding=\"async\" src=\"https:\/\/xkahn.zoned.net\/blog\/wp-content\/uploads\/2007\/03\/cvs-stage.png\" title=\"CVS Automated Staging Process\" alt=\"CVS Automated Staging Process\" border=\"0\" \/><\/a><\/p>\n<p><!--more-->The Bonsai project helpfully <a href=\"http:\/\/lxr.mozilla.org\/mozilla\/source\/webtools\/bonsai\/dolog.pl?raw=1\" title=\"dolog.pl\">wrote a nice perl script<\/a> which emails check in information in a machine readable format.  To use it:<\/p>\n<ol>\n<li> Check out the CVSROOT module on your CVS server<\/li>\n<li>Copy the perl script into that directory<\/li>\n<li>Add the line: <code>ALL      $CVSROOT\/CVSROOT\/dolog.pl -r \/cvs cvs-watch@stage1.example.com<\/code> to <code>CVSROOT\/loginfo<\/code>\n<ol>\n<li>where <code>\/cvs<\/code> is whatever your cvs path is and <code>stage1.example.com<\/code> is your staging server<\/li>\n<\/ol>\n<\/li>\n<li>Add the <code>dolog.pl<\/code> script, and check in the file and the change to <code>loginfo<\/code>.<\/li>\n<\/ol>\n<p>It&#8217;s simple to make the staging server respond to these emails.<\/p>\n<ol>\n<li>Edit your <code>\/etc\/aliases<\/code> file and add:  <code>cvs-watch:      \"|cvs-robot\"<\/code><\/li>\n<li>Check out your CVS module in the appropriate place<\/li>\n<li>Create <code>\/etc\/smrsh\/cvs-robot<\/code><\/li>\n<\/ol>\n<p>So what goes in the cvs-robot script?<\/p>\n<pre>#!\/bin\/shexport CVSROOT=':pserver:anonymous@cvs.example.com:\/cvs'cd \/var\r\n\r\ntouch \/tmp\/checkin-errors.log\r\n\r\ngrep 'www' | grep '. HEAD .' | cut -d\" \" -f3- | xargs -r cvs update -P -d &amp;&gt; \/tmp\/checkin-errors.log<\/pre>\n<p>This file is only an example.  You&#8217;ll obviously have a different CVSROOT, and you&#8217;ll likely have checked out into a different place than \/var.  Your module might not be &#8216;www&#8217; and your branch might not be HEAD.  Edit as appropriate.<\/p>\n<p><strong>Bugs<\/strong><\/p>\n<p>So what doesn&#8217;t work?  Well, if you add a new directory, this script fails.  I&#8217;m not sure why.  You&#8217;ll need to log onto stage1 and do an update manually to get new directories.  Luckily, adding a directory is usually rare.<\/p>\n<p>The update is checked out using the root account.  I&#8217;m not sure what the security concerns are about doing that, and it&#8217;s possible you may have permissions issues.  You can create a simple wrapper script  that calls the real update command:<\/p>\n<pre>#!\/bin\/shsudo -u apache \/etc\/smrsh\/cvs-robot-real<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s easy to create an automated staging server for content that doesn&#8217;t need to be compiled (like most web content.) The trick is that CVS has a very flexible logging system. All you need to do is have your CVS server send an email on each check in and have the staging server take that\u2026 <span class=\"read-more\"><a href=\"https:\/\/xkahn.zoned.net\/blog\/2007\/03\/22\/howto-creating-an-automated-staging-server-using-cvs\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,3],"tags":[],"class_list":["post-14","post","type-post","status-publish","format-standard","hentry","category-html","category-technology"],"_links":{"self":[{"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/posts\/14","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/comments?post=14"}],"version-history":[{"count":0,"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/posts\/14\/revisions"}],"wp:attachment":[{"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/media?parent=14"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/categories?post=14"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/tags?post=14"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}