Running a Diaspora pod on Ubuntu 10.10

Edit: Since Diaspora has switched from mongo db to mysql, the procedure below is now outdated. I may or may not update this page, or write a new guide.

During the holidays I have had some time to look into Diaspora.
Diaspora is a distributed social network, with a focus on privacy, security and ownership of ones own content. Everyone is free to run their own pod, and users on different pods can connect and communicate with each other. (Diaspora servers are called pods). The Diaspora software is still being developed and is in an alpha state.

Installing Diaspora
There is a great guide to installing Diaspora on Mac OSX, Ubuntu or Fedora here.
On Ubuntu 10.10 it boils down to this.

First install some required packages.
sudo apt-get install build-essential libxslt1.1 libxslt1-dev libxml2 ruby-full mongodb libssl-dev imagemagick libmagick9-dev git-core redis-server rubygems
sudo gem install bundler
sudo ln -s /var/lib/gems/1.8/bin/bundle /usr/local/bin/bundle

Then get Diaspora and the required gems.
git clone http://github.com/diaspora/diaspora.git
cd diaspora
bundle install --path vendor

Configure Diaspora and nginx
cd config
cp app_config.yml.example app_config.yml

now edit app_config.yml and change the hostname. If you want your pod to be able to send e-mail also edit the mailer_on and smtp_* entries. All the rest is for more advance settings, and your pod should run just fine with the default settings.

One last thing that needs to be set up, before you can enjoy your very own Diaspora server is a proxy, so that requests sent to port 80 are routed to port 3000.
I use the nginx server, as recommended.

Create a file called diaspora in /etc/nginx/sites-available with this content (where you of course change name-of-your-domain to the relevant string):

server {
        listen   80;
        server_name  diaspora.name-of-your-domain;
        access_log  /var/log/nginx/diaspora.name-of-your-domain.access.log;
        location / {
                proxy_pass http://name-of-your-domain:3000;
        }
}

Activate it with
sudo ln -s /etc/nginx/sites-available/diaspora /etc/nginx/sites-enabled/diaspora
Then restart the nginx server with
sudo /etc/init.d/nginx restart

Finally, if you also want to allow the users of your pod to propagate their status to Twitter and Facebook, you should follow this easy guide on how to configure the oauth_keysm.yml file.

You should now be able to start your pod by issuing
./script/server
from the diaspora directory.

Running Diaspora
However, this way of starting the pod can result in an inability to add contacts from other pods. So inspired by this you can do the following.

sudo update-rc.d -f redis-server remove
sudo sed -i 's/daemonize yes/daemonize no/' redis.conf
sudo /usr/bin/redis-server /etc/redis/redis.conf &

(You will need to start the redis server each time you reboot your host, or if the server fails in other ways.)

Now, each time you want to start your Diaspora pod run the following three commands from the diaspora directory. Wait for one service to start, before starting the next.

ruby script/websocket_server.rb &

QUEUE=receive,mail,receive_local,socket_webfinger,http_service,http,receive_salmon bundle exec rake resque:work &

bundle exec thin start -p 3000 -e development &

You can of course do this more elegantly, by wrapping it up in some scripts, but hopefully you get the idea. So instead of using the script/server script I use those three commands to start my pod.

Now your pod should finally be ready for use.

Now what?
So, should everyone run their own server? Properly not. Diaspora is still so early in the development process that normal users should think twice before using it. The features are limited, and there are still plenty of bugs.

But if you want to see what it can do, look for bugs or are just curious, then why not?. However, you don’t need to run your own pod for that. There are plenty of pods out there that accept new user signups.
Take a look at the list over here: http://podup.sargodarya.de/.

You should also feel free to use my pod, located at diaspora.compadre.dk.
What ever you choose to do, please note that this is still alpha-software, and should be treated as such.

If you need someone to add as contact for testing purposes, feel free to add me: soeren_b_c@diaspora.compadre.dk.

For more info about Diaspora see:

https://joindiaspora.com/ – the official Diaspora website, that also hosts a pod, run by the core developers. Currently the pod at joindiaspora.com is closed for new signups, but due to the distributed nature of Diaspora any pod should be fine, as long as you trust the people running the pod.
http://podup.sargodarya.de/ – list of running pods.
http://en.wikipedia.org/wiki/Diaspora_%28software%29 – Wikipedia article

10 thoughts on “Running a Diaspora pod on Ubuntu 10.10”

  1. I had problems adding other users on my diaspora pod on an Ubuntu 10.04LTS Server but when I followed the steps under “Running Diaspora” here on your blog it worked out just fine.

    Thanks for taking the time to write this!

  2. Melpomene: You are welcome :)
    About restarting the service, I just kill all the three ruby (and ruby1.8) processes.
    It’s not elegant, but it seems to work so far :)

    My guess is that the rake thing might be best to end last, but so far it hasn’t given me any trouble either way.

  3. Diaspora still classifies itself as alpha software, so in that sense it should not be considered secure.

    On the other hand, I haven’t heard of any security holes / breaches.

    On my own pod I haven’t noticed any issues – but I’m not in any way an experienced systems administrator. For all I know the entire server could already have been taken over by someone else and I’m just dumb enough not to notice :)

    Cheers

  4. any idea how to (auto)start it in a way that does not break after my ssh connection closes?

    because with these three commands it does:

    ruby script/websocket_server.rb &

    QUEUE=receive,mail,receive_local,socket_webfinger,http_service,http,receive_salmon bundle exec rake resque:work &

    bundle exec thin start -p 3000 -e development &

  5. Hi Nils

    Sorry about the late reply.

    I have a script that does exactly what you write (as described in the blog post). And it works fine when I log out.

    I don’t have an init script. I update the pod almost daily, and then I just run the script that kills the ruby process, fetches the updates, and then starts the pod again.

    The part that starts the pod looks like this:

    ruby script/websocket_server.rb &
    sleep 10
    QUEUE=receive,mail,receive_local,socket_webfinger,http_service,http,receive_salmon bundle exec rake resque:work&
    sleep 10
    bundle exec thin start -p 3000 -e development &

    Can you keep other processes running when logging out from ssh?

  6. Your website appears to be having some compatibilty issues in my internet explorer
    browser. The text appears to be running off the webpage pretty bad.
    If you would like you can email me at: eugeniaschuster@zoho.
    com and I will shoot you over a screenshot of the problem.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.