Diasporas components explained

From diaspora* project wiki
Revision as of 15:33, 24 June 2013 by Jhass (talk | contribs)
Jump to: navigation, search


Diaspora is a Ruby on Rails application. Rails knows so called environments, or running modes. The main ones are production and development. The main difference is whether the code is reloaded with each request, this is very slow but also very handy for development. We also have slightly different default configuration values.

The default is development, for production setups you want to run in, well, production mode. To do that prefix all commands with RAILS_ENV=production.


Either MySQL/MariaDB or PostgreSQL. Used to store all persistent data except uploaded images, like users, profiles, posts, likes and comments.

The default is MySQL, if you want to use PostgreSQL make sure to prefix all commands with DB=postgres.

Application server

This server generates the dynamic content. It's bad at hosting static content though.

bundle exec bundle exec unicorn_rails -c config/unicorn.rb -p 3000

from Diasporas base directory starts the default application server we recommend. It will run on port 3000 by default. If you want it to be available on port 80, either run it on port 80 directly (very unwise, you shouldn't run Diaspora as root) or use a webserver of your choice to proxy port 443 and/or 80 at your domain name to Unicorn at port 3000. You can also forward the requests over a socket. This is absolutely needed unless you want to use a different application server, like Passenger for example.


Sidekiq is a job processing system. We use it to take all time intensive task outside the request cycle. This includes for example sending posts to other pods, fetching remote profiles or sending mail.

To start the Sidekiq worker run the following command:

bundle exec sidekiq

This is also essential unless you turn on environment.single_process_mode in config/diaspora.yml which is absolutely not recommended for production environments. Add -d -P tmp/sidekiq.pid to daemonize it. You can stop it with bundle exec sidekiqctl stop tmp/sidekiq.pid.


Redis is a key-value store. It's an in memory database used to communicate between the application server and Sidekiq.

If you compiled Redis from source run redis-server to start Redis on the default port 6379. It uses a config file, normally /etc/redis.conf or /etc/redis/redis.conf defining ports and other stuff. If you installed via a package manager there's most likely an init script you want to use.