Topic: Howto get reCAPTCHA working on my Slave-Server?

I have a working Slave-Server with v-2012-06-25.
After the git checkout v-2012-07-09 everthing still works fine.

But after the next git checkout v-2012-07-23 I can't start the MB-Server anymore. I get

mb@ubuntu:~/musicbrainz-server$ carton exec -- plackup -Ilib -r
Watching ./lib app.psgi for file updates.
Error while loading app.psgi: Can't locate Captcha/reCAPTCHA.pm in @INC (@INC contains: lib local/lib/perl5/i686-linux-gnu-thread-multi-64int local/lib/perl5 . /usr/share/perl/5.14 /usr/lib/perl/5.14) at lib/MusicBrainz/Server/Controller/Account.pm line 10.
BEGIN failed--compilation aborted at lib/MusicBrainz/Server/Controller/Account.pm line 10.
Compilation failed in require at local/lib/perl5/Catalyst/Utils.pm line 306.
Compilation failed in require at app.psgi line 21.
BEGIN failed--compilation aborted at app.psgi line 21.

Unfortunately, even manually installing Captcha::reCAPTCHA from CPAN doesn't help.

Any idea how I can fix that?

Re: Howto get reCAPTCHA working on my Slave-Server?

How did you manually install Captcha::reCAPTCHA?

(Should be: carton install Captcha::reCAPTCHA)

If you do that, it should end up in local/lib/perl5, which as you can see is part of @INC

Re: Howto get reCAPTCHA working on my Slave-Server?

Thank you for your advise with

carton install Captcha::reCAPTCHA

I still can't start the server anymore, this is the next error I get - after using your install command:

Watching ./lib app.psgi for file updates.
Error while loading app.psgi: Bareword "DBDefs::RECAPTCHA_PUBLIC_KEY" not allowed while "strict subs" in use at lib/MusicBrainz/Server/Controller/Account.pm line 404.
Bareword "DBDefs::RECAPTCHA_PRIVATE_KEY" not allowed while "strict subs" in use at lib/MusicBrainz/Server/Controller/Account.pm line 404.
BEGIN not safe after errors--compilation aborted at lib/MusicBrainz/Server/Controller/Account.pm line 520.
Compilation failed in require at local/lib/perl5/Catalyst/Utils.pm line 306.
Compilation failed in require at app.psgi line 21.
BEGIN failed--compilation aborted at app.psgi line 21.

What is as 'Bareword' and how do I have to configure that?

4 (edited by InvisibleMan78 2012-08-22 15:46:12)

Re: Howto get reCAPTCHA working on my Slave-Server?

I "found" the missing pieces (in addition to the above 'carton install Captcha::reCAPTCHA')

carton install REST::Utils

and adding this lines - without modifications - manually to the existing DBDefs.pm

# To enable use of reCAPTCHA:
# 1. make sure $ENV{'REMOTE_ADDR'} is the ip address of the visitor.
# 2. replace undef with your recaptcha keys:
sub RECAPTCHA_PUBLIC_KEY { return undef }
sub RECAPTCHA_PRIVATE_KEY { return undef }

Now, my slave server runs fine again.

Where could I find such informations between the releases/updates/changes?

Re: Howto get reCAPTCHA working on my Slave-Server?

Diff your DBDefs.pm with the DBDefs.pm.default and/or check DBDefs.pm.default diff between the two versions you are upgrading between would help.

Also, I'd have thought you could do carton install --deployment every release to make it to install any missing dependencies added in the release, as documented in the INSTALL.md.

Diffs to the Makefile.PL would show you such changes to dependencies as well.

Re: Howto get reCAPTCHA working on my Slave-Server?

Thank you for the hint with the Diff!

voiceinsideyou wrote:

Also, I'd have thought you could do carton install --deployment every release to make it to install any missing dependencies added in the release, as documented in the INSTALL.md.

I don't know why, but that doesn't work for me. Not even with a prior 'rm -rf local' and a fresh --deployment...

Re: Howto get reCAPTCHA working on my Slave-Server?

Thanks voiceinside you for stepping in while I was asleep :)

I'm not sure why carton install --deployment isn't working; I see that REST::Utils and Captcha::reCAPTCHA are both in it. For the DBDefs stuff, it's still just annoying -- however, I have a patch on codereview right now to hopefully make that less painful in an upcoming release.