Skip to content

Installing on Ubuntu Apache

leamas edited this page Sep 27, 2010 · 14 revisions

This wiki picks up where the Diaspora wiki leaves off, so it's assumed you already have a working seed and can view it at yourdomain.com:3000 and would like to managed by Apache instead of Thin.

See also: Using apache

Does anyone have federation and/or websockets working with apache? Correct me if I am wrong, but we use eventmachine for both of these things, and should only work if you use thin or rainbows! as your appserver, not mod_rails and passenger? - maxwell

I have a "working" install using apache2 + mod_passenger. If you could give me a way to test this out, I would be happy to provide a more detailed analysis. I notice a few things aren't working, (eg propagating messages in particular) but I can't be sure which parts are failing due to websockets vs. bugs. - apfejes

If you can friend tom@tom.joindiaspora.com, it's working. Otherwise, I think we can consider passenger/mod_rails unavailable for now. You can still use Apache for a webserver. -- Raphael Sofaer

There's a discussion on apache and passenger on Discussions on fedora apache wiki page. Can we use this also for discussion on passenger use on Apache? -- leamas

Install Apache development package

sudo apt-get install apache2-dev

It can co-exist with your existing Apache ok

Install Passenger Module for Apache

From http://www.modrails.org/install.php

gem install passenger
passenger-install-apache2-module

The installer will walk you through any dependencies you need ahead of time and once you've installed those it will do all the heavy lifting outside of your apache config and vhosts, so let's do those:

Load module in Apache Config

My default apache config file is /etc/apache2/apache2.conf and I just appended the module settings to the end of the file:

LoadModule passenger_module /somewhere/passenger-x.x.x/ext/apache2/mod_passenger.so

PassengerRuby /usr/bin/ruby PassengerRoot /somewhere/passenger/x.x.x PassengerMaxPoolSize 10

Create vhost

Once you've installed and loaded Passenger, you just need to setup a vhost like any other website.

<VirtualHost *:80> ServerAdmin clay@bychosen.com ServerName diaspor.us ServerAlias www.diaspor.us DocumentRoot "/var/www/diaspora/public" <Directory "/var/www/diaspora/public"> Allow from all AllowOverride all Options -MultiViews

Stop thin, restart apache

Then stop the thin server (have to cd to your diaspora directory and execute) and restart Apache:

bundle exec thin stop
service apache2 restart

That's it!

Possible errors

You may get errors when calling your newly created vhost in the browser, like

http://github.com/BadMinus/devise.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
.

There are two alternatives at this point. Simplest is to create devise.git in the local directory (ie copy per installation of diaspora):

In the disapora directory:

sudo bundle install devise.git

should do the trick.

To make a system-wide install (ie single copy used by all installs), do (while root in the diaspora directory):

sudo bundle install --system
mkdir -p devise.git/ruby
ln -s /usr/lib/ruby/gems/* devise.git/ruby/

On subsequent installations the first line won't be required.

In both cases, the devise.git tree must be accessible for the apache user. just do a

sudo chown -R www-data:www-data /you/diaspora/installation

and, if you used the system option, a

sudo chown -R www-data:www-data /usr/lib/ruby/gems/1.8/

to change the rights

Clone this wiki locally