clt60
clt60

Reputation: 63932

Installing an perl based web-app in extremely restricted environment

Because i have a long series of comments with @ikegami, I cleaning up the question, in a hope it will be more understandable. Unfortunately, english isn't my "main" language. :(

Let say, having an environment where:

The MyApp

The main question is: how to prepare the MyApp, and the all used CPAN-modules, to be easily installed in such restricted environment?

The goal is:

E.g. how to get an running web-app to the user's machine with minimum possible (his) steps. - the simplest thing is could be something as: - copy one file (zip, or tarbal) - unpack it - from the terminal execute some run.pl in the unpacked directory.

To get the above simple installation, my idea was the following:

1.) Create an tarball, and after the unpacking will contain 3 folders and 1 perl-script, let say:

myapp_repo/
myapp_repo/distlib   #will contain all MyApp's perl modules also ALL used CPAN modules and their dependecies
myapp_repo/datafiles #will contain app-specific data files and such
myapp_repo/install.pl
myall_repo/lib   #will contain modules directly used by the `install.pl`

2.) I will develop an install.pl script, and it will be used as the installer-tool, like

perl install.pl new /path/to/app_root

and it will (should):

3.) So, after this the user should be able to simply run:

/path/to/app_root/bin/plackup /path/to/app_root/bin/app.psgi

In short, the user should use:

E.g. the install.pl should somewhat call internally the cpanm to achieve (as equivalent) for the following cpanm command

cpanm --mirror file://path/to/myapp_repo/distlib --mirror-only My::App

which, should install My::App and all dependencies without network access using only the files from the myapp_repo/distlib

Some questions:

@ikegami suggesting some method: - "install everything" in one fresh-directory on my machine - transfer this self-contained directory to the target machine

It sound very good, because this directory could contain all the needed app-specific data-files too, unfortunately, I don't understand the details how his solution should be done.

The FatPacked solution looks interesting too - need learn about it.

Upvotes: 4

Views: 176

Answers (1)

ikegami
ikegami

Reputation: 385917

Don't write your own make or installer. Just copy it make from a different machine (which is basically what apt/yum/etc do anyway, and which you'd have to do even if you wrote your own). You'd be able to use cpan in 5 minutes!

Also, that should allow you to install gcc if you need it (e.g. to install an XS module), although it doesn't sound like you do. If you do install gcc, I'd install my own perl to avoid having to deal with PERL5LIB.

Tools such as minicpan will allow you to install any module from CPAN without internet access. Of course, you can keep using the command you are already using it if mirrors the packages you need.


The above explains how to simply and quickly setup a machine so it can use cpan and thus install any module easily.

If you just want to install a specific module and its dependencies, you can completely avoid using cpan on the target machine. First, you need a fresh install of Perl (preferable of the same version as the one on the target system). Then, simply install the module to a fresh dir on your machine, and transfer that dir to the target machine. That's it; nothing else needs to be done. This even works for XS modules if the two machine are similar enough.

This is what ppm (ActiveState's Perl package manager) does.

Unfortunately, while this solution is almost as simple as the one above, it's not nearly as flexible, it doesn't run the test suite of the modules being installed, etc. It does have the advantage of not requiring the transfer of any binary (if you're not installing any XS modules).

Upvotes: 1

Related Questions