calacode has asked for the wisdom of the Perl Monks concerning the following question:

We developed Perl software that is used by a growing number of clients.

Although we are having a problem upgrading existing clients to our new product version.

Since our software is developed 100% in Perl, we were hoping to design a simple 'source-patch' script that connects to our site, and downloads the new perl modules/scripts and upgrades the clients copy.

The user could use a simple WebAdmin page, click a submit button, and the process starts. The process could also be automated via Cron.

My question, has anyone created a similar program for maintaing source over multiple servers?

We want to make the upgrade process to our new versions as easy as possible.

I'm thinking to use the GNU patch utility or CVS, although I'd love to hear some PerlMonk suggestions.


.:. lifeaway.com - Taking the biz on the road, wireless in Australia via 4WD .:.
  • Comment on Keeping code up2date over multiple servers

Replies are listed 'Best First'.
Re: Keeping code up2date over multiple servers
by atcroft (Abbot) on Sep 17, 2002 at 13:37 UTC

    An interesting problem and idea. I experience a similar problem internal to the company I work for, where some of the same modules are used on different servers, and must be kept in sync. I am still looking for a good solution.

    In terms of your comments, a few comments came to mind.

    First, you will have to make sure that you upgrade the entire set of programs at one shot, or that all of the pieces you upgrade are 100% backward compatible. You may want to make a way to regress back to the previous version after an upgrade, such as by making a backup at the outset of the process, just in case (and report such action back, so you can be aware that a problem occurred and can contact them for additional information and to offer assistance).

    As to the actual update, CVS, patch, and rsync, come to mind, but I would suspect CVS would be most useful in this case. (I'm not an expert in any of the three, so I may be wrong here.) It is my understanding that you can create a branch in the code with a particular name, such as "current," that you could cause the update client to always pull from. You might look at the VCS::* modules on CPAN to help in interacting with CVS. Rsync might work, but my understanding of it is that it would replace entire files, so any customizations would have to be kept in files that would not be modified, although you could perhaps use it for just grabbing the patches, then using the patch command or something. (You could perhaps also write a webclient using LWP to retrieve the data, although rsync can do some data compression along the way, iirc.)

    The only other issue I see is that the code for pulling the update must be capable of writing into the program tree, which is perhaps a little scary due to potential security implications-and assuming that the product in question is related to web pages or CGIs, that could be very scary indeed. Perhaps an alternative would be the web admin page creating a flag (say, by updating a value in a file or database), and a seperate program run as a cron job to look for that flag and initiate the process, thereby making it unnecessary for the web administration tool to have to write to the location where the applications are stored.

    Again, these were just a few thoughts that flashed across my neurons as I read your posting. I would be interested to hear how your search for such a system turns out. Best of luck.

      Thanks for your reply mate, greatly appreciated.

      I think CVS may be leading down the right path. I am in the process to checkout the Perl Modules available.

      Would be great to have LWP download the patchs automatically via cron; I like the patch utility, but I am not sure it is available on all Unix systems by default. A pure Perl solution would be the best.

      Didn't Larry write the patch utility? It's probably ported to Perl anyway!

      One problem is if a user edits a file, e.g adds their own small customization, pathname, config path , etc. Would be handy to use 'fuzzy' MD5 checksums on the files, to see which ones do not match with the current version.

      Once finished, I will be sure to post the code.

      .:. LifeAway.com - Perl coders on the road, in Australia via 4WD .:.
Re: Keeping code up2date over multiple servers
by neilwatson (Priest) on Sep 17, 2002 at 13:37 UTC
    However you plan on copying the code you should consider using ssh or even rsync via ssh. Efficient and secure.

    Neil Watson
    watson-wilson.ca

Re: Keeping code up2date over multiple servers
by waswas-fng (Curate) on Sep 17, 2002 at 16:12 UTC
    Take a look at CPAN.pm you can set up a "local customized" cpan server and it has most of what you need to do revision control, dependancies, MD5 checksums and multiple delivery options etc.

    -Waswas-fng
Re: Keeping code up2date over multiple servers
by samurai (Monk) on Sep 17, 2002 at 15:07 UTC
    Believe me, do not roll your own utility. Use cron/at and CVS. CVS was BUILT for this. Don't reinvent a cracked wheel. Use CVS (you can tie in SSH with CVS a-la sourceforge for added security).

    --
    perl: code of the samurai

Re: Keeping code up2date over multiple servers
by pope (Friar) on Sep 18, 2002 at 13:07 UTC
    I think it depends on who are using your Perl software. If they're also developers, I think they will find no problem using CVS, and you don't need to roll your own "remote update facilities".

    But if it is used by end users, I mean those who aren't familiar with programming tools such as CVS and won't bother taking time to learn using it, then it's time for you to create such thing. Admittedly, CVS is overkill for this purpose.

    I remember using a program called smssend which has -update option, a cool feature which allows users to update the currently installed software. It's very reasonable to provide this feature since the software contains many scripts which may be updated at any time, and maintained by different persons. So a small but important change to any of the script doesn't require a new release of the software, but users can just run it with the -update option.

    Update
    I missed your point about using CVS behind the scene. If what left to users is just a submit button, then that will be fine. But using external programs or modules which depends on external programs/libs assumes the availability of the external things.