简体   繁体   English

安装 Perl Web 应用程序的最佳系统是什么?

[英]What's the best system for installing a Perl web app?

It seems that most of the installers for Perl are centered around installing Perl modules, not applications.似乎大多数 Perl 安装程序都以安装 Perl 模块为中心,而不是应用程序。 Things like ExtUtils::MakeMaker and Module::Build are very well suited for modules, but require some additional work for Web Apps. ExtUtils::MakeMaker 和 Module::Build 之类的东西非常适合模块,但需要为 Web 应用程序做一些额外的工作。

Ideally it would be nice to be able to do the following after checking out the source from the repository:理想情况下,在从存储库签出源代码后能够执行以下操作会很好:

  • Have missing dependencies detected检测到缺少依赖项
  • Download and install dependencies from CPAN从 CPAN 下载并安装依赖项
  • Run a command to "Build" the source into a final state (perform any source parsing or configuration necessary for the local environment).运行命令将源“构建”到最终状态(执行本地环境所需的任何源解析或配置)。
  • Run a command to install the built files into the appropriate locations.运行命令将构建的文件安装到适当的位置。 Not only the perl modules, but also things like template (.tt) files, and CGI scripts, JS and image files that should be web-accessible.不仅是 perl 模块,还有模板 (.tt) 文件、CGI 脚本、JS 和图像文件等应该可以通过网络访问的内容。
  • Make sure proper permissions are set on installed files (and SELinux context if necessary).确保对已安装的文件(以及 SELinux 上下文(如有必要))设置了适当的权限。

Right now we have a system based on Module::Build that does most of this.现在我们有一个基于Module::Build的系统可以完成大部分工作。 The work was done by done by my co-worker who was learning to use Module::Build at the time, and we'd like some advice on generalizing our solution, since it's fairly app-specific right now.这项工作是由我当时正在学习使用Module::Build的同事完成的,我们需要一些关于概括我们的解决方案的建议,因为它现在相当特定于应用程序。 In particular, our system requires us to install dependencies by hand (although it does detect them).特别是,我们的系统要求我们手动安装依赖项(尽管它会检测到它们)。

Is there any particular system you've used that's been particularly successful?有没有你使用过的特别成功的系统? Do you have to write an installer based on Module::Build or ExtUtils::MakeMaker that's particular to your application, or is something more general available?您是否必须基于Module::BuildExtUtils::MakeMaker 编写特定于您的应用程序的安装程序,或者有更通用的安装程序?

EDIT: To answer brian's questions below:编辑:回答布赖恩的问题如下:

  • We can log into the machines我们可以登录机器
  • We do not have root access to the machines我们没有对机器的 root 访问权限
  • The machines are all (ostensibly) identical builds of RHEL5 with SELinux enabled这些机器都是(表面上)相同版本的 RHEL5,启用了 SELinux
  • Currently, the people installing the machines are only programmers from our group, and our source is not available to the general public.目前,安装机器的人只是我们组的程序员,我们的源代码不向公众开放。 However, it's conceivable our source could eventually be installed on someone else's machines in our organization, to be installed by their programmers or systems people.但是,可以想象,我们的源代码最终可以安装在我们组织中其他人的机器上,由他们的程序员或系统人员安装。
  • We install by checking out from the repository, though we'd like to have the option of using a distributed archive (see above).我们通过从存储库中签出来安装,尽管我们希望可以选择使用分布式存档(见上文)。

The answer suggesting RPM is definitely a good one.建议 RPM 的答案绝对是一个很好的答案。 Using your system's package manager can definitely make your life easier.使用系统的包管理器绝对可以让您的生活更轻松。 However, it might mean you also need to package up a bunch of other Perl modules.但是,这可能意味着您还需要打包一堆其他 Perl 模块。

You might also take a look at Shipwright .你也可以看看Shipwright This is a Perl-based tool for packaging up an app and all its Perl module dependencies.这是一个基于 Perl 的工具,用于打包应用程序及其所有 Perl 模块依赖项。 It's early days yet, but it looks promising.现在还为时尚早,但看起来很有希望。

As far as installing dependencies, it wouldn't be hard to simply package up a bunch of tarballs and then have you Module::Build-based solution install them.至于安装依赖项,简单地打包一堆 tarball 然后让你安装基于 Module::Build 的解决方案并不难。 You should take a look at pip , which makes installing a module from a tarball quite trivial.您应该看看pip ,它使得从 tarball 安装模块变得非常简单。 You could package this with your code base and simply call it from your own installer to handle the deps.您可以将它与您的代码库一起打包,然后只需从您自己的安装程序中调用它来处理 deps。

I question whether relying on CPAN is a good idea.我质疑依赖 CPAN 是否是一个好主意。 The CPAN shell always fetches the latest version of a distro, rather than a specific version. CPAN shell 总是获取发行版的最新版本,而不是特定版本。 If you're interested in ensuring repeatable installs, it's not the right tool.如果您对确保可重复安装感兴趣,这不是正确的工具。

