Diasporas components explained: Difference between revisions

From diaspora* project wiki
(+ood notice)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Rails =
{{Out of date}}{{Note|1=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.<br />
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.<br />
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. --[[User:Waithamai|waithamai]] <sup>[[User talk:Waithamai|talk]]</sup> 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 <tt>production</tt> and <tt>development</tt>. 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.
Diaspora is a Ruby on Rails application. Rails knows so called environments, or running modes. The main ones are <tt>production</tt> and <tt>development</tt>. 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.
Line 5: Line 9:
The default is <tt>development</tt>, for production setups you want to run in, well, <tt>production</tt> mode. To do that prefix all commands with <tt>RAILS_ENV=production</tt>.
The default is <tt>development</tt>, for production setups you want to run in, well, <tt>production</tt> mode. To do that prefix all commands with <tt>RAILS_ENV=production</tt>.


= Database =
== Database ==


Either MySQL/MariaDB or PostgreSQL. Used to store all persistent data except uploaded images, like users, profiles, posts, likes and comments.
Either MySQL/MariaDB or PostgreSQL. Used to store all persistent data except uploaded images, like users, profiles, posts, likes and comments.
Line 11: Line 15:
The default is MySQL, if you want to use PostgreSQL make sure to <tt>export DB=postgres</tt> in the diaspora user's <tt>.bashrc</tt> (or whatever shell environment file you use).
The default is MySQL, if you want to use PostgreSQL make sure to <tt>export DB=postgres</tt> in the diaspora user's <tt>.bashrc</tt> (or whatever shell environment file you use).


= Application server =
== Application server ==


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


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
bundle exec bundle exec unicorn_rails -c config/unicorn.rb -p 3000
bundle exec unicorn_rails -c config/unicorn.rb -p 3000
</syntaxhighlight>  
</syntaxhighlight>  


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.
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 ==


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.
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.
Line 34: Line 38:




= Redis =
== Redis ==


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

Latest revision as of 07:12, 17 August 2017

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.