texasmath ([personal profile] texasmath) wrote in [site community profile] dw_dev2010-09-18 09:45 pm
Entry tags:

Dreamwidth Install with Virtual Hosts?

A bit of background - I run a website serving a small but dedicated education community. I was running Ubuntu 8.04 and was successfully running a webserver hosting the website, phpbb forum, wiki, and a livejournal (using apache-perl on a different port) client for our group. My computer crashed during a bad rainstorm, and I took this opportunity to upgrade to Ubuntu 10.04. I've been able to restore the website, wiki, and phpbb forum, but wanted to get dreamwidth on, so I wouldn't have to use a different port.

Using the Scratch Installation, I can get dreamwidth exclusively to run correctly by using the "stage" file, but I lose all my other services (wiki/forum/other web pages.)

When I try to implement these commands in my virtual host, I run into a lot of issues.

My Virtual host block looks like this:

<VirtualHost *>
    ServerName example.org
    DocumentRoot /var/www/example.org/
    ServerAdmin webmaster@example.org
    ErrorLog /var/log/apache2/example.org_log
    CustomLog /var/log/apache2/example.org_log common
</VirtualHost>

<VirtualHost *>
    ServerName www.example.org
    DocumentRoot /var/www/example.org
    ServerAdmin webmaster@example.org
    ErrorLog /var/log/apache2/example.org_log
    CustomLog /var/log/apache2/example.org_log common
</VirtualHost>

<VirtualHost *>
    ServerName wiki.example.org
    DocumentRoot /var/www/example.org/wiki
    ServerAdmin webmaster@example.org
    ErrorLog /var/log/apache2/example.org_log
    CustomLog /var/log/apache2/example.org_log common
    Redirect permanent / http://www.example.org/wiki
</VirtualHost>

<VirtualHost *>
    ServerName forum.example.org
    Redirect permanent / http://www.example.org/forum/
    DocumentRoot /var/www/example.org/forum/
    ServerAdmin webmaster@example.org
    ErrorLog /var/log/apache2/example.org_log
    CustomLog /var/log/apache2/example.org_log common
</VirtualHost>

<VirtualHost *>
    PerlOptions +Clone
    ServerName journal.example.org
    DocumentRoot /home/dw/htdocs
    ServerAdmin webmaster@example.org
    ErrorLog /var/log/apache2/example.org_log
    CustomLog /var/log/apache2/example.org_log common
    PerlSetEnv LJHOME /home/dw
    SetEnv LJHOME /home/dw
    PerlPassEnv LJHOME
    SetHandler perl-script
#    PerlConfigRequire /home/dw/cgi-bin/modperl.pl
</VirtualHost>


This allow my webserver to serve all the pages, but doesn't render the bml correctly. When I uncomment the PerlConfigureRequire, I get the following error:


* Restarting web server apache2 Use of uninitialized value $LJ::HOME in concatenation (.) or string at /home/dw/cgi-bin/LJ/LJ/Config.pm line 74.
Use of uninitialized value $LJ::HOME in concatenation (.) or string at /home/dw/cgi-bin/LJ/LJ/Config.pm line 74.
Use of uninitialized value $LJ::HOME in concatenation (.) or string at /home/dw/cgi-bin/LJ/LJ/Config.pm line 74.
Use of uninitialized value $LJ::HOME in concatenation (.) or string at /home/dw/cgi-bin/LJ/LJ/Config.pm line 74.
Syntax error on line 92 of /etc/apache2/sites-enabled/000-default:
Base class package "CSS::Cleaner" is empty.\n (Perhaps you need to 'use' the module which defines that package first,\n or make that module available in @INC (@INC contains: /src/s2 /home/dw/cgi-bin/LJ /home/dw/cgi-bin /cgi-bin /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 . /etc/apache2).\n at /home/dw/cgi-bin/LJ/CSS/Cleaner.pm line 20\nBEGIN failed--compilation aborted at /home/dw/cgi-bin/LJ/CSS/Cleaner.pm line 20.\nCompilation failed in require at /home/dw/cgi-bin/HTMLCleaner.pm line 8.\nBEGIN failed--compilation aborted at /home/dw/cgi-bin/HTMLCleaner.pm line 8.\nCompilation failed in require at /home/dw/cgi-bin/LJ/S2.pm line 26.\nBEGIN failed--compilation aborted at /home/dw/cgi-bin/LJ/S2.pm line 26.\nCompilation failed in require at /home/dw/cgi-bin/LJ/LJ/S2.pm line 22.\nBEGIN failed--compilation aborted at /home/dw/cgi-bin/LJ/LJ/S2.pm line 22.\nCompilation failed in require at /home/dw/cgi-bin/Apache/LiveJournal.pm line 26.\nBEGIN failed--compilation aborted at /home/dw/cgi-bin/Apache/LiveJournal.pm line 26.\nCompilation failed in require at /home/dw/cgi-bin/modperl_subs.pl line 31.\nBEGIN failed--compilation aborted at /home/dw/cgi-bin/modperl_subs.pl line 31.\nCompilation failed in require at /home/dw/cgi-bin/modperl.pl line 49.\nCompilation failed in require at (eval 2) line 1.\n
[fail]




For the record, /home/dw/cgi-bin/CSS/Cleaner.pm exists, and is the same as this.

I know that virtual hosts are "discouraged" because the dreamwidth code can be memory and processor intensive, but this same system was able to handle 20-30 user accounts for our group.

Can anyone give me a clue how to tweak my virtual host to render the bml correctly?

I appreciate all the help you can offer!

TDP.
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)

