Diasporas components explained

From diaspora* project wiki
Out of dateOut of date:This page's accuracy may be compromised due to out-of-date information. Please help improve the page by updating it. There may be additional information on the talk page.
NoteNote:I think this page is still up to date. I set the out of date template anyway, to add the page to the review queue.

I'm not sure if we still need this page. If the content of this page is sufficiently described elsewhere (in the installation guides or FAQ for pod maintainers or FAQ for developers..) it can be deleted without replacement.

If this page is to keep, to me it looks like this page could perhaps be merged with An introduction to the Diaspora source (although they describe different parts of diaspora.. hm.). At the moment, both pages look somehow lost. --waithamai talk 07:12, 17 August 2017 (UTC)

Rails

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.

Database

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 export DB=postgres in the diaspora user's .bashrc (or whatever shell environment file you use).

Application server

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

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 UNIX socket. This is absolutely needed unless you want to use a different application server, like Passenger for example.

Sidekiq

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

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.