http://www.perlmonks.org?node_id=11107724

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

Hi there.

Can someone explain, how to deliver some perl application to a client? For example, my client has own VPS. Should I write instruction about installing "perlbrew", "cpanm", etc...? How to create equal testing area on dev machine and on client's machine? Is there the best way to deliver an application to production?

  • Comment on How to deliver a perl application to a client?

Replies are listed 'Best First'.
Re: How to deliver a perl application to a client?
by daxim (Curate) on Oct 20, 2019 at 17:57 UTC
    Is there the best way to deliver an application to production?
    There are many ways. The more effort you put into it, the less effort your client needs to expend in order to install your software. The ideal way is creating packages, e.g. rpm or deb; that way everything is downloaded, installed and configured with just a single command, and you get update infrastructure for free.

    I am both a programmer and a packager and have written a couple of times about that topic. You need to tell me about the specifics of the Perl application and the operating system on the production system for further information.

    Packaging is an order of magnitude less difficult than programming, semi-automatic most of the time and on popular platforms your dependencies are already packaged.

    How to create equal testing area on dev machine and on client's machine?
    Don't do that. You run the test system. It is set up as similar to the production system as possible.
      ### You need to tell me about the specifics of the Perl application and the operating system on the production system for further information.

      System: FreeBSD or some Linux (depends on client).

      My script will collect and store data. It can be run both via cron and as service.

        I have read the sibling comment thread. Using perlbrew/cpanm on the production system is not a good idea, IMO.
        • They are tools geared toward development; they are easy to use for you, the developer, but annoying for the end user.
        • perlbrew/cpanm take a huge amount of time to install, compared to just a few seconds with a binary package.
        • If something goes wrong with perlbrew/cpanm, the client has no idea how to fix it.
        • Offline installation is straight-forward with a binary package, but complicated with perlbrew/cpanm, you'd need to ship some sort of minicpan.

        I don't have experience with FreeBSD. Found instructions: http://lastsummer.de/creating-custom-packages-on-freebsd/

        I need to know the Linux distro so I can also link you to the appropriate Web site. Meanwhile I'm going to assume you're targetting deb/rpm and systemd, that already covers a lot of what's running out there in the wild.

        Create new user for executing the application
        What purpose does it serve? Can't the software run just under a normal user account, like 97% of the other packages on any ordinary system?

        It can be run both via cron and as service.
        You achieve this simply by shipping a .timer file and corresponding .service file as part of the package. There are many tutorials, I like https://wiki.archlinux.org/index.php/Systemd/Timers. Also see /usr/lib/systemd/system/* for local examples.
Re: How to deliver a perl application to a client?
by marto (Cardinal) on Oct 20, 2019 at 17:44 UTC

    Best you spin up a system or VM, try to match the target system as close as you can, same OS, same perl version etc. As far as delivering your app goes, perhaps you could package it using pp or similar, or instruct them on installing cpanm using their OS package manager, and provide a cpanfile listing your apps perl dependencies (a quick start guide here). If you describe the situation in more detail perhaps it'd help to guide you better.

      Thanks for answer.

      I'm working on a scraper using Web::Scraper

      It will be small script. But, the predictability of the behavior of this script at the customer side is very important.

      My solution is to write a bash-script that will do:

      1. Create new user for executing the application (on client's machine).

      2. Install "perlbrew" and "cpanm" (under new user rights).

      3. Install correct Perl version (under perlbrew for this new user).

      4. Install (via cpanm) all Perl modules for my project (correct version).

      5. Extract my application.

      6. Perform test run and show results.

      Is it correct way?

        Sounds like really low dependencies, no need to install your own perl with perlbrew. Either package or make it easy for them to install the module. An OS package is probably overkill here.
Re: How to deliver a perl application to a client?
by holli (Abbot) on Oct 20, 2019 at 20:05 UTC
    Docker is a good way for app deployment. Ask your client wether they are using already. Chances are they do.


    holli

    You can lead your users to water, but alas, you cannot drown them.
Re: How to deliver a perl application to a client?
by afoken (Chancellor) on Oct 21, 2019 at 18:03 UTC

    See also How do you distribute your Perl application to your customers?

    Alternatively, look at Bugzilla: It comes with a checksetup.pl script that simply checks if all required modules are installed, and complains about missing ones. It also provides an install-module.pl script that will try to install modules. The documentation explains what is needed and how to get it on the target system. Yes, this is a manual process, but it should work on any system.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      Thank you and everyone else who responded. You really helped me figure this out.

Re: How to deliver a perl application to a client?
by salva (Canon) on Oct 24, 2019 at 11:36 UTC
    I have not put too much effort into Win32::Packer lately, but still it provides an easy way for packing Perl applications for Windows.
Re: How to deliver a perl application to a client?
by harangzsolt33 (Chaplain) on Oct 21, 2019 at 00:39 UTC
    Delivering a perl application to a client? Why is this so hard? Can't you just compress the entire application into a zip file and upload it to a website, then send your client the web address, and when he clicks on it, it will download. Then he just unzips the whole thing and use it. What's so difficult about this?
      What's so difficult about this?

      In a word: *nix.

      Your experience is Windows which runs essentially on a single processor type where to a reasonable extent the same binary will run on most machines. *nix applications live in a vastly different world where the processor and many aspects of the operating system mean that applications typically need to be built for the target system. It isn't generally as simple as "ship the executable" in the *nix world. Pure Perl applications have a reasonable chance of working across systems, but as soon as a module using compiled code is added to the mix things tend get complicated.

      Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

        Not to mention that some distros, even if they receive security updates, use very, *very* outdated libraries you have to compile against. I'm not going to point fingers, but it starts with "d" and ends with "ebian". It's a bit like having to support Windows XP in 2019.

        perl -e 'use MIME::Base64; print decode_base64("4pmsIE5ldmVyIGdvbm5hIGdpdmUgeW91IHVwCiAgTmV2ZXIgZ29ubmEgbGV0IHlvdSBkb3duLi4uIOKZqwo=");'
      youve clearly never delivered an application to a client
        Well, I have only delivered an application to one client one time. So, you're close. Lol It was a perl program that had to change a few characters on a website. There was a link on her website, and she wanted to change the link every now and then. She wanted an easy way to do it from her computer without having to use an FTP program. So, I wrote a simple perl program that did the job. :-) She lived in another city, so I had to send her the link. All she had to do was enter a password, paste the URL in the text box and press "Submit."

        And I must say I was quite proud of that. That was the first perl program I produced that actually did something practical and useful. Lol