[personal profile] sophie 2010-09-19 02:10 pm (UTC)(link)
I don't believe the code has ever been amenable to virtual hosting; the code expects to be on its own server. It actually tries to insert its own configuration directives dynamically, which might be the cause of the problem.

The way I get it working on the Dreamhack machine is a bit hacky. I have Perlbal set up to handle each request, and it directs the request to the appropriate Apache, which are all listening on different ports on localhost. That way it *looks* like they're all part of the same server, but they're not. (It also allows people to stop and start their Apaches individually, which is very important for a 'hack.)

Talking of Dreamhacks, by the way, I received your application for one on the 6th and set it up two days later, but I notice you haven't logged into it - and given this post, I'm wondering if you received the welcome email?
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)

[personal profile] sophie 2010-09-19 06:16 pm (UTC)(link)
Hmm. That's strange - you should have got the welcome email; it was sent on September 8th. It would have come from sophie [at] hack.dreamwidth.net - maybe it got marked as spam?

I should say that $LJ::HOME and $ENV{LJHOME} are both used quite a lot in the code, I think, so I suspect that replacing them with their literal values isn't the way forward.

The CSS::Cleaner error is most likely related to this, because assuming that you've been using cvsreport.pl as described in the wiki, the CSS::Cleaner is actually placed inside $LJHOME itself - you'll see it at /home/dw/cgi-bin/CSS/Cleaner.pm . CSS::Cleaner is used by LJ::CSS::Cleaner.

The thing is, looking at the directories it's searching in, it's using /home/dw/cgi-bin/LJ before /home/dw/cgi-bin - which causes Perl to find the /home/dw/cgi-bin/LJ/CSS/Cleaner.pm file first, which of course is LJ::CSS::Cleaner again, not CSS::Cleaner. Because it doesn't find the right package, it complains that the package is empty. Somewhere there's probably a "use lib '/home/dw/cgi-bin/LJ';" line that shouldn't have that '/LJ' on the end. I can't see any lines like that in the original code (if there were, it'd probably not be working, but I checked anyway), so you may have to do some hunting yourself to see where that came from.

I must admit, I'm still really concerned about this Dreamhack email problem. I think I'll put a note on the application form to say that if you haven't heard anything from me in a few days, to email me and ask what's up. I can try setting your account up again if you want to try again. If that doesn't work, I can just email you the details manually, although if you're not getting email from it there may be other emails that you'd miss as well... hmm. :/
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)

[personal profile] sophie 2010-09-19 07:24 pm (UTC)(link)
Ah, glad to see it did get through after all!

I will say, though, that if you want a backup of your LJ, I would recommend that you not have it on the Dreamhack machine itself; there are no guarantees about data on that machine due to its nature. Instead, I'd suggest settuping up a new account at Dreamwidth itself and importing the journal if you don't want to do it on your current account. :)

Take care. :D
fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

[personal profile] fu 2010-09-20 08:25 am (UTC)(link)
Hm, a.) does your install have this at the top of LJ::S2::EntryPage?
use DW;
use lib DW->home . "/src/s2";
use S2;


b.) that doesn't match up to the line numbers on my file; can you see what version of the code you are on right now?

hg id


If you're on an older version, that may be some of the problems we've seen.
fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

[personal profile] fu 2010-09-21 03:42 pm (UTC)(link)
Hmm, oh right, try running those commands from:

$LJHOME/cvs/dw-free


rather than from $LJHOME.


Also, I think that might mean that it's not loading the s2 libraries in properly? What values do you get from DW->home? What values are set for $LJ::HOME, and $ENV{LJHOME}? Are all of them correct/as you'd expect?

(Wrong account!)