What are your limitations for installing web apps?您安装 Web 应用程序有哪些限制? Can you log into the machine?你能登录机器吗? Are all of the machines running the same thing?所有机器都运行相同的东西吗? Are the people installing the web apps co-workers or random people from the general public?安装网络应用程序的人是同事还是普通大众中的随机人? Are the people installing this sysadmins, programmers, web managers, or something else?安装此系统的人是系统管理员、程序员、网络管理员还是其他人? Do you install by distributed an archive or checking out from source control?您是通过分发存档还是从源代码管理中签出来安装?

For most of my stuff, which involves sysadmins familiar with Perl installing in control environments, I just use MakeMaker .对于我的大部分内容,包括熟悉在控制环境中安装 Perl 的系统管理员,我只使用MakeMaker It's easy to get it to do all the things you listed if you know a little about MakeMaker .如果您对MakeMaker有所了解,就很容易让它完成您列出的所有事情。 If you want to know more about that, ask a another question.如果您想了解更多信息,请提出另一个问题。 ;) Module::Build is just as easy, though, and the way to go if you don't already like using MakeMaker . ;) Module::Build也同样简单,如果您不喜欢使用MakeMaker ,这是一种方法。

Module::Build would be a good way to go to handle lots of different situations if the people are moderately clueful about the command line and installing software.如果人们对命令行和安装软件有一定的了解, Module::Build将是处理许多不同情况的好方法。 You'll have a lot of flexibility with Module::Build , but also a bit more work.使用Module::Build将有很大的灵活性,但也需要做更多的工作。 And, the cpan tool (which comes with Perl), can install from the current directory and handle dependencies for you.而且, cpan工具(Perl 附带的)可以从当前目录安装并为您处理依赖项。 Just tell it to install the current directory:只需告诉它安装当前目录:

 $ cpan .

If you only have to install on a single platorm, you'll probably have an easier time making a package in the native format.如果您只需要在单个平台上安装,您可能会更轻松地以本机格式制作软件包。 You could even have Module::Build make that package for you so the developers have the flexibility of Module::Build , but the installers have the ease of the native process.您甚至可以让Module::Build为您制作该包,以便开发人员拥有Module::Build的灵活性,但安装人员可以轻松地进行本机过程。 Sticking with Module::Build also means that you could create different packages for different platforms from a single build tool.坚持使用Module::Build还意味着您可以从单个构建工具为不同平台创建不同的包。

If the people installing the web application really have no idea about command lines, CPAN, and other things, you'll probably want to use a packager and installer that doesn't scare them or make them think about what is going on, and can accurately report problems to you automatically.如果安装 web 应用程序的人真的不知道命令行、CPAN 和其他东西,你可能想要使用一个不会吓到他们或让他们思考正在发生的事情的打包程序和安装程序,并且可以自动准确地向您报告问题。

As Dave points out, using a real CPAN mirror always gets you the latest version of a module, but you can also make your own "fake" CPAN mirror with exactly the distributions you want and have the normal CPAN tools install from that.正如 Dave 指出的那样,使用真正的 CPAN 镜像总是能让您获得模块的最新版本,但您也可以使用您想要的发行版制作自己的“假”CPAN 镜像,并从中安装普通的 CPAN 工具。 For our customers, we make "CPAN on a CD" (although thumb drives are good now too).对于我们的客户,我们制作了“CD 上的 CPAN”(尽管现在拇指驱动器也很好)。 With a simple "run me" script everything gets installed in exactly the versions they need.使用简单的“run me”脚本,所有内容都可以安装在他们需要的版本中。 See, for instance, my Making my own CPAN talk if you're interested in that.例如,如果您对此感兴趣,请参阅我的 Make my own CPAN 演讲。 Again, consider the audience when you think about that.再次,当您考虑这一点时,请考虑观众。 It's not something you'd hand to the general public.这不是你会交给公众的东西。

Good luck, :)祝你好运, :)

I'd recommend seriously considering a package system such as RPM to do this.我建议认真考虑使用 RPM 等软件包系统来执行此操作。 Even if you're running on Windows I'd consider RPM and cygwin to do the installation.即使您在 Windows 上运行,我也会考虑使用 RPM 和 cygwin 进行安装。 You could even set up a yum or apt repository to deliver the packages to remote systems.您甚至可以设置一个 yum 或 apt 存储库来将软件包交付到远程系统。

If you're looking for a general installer for customers running any number of OSes and distros, then the problem becomes much harder.如果您正在为运行任意数量的操作系统和发行版的客户寻找通用安装程序,那么问题就会变得更加困难。

Take a look at PAR .看看PAR

Jonathan Rockway as a small section on using this with Catalyst in his book. Jonathan Rockway 作为在他的书中使用 Catalyst 的一小部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM