Operating perl applications as a non perl programmer

I’ve used

cpanm --installdeps .

To install all perl module dependencies for a perl application we’re running, when trying to deploy the same app on other servers the application doesn’t work, even though I’m using the same version of perl and following the same steps for installing perl modules. (sigh)
I’m suspecting there could be some problem with newer versions of perl modules ’cause the perl code itself is rsync’ed from the working server .
Here’s how you could create an autobundle package in perl, and use cpan to install the same modules in an other environment / server .

# on the working server:
perl -MCPAN -eautobundle
Wrote bundle file
    /path/to/cpan/.cpan/Bundle/Snapshot_2012_10_04_01.pm

Now copy the […].cpan/Bundle/Snapshot_2012_10_04_01.pm to the new server / instance, put it in […].cpan/Bundle/ and issue

perl -MCPAN -e 'install Bundle::Snapshot_2012_10_04_01'

Notice: leaving out the .pm file extension when referring to the Snapshot .
Oh, and by the way
How do I list all installed perl modules ? :

cpan -l

That’s not really intuitive when you’re not a perl programmer, I’ve always started up cpan in interactive mode, haven’t figured out that one before.
Also try:

perldoc -q installed

While you’re at it, it mentions cpan -a as well, which makes that Snapshot file .
Thank you gugod.org

FreeBSD install-message file

If you, like me, install gnome2 or any other package in FreeBSD which will pull in a lot of dependencies, you’ll notice that some packages list important messages when installing… When I install gnome2 on my new workstation, I see those messages fly by and don’t get to read the whole message because the pkg_add command is working a lot faster than I can read … pkg_info -D [pkgname] will list the install-message file for [pkgname], and you could list the install-message file for all of your installed packages with for instance: (BASH syntax)

# pkg_info | awk '{ print $1 }' | xargs pkg_info -D

Using Apache as a proxy in conjunction with the Apache alias directive

When using ProxyPass in apache, it won’t obey any aliases. Apachectl configtest won’t complain, so you could end up messing around with this for a while (like I did) . For example:

[...]
Alias /foo /absolute/path/to/foo
ProxyPass / localhost:8080
[...]

In the example above the alias directive wont have anything to ‘say’. In my access.log I noticed this when clients trying to access stuff from the alias’ed dir got a 404 .
You can fix this easily by:

Alias /foo /absolute/path/to/foo
ProxyPass /foo !
ProxyPass / localhost:8080

you’re simply telling apache not to oproxy /foo 🙂
Thank you mail-archives.apache.org and httpd.apache.org mod_proxy documentation.

Redmine 1.4. upgrade on FreeBSD 8.1 release

I stumbled over a broken Redmine 1.3 install on a server this morning. The installation is broken in 1.3 related to rubytree something something … I’m kind of a noob in FreeBSD,  and even more of a noob  in regard to Ruby on rails applications… today was my first look at anything related to that stuff. I’m uppgrading to Redmine 1.4 since according to maillinglists it should fix the rubytree problem, so I’m following http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade?version=53 .

 

rake generate_session_store
an error occured while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.
# (fuck)
uname -a
FreeBSD pdev.mid.dmz 8.1-RELEASE-p2 FreeBSD 8.1-RELEASE-p2 #5: Tue Dec 14 11:14:21 CET 2010     root@--.amd64  amd64
ls -l /usr/local/include/sqlite3.h 
-rw-r--r--  1 root  wheel  295268 Feb 14  2011 /usr/local/include/sqlite3.h
setenv CONFIGURE_ARGS "with-sqlite3-include=/usr/local/include" # (tcsh/csh)

../gems/bin/bundle install --without development test
Fetching gem metadata from http://rubygems.org/.......
Using rake (0.9.2.2) 
Using activesupport (2.3.14) 
Using rack (1.1.3) 
Using actionpack (2.3.14) 
Using actionmailer (2.3.14) 
Using activerecord (2.3.14) 
Using activeresource (2.3.14) 
Using coderay (1.0.7) 
Using fastercsv (1.5.5) 
Using i18n (0.4.2) 
Using mysql (2.8.1) 
Using net-ldap (0.3.1) 
Using pg (0.14.0) 
Using rails (2.3.14) 
Using rmagick (2.13.1) 
Using ruby-openid (2.1.8) 
Installing sqlite3 (1.3.6) with native extensions 
Installing tzinfo (0.3.33) 
Using bundler (1.1.5) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

Got it to work in the end, and got a small insight in Rugy on Rails, and gem install stuff .
Gem install help
Note: during Redmine upgrade rake told me I had to do a bundle install –without development test, and I ran into ‘command not found’ which was because the ‘bundle’ command was a Ruby gem, and those gem’s wasn’t in my path, I had to locate the ‘bundle’ gem, and call it with an absolute path (or fix my PATH variable) .

Btw: they say that “UNIX Is User Friendly. It’s Just Selective About Who Its Friends Are.”, I have a feeling Unix hasn’t selected me yet …

teampass

I’ve setup teampass, it may be the tool I need for a central password database where I work. There is a bug in the latest version, I noticed stuff like

*213 FastCGI sent in stderr: “PHP Notice: Undefined index: notification in /items.queries.php on line 942”

in the nginx error log. The solution is to do a :

ALTER TABLE teampass_items ADD notification VARCHAR(250) DEFAULT NULL;

in the teampass mysql db.

Got that from /github.com/nilsteampassnet/TeamPass/issues/130 .

FreeBSD VS. Debian Linux

I’m switching job these days, and they use FreeBSD at my new workplace . I’ll update this post with various stuff I have to dig up(stuff related to cli, package management and so on).

Debian                               FreeBSD
dpkg -l                               pkg_info
dpkg -L [pkg]                    pkg_info -xL [pkg]
deluser / userdel             rmuser

lspci                                  pciconf -lv

cat /proc/cpuinfo           sysctl -a | egrep -i ‘hw.machine|hw.model|hw.ncpu’