<br><br><div class="gmail_quote">2010/3/30 Tomáš Znamenáček <span dir="ltr">&lt;<a href="mailto:tomas.znamenacek@gmail.com">tomas.znamenacek@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
I have a Catalyst application that I would like to upload from the<br>
development box to the production server. Is there some kind of best<br>
practice to do that? My requirements:<br></blockquote><div><br></div><div>I don&#39;t think there&#39;s any standard approach.  I know many people seem to just do a checkout from the repository.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


1) The process should take care of the dependencies and run the tests<br>
   before installing. (Let’s say the deps are declared in Makefile.PL<br>
   or Build.PL.)<br></blockquote><div><br></div><div>I have a separate cron job that polls the repository looking for changes.  When it notices that a new version has</div><div>been checked in it checks it out and runs the full test suite. A big fat email goes out if test do not pass.  If it passes, but a previous run failed an email also goes back congratulating everyone on fixing the problem.</div>

<div><br></div><div>This works well because the same process can be used on multiple applications and is constantly running -- not just when it&#39;s crunch time to push a release.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


2) It would be nice to keep the application isolated in one directory<br>
   so that I can keep several instances under the same account to do<br>
   primitive staging.<br></blockquote><div><br></div><div>Agreed. </div><div><br></div><div>I have a separate build process.  This is a simple process and doesn&#39;t run any tests (because the build process may happen</div>

<div>on a &quot;build server&quot; w/o dependencies needed by the application).</div><div><br></div><div>This simply does an svn export, then it runs build/build_app.sh which then runs whatever scripts are needed to build that specific application.  For example, minify and combine css and javascript, etc.</div>

<div><br></div><div>Then a tarball is built of this export (named after the application and version) and made available on a web server.</div><div><br></div><div>This can then be &quot;pushed&quot; to any server.  The push process simply fetches the tarball from the build web server, unpacks it into it&#39;s version-specific directory and runs the Makefile to test for dependencies on the target machine.  If that passes a symlink is updated to point to this new version and the web server is restarted.</div>

<div><br></div><div>The symlink makes it easy to revert to a previous version or to have multiple versions on the same machine for testing.</div><div><br></div><div>The applications have separate YAML files for different environments.  There might be &quot;dev.yml&quot;, &quot;testing.yml&quot;, &quot;qa.yml&quot;, and &quot;produciton.yml&quot;.  Each machine has a file in /etc/&lt;$app_name&gt; that sets what environment the application should start in (i.e. what YAML config file to use).  Push to testing and the app starts and uses the testing database as configured in testing.yml.</div>

<div><br></div><div>I&#39;ve used this method for pushing directly to production, but in other cases use it for staging and then rsync to production servers from staging.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
I’ve read something about local::lib, but I’m still not sure about how<br>
to put things together. This has to be a common scenario, isn’t it? When<br>
you are finished updating the development version, what do you call to<br>
upload the update to the production server and what exactly happens<br>
along the way?<br></blockquote><div><br></div><div>Good question.   Hopefully someone has a great solution.</div><div><br></div><div>In the past I&#39;ve used cfengine to make sure machines have the right dependencies.</div>

<div><br></div><div>I&#39;ve also used a local lib and rsynced that and messed with @INC and PERL5LIB, which doesn&#39;t make me happy. (Think about init.d scripts, cron jobs, etc.)</div><div><br></div><div>The next approach is to build packages (deb or rpm) of the application and dependencies and let the OS package manager handle it all.  The goal there, besides making it easy for deployment, is to break out common code shared by apps into libraries.  </div>

<div><br></div><div>That said, there is something to be said with throwing everything in the application&#39;s lib directory since you know when it&#39;s pushed you will have exactly the same code used in development.  Lot easier to revert when everything is under a a single symlink.</div>

<div><br></div><div>I&#39;ve heard of people that build an entire Perl installation and keep that separate from the OS installed Perl.</div><div><br></div><div> </div></div>-- <br>Bill Moseley<br><a href="mailto:moseley@hank.org">moseley@hank.org</a><br>