Automatic startup methods: Difference between revisions
SuperTux88 (talk | contribs) (→Example configuration for Debian based systems like Ubuntu 16.04 or Debian 9.0: add reload of diaspora-web.service) |
No edit summary |
||
Line 1: | Line 1: | ||
This page is for listing alternative methods for starting up the Diaspora service | This page is for listing alternative methods for starting up the Diaspora service automatically or in some manner other than calling the ./script/start | ||
== | == systemd with individual services == | ||
This configuration is based on a forum post of Benjamin Neff [https://discourse.diasporafoundation.org/t/installing-diaspora-on-debian-9/790/5] | This configuration is based on a forum post of Benjamin Neff [https://discourse.diasporafoundation.org/t/installing-diaspora-on-debian-9/790/5] | ||
Line 57: | Line 38: | ||
WorkingDirectory=/home/diaspora/diaspora | WorkingDirectory=/home/diaspora/diaspora | ||
PIDFile=/home/diaspora/diaspora/tmp/pids/web.pid | PIDFile=/home/diaspora/diaspora/tmp/pids/web.pid | ||
ExecStart=/bin/bash -lc "bin/bundle exec | ExecStart=/bin/bash -lc "bin/bundle exec puma -C config/puma.rb" | ||
ExecReload=/bin/kill -USR2 $MAINPID | ExecReload=/bin/kill -USR2 $MAINPID | ||
Restart=always | Restart=always |
Revision as of 00:20, 9 June 2024
This page is for listing alternative methods for starting up the Diaspora service automatically or in some manner other than calling the ./script/start
systemd with individual services
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 puma -C config/puma.rb" 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
- Old systemd unit starting script/server
- modular systemd units (running puma instead of unicorn and chruby instead of RVM)
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.