Difference between revisions of "Alternative startup methods"

From diaspora* project wiki
Jump to: navigation, search
(Example configuration for Debian based systems like Ubuntu 16.04 or Debian 9.0: add reload of diaspora-web.service)
 
(8 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 
This page is for listing alternative methods for starting up the Diaspora service automatical or in some manner other than calling the ./script/start
 
This page is for listing alternative methods for starting up the Diaspora service automatical or in some manner other than calling the ./script/start
 +
 +
{{Out of date}}{{Note|1=Is this still working? If it is, it should be linked in some meaningful places, like [[FAQ for pod maintainers]], [[Installation guides]], or similar.}}
  
 
== Init Scripts & Upstart ==
 
== Init Scripts & Upstart ==
 +
* [https://anonscm.debian.org/cgit/pkg-ruby-extras/diaspora-installer.git/tree/debian/diaspora-common.init Init script of debian-installer package]
 +
 +
Sample /etc/diaspora.conf required by the init script is given below
 +
 +
<pre>
 +
export SERVERNAME=localhost
 +
export ENVIRONMENT_URL=https://localhost
 +
export RAILS_ENV=production
 +
export DB=postgres</pre>
 +
 
* <del>[https://github.com/netom/diaspora-init diaspora-init on Github by netom]</del> [https://github.com/ur5/diaspora-init fork of dead repo]
 
* <del>[https://github.com/netom/diaspora-init diaspora-init on Github by netom]</del> [https://github.com/ur5/diaspora-init fork of dead repo]
 
* [https://github.com/jhass/old_diaspora_wiki/blob/master/Init-script-for-diaspora.md Init Script on OLD github page for diaspora]
 
* [https://github.com/jhass/old_diaspora_wiki/blob/master/Init-script-for-diaspora.md Init Script on OLD github page for diaspora]
 
* [http://stackoverflow.com/questions/9122488/how-to-allow-diaspora-to-start-when-server-boot-up Stack Overflow Ubuntu init script]
 
* [http://stackoverflow.com/questions/9122488/how-to-allow-diaspora-to-start-when-server-boot-up Stack Overflow Ubuntu init script]
 +
* [https://gist.github.com/koehn/fde0832318a6328f20c8 Init script that works as of Diaspora 0.5] (also requires a script in [https://gist.github.com/koehn/c8c8e33388677e09352a <code>/home/diaspora/diaspora/diaspora-init</code>])
  
 
== systemd ==
 
== systemd ==
 +
 +
 +
=== Example configuration for Debian based systems like Ubuntu 16.04 or Debian 9.0 ===
 +
 +
This configuration is based on a forum post of Benjamin Neff [https://discourse.diasporafoundation.org/t/installing-diaspora-on-debian-9/790/5]
 +
 +
<pre>cd /etc/systemd/system</pre>
 +
 +
Create the following files with you preferred text editor e.g. ''nano''
 +
 +
'''diaspora.target'''
 +
 +
<pre>
 +
[Unit]
 +
Description=Diaspora social network
 +
Wants=postgresql.service
 +
Wants=redis-server.service
 +
After=redis-server.service
 +
After=postgresql.service
 +
 +
[Install]
 +
WantedBy=multi-user.target
 +
</pre>
 +
 +
'''diaspora-web.service'''
 +
 +
<pre>
 +
[Unit]
 +
Description=Diaspora social network (unicorn)
 +
PartOf=diaspora.target
 +
StopWhenUnneeded=true
 +
 +
[Service]
 +
User=diaspora
 +
Environment=RAILS_ENV=production
 +
WorkingDirectory=/home/diaspora/diaspora
 +
PIDFile=/home/diaspora/diaspora/tmp/pids/web.pid
 +
ExecStart=/bin/bash -lc "bin/bundle exec unicorn -c config/unicorn.rb -E production"
 +
ExecReload=/bin/kill -USR2 $MAINPID
 +
Restart=always
 +
 +
[Install]
 +
WantedBy=diaspora.target
 +
</pre>
 +
 +
'''diaspora-sidekiq.service'''
 +
 +
<pre>
 +
[Unit]
 +
Description=Diaspora social network (sidekiq)
 +
PartOf=diaspora.target
 +
StopWhenUnneeded=true
 +
 +
[Service]
 +
User=diaspora
 +
Environment=RAILS_ENV=production
 +
WorkingDirectory=/home/diaspora/diaspora
 +
ExecStart=/bin/bash -lc "bin/bundle exec sidekiq"
 +
Restart=always
 +
 +
[Install]
 +
WantedBy=diaspora.target
 +
</pre>
 +
 +
Now you have to enable all of them
 +
 +
<pre>systemctl enable diaspora.target diaspora-sidekiq.service diaspora-web.service</pre>
 +
 +
Start all services with
 +
 +
<pre>systemctl restart diaspora.target</pre>
 +
 +
You can check if unicorn and sidekiq work with
 +
 +
<pre>
 +
systemctl status diaspora-web.service
 +
systemctl status diaspora-sidekiq.service
 +
</pre>
 +
 +
'''Hint:'''  The path '''''/lib/systemd/system/''''' is for unit-files installed from the system, you can create user-created units in '''''/etc/systemd/system/'''''.  Both locations work.
 +
 +
==== Other sources ====
 +
 
* [https://github.com/jhass/diaspora/blob/old_systemd/diaspora.service Old systemd unit starting script/server]
 
* [https://github.com/jhass/diaspora/blob/old_systemd/diaspora.service Old systemd unit starting script/server]
* [https://github.com/jhass/diaspora/tree/systemd/systemd modular systemd units] (running puma instead of unicorn)
+
* [https://github.com/jhass/diaspora/tree/systemd/systemd modular systemd units] (running puma instead of unicorn and chruby instead of RVM)
  
 
== daemontools ==
 
== daemontools ==
Line 16: Line 112:
 
* [https://github.com/despora/diaspora/blob/despora/script/diaspora.god Despora god config]
 
* [https://github.com/despora/diaspora/blob/despora/script/diaspora.god Despora god config]
 
* [https://github.com/diasporg/diaspora/blob/master/script/diaspora.god diasp.org god config]
 
* [https://github.com/diasporg/diaspora/blob/master/script/diaspora.god diasp.org god config]
 +
 +
== Passenger ==
 +
 +
All you need is the following snippet of Apache configuration in e.g. a <code><VirtualHost></code> block:
 +
 +
<code><pre>
 +
DocumentRoot $diasporapath/public
 +
PassengerAppRoot $diasporapath
 +
PassengerAppEnv production
 +
PassengerRuby $rubypath
 +
</pre></code>
 +
 +
Replace <code>$diasporapath</code> with the path where you installed diaspora*, and replace <code>$rubypath</code> with the Ruby binary Passenger should use (probably what RVM installed, if you use RVM).
 +
 +
Note, however, that this does not automatically start Sidekiq. You need to do that yourself.
 +
 +
[[Category:Technical]]

Latest revision as of 23:55, 21 June 2018

This page is for listing alternative methods for starting up the Diaspora service automatical or in some manner other than calling the ./script/start

»» Out 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.
»» Note
Is this still working? If it is, it should be linked in some meaningful places, like FAQ for pod maintainers, Installation guides, or similar.


Init Scripts & Upstart

Sample /etc/diaspora.conf required by the init script is given below

export SERVERNAME=localhost
export ENVIRONMENT_URL=https://localhost
export RAILS_ENV=production
export DB=postgres

systemd

Example configuration for Debian based systems like Ubuntu 16.04 or Debian 9.0

This configuration is based on a forum post of Benjamin Neff [1]

cd /etc/systemd/system

Create the following files with you preferred text editor e.g. nano

diaspora.target

[Unit]
Description=Diaspora social network
Wants=postgresql.service
Wants=redis-server.service
After=redis-server.service
After=postgresql.service

[Install]
WantedBy=multi-user.target

diaspora-web.service

[Unit]
Description=Diaspora social network (unicorn)
PartOf=diaspora.target
StopWhenUnneeded=true

[Service]
User=diaspora
Environment=RAILS_ENV=production
WorkingDirectory=/home/diaspora/diaspora
PIDFile=/home/diaspora/diaspora/tmp/pids/web.pid
ExecStart=/bin/bash -lc "bin/bundle exec unicorn -c config/unicorn.rb -E production"
ExecReload=/bin/kill -USR2 $MAINPID
Restart=always

[Install]
WantedBy=diaspora.target

diaspora-sidekiq.service

[Unit]
Description=Diaspora social network (sidekiq)
PartOf=diaspora.target
StopWhenUnneeded=true

[Service]
User=diaspora
Environment=RAILS_ENV=production
WorkingDirectory=/home/diaspora/diaspora
ExecStart=/bin/bash -lc "bin/bundle exec sidekiq"
Restart=always

[Install]
WantedBy=diaspora.target

Now you have to enable all of them

systemctl enable diaspora.target diaspora-sidekiq.service diaspora-web.service

Start all services with

systemctl restart diaspora.target

You can check if unicorn and sidekiq work with

systemctl status diaspora-web.service
systemctl status diaspora-sidekiq.service

Hint: The path /lib/systemd/system/ is for unit-files installed from the system, you can create user-created units in /etc/systemd/system/. Both locations work.

Other sources

daemontools

god

Passenger

All you need is the following snippet of Apache configuration in e.g. a <VirtualHost> block:

DocumentRoot $diasporapath/public
PassengerAppRoot $diasporapath
PassengerAppEnv production
PassengerRuby $rubypath

Replace $diasporapath with the path where you installed diaspora*, and replace $rubypath with the Ruby binary Passenger should use (probably what RVM installed, if you use RVM).

Note, however, that this does not automatically start Sidekiq. You need to do that yourself.