如何在Heroku机器上安装Perl的DBI模块 [英] How do I install DBI module for Perl on Heroku machine

查看:135
本文介绍了如何在Heroku机器上安装Perl的DBI模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有我的Ruby-on-rails应用程序,我成功发布到heroku。但是为了填充数据库,我有几个Perl脚本,基本上可以将本地数据库上的表与远程数据库同步。



在我的开发机器上(在ec2上)它工作正常,但我也有很多东西,随着时间的推移我已经安装了它。



当我尝试运行我的脚本时,出现以下错误(最新的perl是按照这种方式安装的)

 无法在@INC中找到DBI.pm(@INC包含:/ etc / perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 / usr / lib / perl5 / usr / share / perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10/usr/local/lib/site_perl。)在copyStaff.pl第4行。
BEGIN失败 - 编译中止在copyStaff.pl第4行。

如何在heroku上安装Perl的DBI模块?
我通过bash尝试了

  apt-get install libdbi-perl 

这给了我一个输出:

  W:不使用锁定只读锁定文件/ var / lib / dpkg / lock 
E:无法写入/ var / cache / apt /
E:无法解析软件包列表或状态文件或打开。

[这可能无关紧要]
我尝试运行此命令

  dpkg --configure -a 

但它告诉我它需要超级用户权限

  su -l root -cdpkg --configure -a 




  • 询问root密码,显然我不知道密码(这不是英雄登录),不知道它可能是什么。



我也直接下载了文件,但我需要超级用户访问。我也试过

  $ perl -MCPAN -e shell 
cpan>安装DBI

(这有同样的问题,无法保存文件)



我有一种感觉,我可能会以完全错误的方式去解决这个问题,但我无法弄清楚我需要做什么来运行这些脚本。






$

b $ b

不幸的是,我们不支持在我们的堆栈中安装额外的库或二进制文件。最好的解决方法是将这些供应商供应到您的项目中。您需要使用64位Linux版本才能在Heroku上运行;静态编译还可以帮助确保包含所需的任何依赖项。同样,对于依赖于外部库的宝石,我们建议静态编译gem并将其销售到您的项目中。



如果您希望尝试供应二进制库,或者宝石,你可以使用Heroku作为你的构建环境。我们的一位工程师创建了一个构建服务器,允许您上传源代码,运行编译步骤,然后下载所产生的二进制文件。你可以在这里找到这个项目:
https://github.com/heroku/vulcan


So I have my Ruby-on-rails app that i successfully released to heroku. However to populate the database I have several perl scripts that basically sync up tables on local database with a remote database.

On my development machine (on ec2) it works fine but I also have a lot of stuff i have installed on it over time.

When I try to run my scripts I get the following error (latest perl is installed by the way)

Can't locate DBI.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at copyStaff.pl line 4.
BEGIN failed--compilation aborted at copyStaff.pl line 4.

How do I install DBI module for Perl on heroku? I tried through bash

apt-get install libdbi-perl

This gave me an output of

W: Not using locking for read only lock file /var/lib/dpkg/lock
E: Unable to write to /var/cache/apt/
E: The package lists or status file could not be parsed or opened.

[This might be irrelevant] I tried to run this command

dpkg --configure -a

But it told me it requires super user privileges

su -l root -c "dpkg --configure -a"

  • asked for root password and apparently I don't know the password (it's not the heroku login), no clue what it might be.

I also downloaded the file directly, but I need super user access. I also tried

$perl -MCPAN -e shell
cpan> install DBI

(this had same problem of not beng able to save the file)

I have a feeling i might be going at it completely the wrong way, but I can't figure out what I need to do to run those scripts.

解决方案

Well I got the answer from customer support, just pasting it here


Unfortunately we don't support installing additional libraries or binaries to our stacks. The best workaround is to vendor these into your project. You'll need to use 64-bit Linux versions to make them work on Heroku; compiling statically can also help ensure that any dependencies needed are included. Similarly, for gems that depend on external libraries, we recommend compiling the gem statically and vendoring it into your project.

If you do wish to try to vendor your binary, library, or gem, you can use Heroku as your build environment. One of our engineers created a build server that allows you to upload source code, run the compilation step, and then download the resulting binary. You can find this project here: https://github.com/heroku/vulcan

这篇关于如何在Heroku机器上安装Perl的DBI模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