Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: What are all the possible ways to deploy Perl code on multiple servers?

by saberworks (Curate)
on Jul 19, 2011 at 22:05 UTC ( [id://915548]=note: print w/replies, xml ) Need Help??


in reply to What are all the possible ways to deploy Perl code on multiple servers?

I've done it the following two ways at different jobs.

1. We packaged perl and all deps, plus all cpan modules (and their deps) from source as RPM files that would be built on 3 different operating systems (rh enterprise linux, solaris, and osx). We shipped the RPMs to our customers when a release was cut (either on CD or electronically). It was built using make so if you changed/updated any of the package sources it would recompile it plus everything that depended on it. It was a hassle to maintain at first (I inherited it from a previous employee) but once I worked out the kinks it was very reliable and our customers liked it. It made upgrades pain-free (from their perspective).

2. At my current job we decided to use the "standard perl" on ubuntu 10.04 LTS. I mirrored the ubuntu repo and we use apt to manage all the packages across our servers. Basically we programmed against what's in the official repo and we only update our mirror after we test any package changes. The drawback here is that there are some modules that aren't in the ubuntu repo or that are too out of date to be useful. In these cases, I build custom .deb packages and put them on a separate repo (which is also included in each server's sources.list). Then there's a "my_dependencies.deb" package which gets installed that lists all our custom packages plus all the ones in the ubuntu mirror that we need. It's been working very well so far and it's much less work than maintaining all the packages ourselves.

Granted, "standard perl" on Ubuntu 10.04 LTS is out of date but we don't really miss any of the new features.
  • Comment on Re: What are all the possible ways to deploy Perl code on multiple servers?

Replies are listed 'Best First'.
Re^2: What are all the possible ways to deploy Perl code on multiple servers?
by chrestomanci (Priest) on Jul 20, 2011 at 08:41 UTC

    I would be interested to know how you built the costom deb for the modules that are not in the Ubuntu repo? Did you package them nicely in a debian approved way, or was it more of an ugly package of everything, similar to how I described above?

    If you did make your deb packages nicely can you share some more details or scripts on how you did it?

      I create .deb packages of each module and they're hosted on a web server with a Packages.gz file (which is generated using some command). I did it by hand (found a tutorial online) until I found dh-make-perl as i5513 mentioned. It works pretty well.

      For the "dependencies" deb file (the one that lists all the packages required for our servers, both from the official repo mirror and our package list) I created it by hand. Essentially you just have to create a debian CONTROL file and then run some dpkg commands on it. I can post more details when I get to work and take a look. It's one of those things that works and we only touch when we need a new module.

      Update: Okay here are some instructions...

      $ export DEBFULLNAME="<your_name>" $ export DEBEMAIL="<your_email>"
      1. Go to search.cpan.org, search for the package, click the one you want, and right-click the Download link and click Copy Link Location. For this example I'm going to use http://search.cpan.org/CPAN/authors/id/K/KI/KILINRAX/HTML-Strip-1.06.tar.gz
      2. Make a directory for your package.
        $ mkdir HTML-Strip
      3. Change to that directory
        $ cd HTML-Strip
      4. Download the package
        $ wget http://search.cpan.org/CPAN/authors/id/K/KI/KILINRAX/HTML-Str +ip-1.06.tar.gz
      5. Unzip the package
        $ tar xvfz HTML-Strip-1.06.tar.gz
      6. Configure/build the package
        $ dh-make-perl -p my-libhtml-strip-perl --build HTML-Strip-1.06
      7. Now your project directory should have the following:
        drwxr-xr-x 4 4096 2010-04-13 20:34 HTML-Strip-1.06 -rw-r--r-- 1 7764 2006-02-10 11:27 HTML-Strip-1.06.tar.gz -rw-r--r-- 1 17912 2010-04-13 20:35 my-libhtml-strip-perl_1.06-1_i386. +deb
      8. Check to make sure you can install the package
        $ sudo dpkg -i my-libhtml-strip-perl_1.06-1_i386.deb
      9. Make sure you can "use" the module
        $ perl -mHTML::Strip -e 1
      Once you have the .deb package you need to host it on a web server somewhere and you need to generate a Packages.gz so apt/etc. knows about each package.

      Assuming you put all your .deb files in a folder called binary/ you run:
      dpkg-scanpackages binary /dev/null | gzip -9c > Packages.gz
      Now you have a folder called binary/ with a bunch of .deb files in and a Packages.gz with a list of those files. You can edit our /etc/apt/sources.list to add your repo like this:
      deb http://<your_url>/ /

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://915548]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-04-19 08:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found