{"id":22,"date":"2007-05-19T13:30:10","date_gmt":"2007-05-19T19:30:10","guid":{"rendered":"http:\/\/blogs.cae.tntech.edu\/mwr\/2007\/05\/19\/client-application-management-part-2-for-stow-packages\/"},"modified":"2024-10-27T14:26:19","modified_gmt":"2024-10-27T14:26:19","slug":"client-application-management-part-2-for-stow-packages","status":"publish","type":"post","link":"https:\/\/sites.tntech.edu\/renfro\/2007\/05\/19\/client-application-management-part-2-for-stow-packages\/","title":{"rendered":"Client Application Management (Part 2, for stow packages)"},"content":{"rendered":"<p><strong>UPDATE:<\/strong> this page largely superceded by <a href=\"http:\/\/blogs.cae.tntech.edu\/mwr\/2008\/02\/01\/the-autostow-is-dead-long-live-stowedpackage\/\">the stowedpackage puppet definition<\/a>.<\/p>\n<p>Back in <a href=\"http:\/\/blogs.cae.tntech.edu\/mwr\/2007\/05\/14\/client-application-management\/\">part 1<\/a>, I outlined how I&#8217;m getting a consistent package load on my various hosts with pkgsync and puppet. This works great for things that are already included in Debian. And I&#8217;ll make .deb packages of some of our third-party commercial applications, too (Matlab, Abaqus, Ansys, etc.), mostly for the ease of running &#8216;apt-get install matlab74&#8217; or making one entry into a pkgsync definition. But some things are more of a pain to package up, and it&#8217;s easier to let them install into \/usr\/local. But since I don&#8217;t want \/usr\/local to become an unmanageable mess, I&#8217;ve been using <a href=\"http:\/\/www.gnu.org\/software\/stow\/\">GNU Stow<\/a> to manage it. The basics of stow is that a package (for example, <a href=\"http:\/\/www.clusterresources.com\/pages\/products\/torque-resource-manager.php\">Torque<\/a>) that wants to install into \/usr\/local instead gets installed into \/usr\/local\/stow\/torque-2.1.6, and stow symlinks from \/usr\/local\/sbin\/pbs_mom to \/usr\/local\/stow\/torque-2.1.6\/sbin\/pbs_mom, and for all other files and directories contained in all your stowed packages.<\/p>\n<p>So I needed a way to ensure that a particular set of packages was deployed consistently to a set of machines, and minor modifications to <a href=\"http:\/\/www.debian-administration.org\/articles\/398\">autoapt<\/a> seemed to be the easiest and most robust way to go at the time. Details after the jump.<!--more--><\/p>\n<p>External files needed:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.cae.tntech.edu\/~mwr\/private\/autostow.pl\">autostow.pl<\/a><\/li>\n<li><a href=\"http:\/\/www.cae.tntech.edu\/~mwr\/private\/autostow.cfg\">autostow.cfg<\/a><\/li>\n<\/ul>\n<p>My changes to autoapt aren&#8217;t rocket science: basically I just removed the logic for version checking (since my naming convention for stowing packages automatically includes their version number) , changed the external commands from apt-get to stow, and added support for prerm and postinst scripts for each stowed package. Also, to trigger a restowing via puppet, rather than by cron job or manually, I&#8217;m adapting <a href=\"http:\/\/www.reductivelabs.com\/trac\/puppet\/wiki\/DebianRecipies\">the method for triggering apt-get dist-upgrades via puppet<\/a>.<\/p>\n<p>Puppetmaster configuration: install rsync as a daemon. Though if you want to use a different server for rsync, that&#8217;s fine, too. My stow tree isn&#8217;t too large, and I&#8217;d just as soon have it managed off the same system that runs puppetmaster. My \/etc\/rsyncd.conf contains:<\/p>\n<pre>[metastow]\npath = \/usr\/local\/metastow\nhosts allow = 149.149.254.0\/24\nhosts deny = *\nread only\nuid = 0<\/pre>\n<p>The read only is a safety precaution, and uid = 0 is required so that I can retrieve items that are on root-only permission (Torque&#8217;s pbs_mom, for example).  The metastow directory itself contains folders for each managed hardware architecture (currently i686 and x86_64), and each of the architecture folders holds the stowed directories, plus prerm and postinst scripts if applicable:<\/p>\n<pre>\ngold:\/usr\/local\/metastow\/x86_64# ls -ald torque-2.1.6*\ndrwxr-sr-x 7 root staff 4096 Apr 13 09:14 torque-2.1.6\n-rwxr-xr-x 1 root staff   34 Apr 30 11:13 torque-2.1.6.postinst\n-rwxr-xr-x 1 root staff   36 Apr 30 11:12 torque-2.1.6.prerm<\/pre>\n<p>Puppet configuration: I have a class of parallel computing systems that need Torque and <a href=\"http:\/\/ganglia.info\/\">Ganglia<\/a> installed. In their class definition:<\/p>\n<pre>\nclass cluster-host inherits cae-host {\n  file { \"\/etc\/stow_initiator\":\n    source =&gt; \"puppet:\/\/gold.cae.tntech.edu\/files\/stow_initiator\",\n  }\n  file { \"\/etc\/puppet\/autostow.pl\":\n    source =&gt; \"puppet:\/\/gold.cae.tntech.edu\/files\/autostow.pl\"\n  }\n  file { \"\/etc\/puppet\/autostow.cfg\":\n    source =&gt; \"puppet:\/\/gold.cae.tntech.edu\/files\/autostow.cfg\"\n  }\n  exec { \"rsync -avz --delete gold.cae.tntech.edu::metastow\/$hardwaremodel\/ \/usr\/local\/stow\/ ; \/etc\/puppet\/autostow.pl --filename=\/etc\/puppet\/autostow.cfg --classes=cluster_host\":\n    refreshonly =&gt; true,\n    subscribe =&gt; File[\"\/etc\/stow_initiator\"],\n  }\n}<\/pre>\n<p>The $hardwaremodel variable is automatically defined by Facter if you have the lsb-release Debian package installed. The top-level cae-host class automatically installs it via pkgsync, but just to be safe, I&#8217;ll probably add it to my minimal list of preseeded packages for system installation. That way, I know my definitions will all work right out of the box.<\/p>\n<p>Test out your stow packages before deploying them into the metastow tree. In particular, make sure they don&#8217;t conflict with anything already in \/usr\/local &#8212; at the time I built my i686 torque packages under Sarge, \/usr\/local\/man was an acceptable folder. Etch symlinked \/usr\/local\/man to \/usr\/local\/share\/man, and as a result, my torque package wouldn&#8217;t deploy under Etch.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UPDATE: this page largely superceded by the stowedpackage puppet definition. Back in part 1, I outlined how I&#8217;m getting a consistent package load on my various hosts with pkgsync and puppet. This works great for things that are already included in Debian. And I&#8217;ll make .deb packages of some of our third-party commercial applications, too &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/sites.tntech.edu\/renfro\/2007\/05\/19\/client-application-management-part-2-for-stow-packages\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Client Application Management (Part 2, for stow packages)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":87,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,7,16],"tags":[],"class_list":["post-22","post","type-post","status-publish","format-standard","hentry","category-cfengine","category-infrastructures","category-puppet","entry"],"_links":{"self":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/posts\/22","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/users\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/comments?post=22"}],"version-history":[{"count":1,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/posts\/22\/revisions"}],"predecessor-version":[{"id":499,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/posts\/22\/revisions\/499"}],"wp:attachment":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/media?parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/categories?post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/tags?post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}