https://wiki.diasporafoundation.org/api.php?action=feedcontributions&user=Togart&feedformat=atomdiaspora* project wiki - User contributions [en]2024-03-28T15:54:24ZUser contributionsMediaWiki 1.39.3https://wiki.diasporafoundation.org/wiki/index.php?title=Template:Installation/Common&diff=10402Template:Installation/Common2018-11-24T09:19:00Z<p>Togart: /* Backup */</p>
<hr />
<div>== Get the source ==<br />
<br />
It's time to download diaspora*! As your diaspora user run:<br />
<br />
{{#tag:syntaxhighlight|<br />
cd ~<br />
git clone {{#ifeq: {{#var:mode}}|production|-b master|}} https://github.com/diaspora/diaspora.git<br />
cd diaspora<br />
|lang=bash}}<br />
<br />
Don't miss the <tt>cd diaspora</tt>, all coming commands expect to be run from that directory!<br />
<br />
== Configuration ==<br />
<br />
=== Copy files ===<br />
<br />
{{#tag:syntaxhighlight|<br />
cp config/database.yml.example config/database.yml<br />
cp config/diaspora.yml.example config/diaspora.yml<br />
|lang=bash}}<br />
<br />
{{#ifeq: {{#var:mode}}|production|{{Template:Installation/Configuration}}<br />
{{Installation/Reverse_proxy}}|}}<br />
== Bundle ==<br />
<br />
It's time to install the Ruby libraries required by diaspora*:<br />
<br />
{{#tag:syntaxhighlight|<br />
gem install bundler<br />
script/configure_bundler<br />
{{#ifeq:{{#var:dist}}{{#var:version}}{{#varDB}}|CentOS6postgres|bin/bundle config --local build.pg '--with-pg-config=/usr/pgsql-<version>/bin/pg_config'<br />
<nowiki/>}}bin/bundle install --full-index<br />
|lang=bash}}<br />
<br />
This takes quite a while. When it's finished, you should see a message similar to: <tt>Bundle complete! 137 Gemfile dependencies, 259 gems now installed.</tt> If that's not the case, you should seek for help on the mailing list or the IRC channel.<br />
<br />
Running the manual <tt>gem install</tt> command shown in the error message can sometimes show a clearer error message if the <tt>bundle</tt> command fails.<br />
<br />
== Database setup ==<br />
<br />
Double check your <tt>config/database.yml</tt> looks right and run:<br />
<br />
{{#tag:syntaxhighlight|<br />
{{#var:env_string}}bundle exec rake db:create db:migrate<br />
|lang=bash}}<br />
{{#ifeq: {{#var:mode}}|production|{{Installation/Assets}}|}}<br />
<br />
== Start diaspora* ==<br />
<br />
It's time to start diaspora*:<br />
<br />
{{#tag:syntaxhighlight|<br />
./script/server<br />
|lang="bash"}}<br />
<br />
{{#ifeq: {{#var:mode}}|production|In the most simple case you want to do this inside a [http://www.gnu.org/software/screen/ screen] or [http://tmux.sourceforge.net/ tmux] session from which you can safely detach.|}}<br />
<br />
Your diaspora server is now running, either on a unix socket (current default) or on http port 3000. The listening method can be configured in diaspora.yml, search for '3000' or 'listen' to find the correct line. <br />
<br />
You will likely need to install a reverse proxy ([https://gist.github.com/jhass/719014 example on github] for apache2) in order to get it to be served publicly. If you are new to running rails applications you may find the [[diaspora components]] page helpful for orientation.<br />
<br />
== Backup ==<br />
{{Serious|1=You have to do backups of your pod data. If you lose your data, you won't be able to use the combination of your old username and old domain ever again. Make sure to store the backups on a different server, or at least on a different hard drive.<br />For details on how to do backups, see [[Pod data backup]].}}<br />
<br />
If you have done your backup with the backup script[https://wiki.diasporafoundation.org/Pod_data_backup] you can restore your database as follows.<br />
Remember as described in the installation tutorial you have to create the database user <tt>diaspora</tt> before you restore the backup. Do '''NOT''' execute the comand <tt>RAILS_ENV=production bundle exec rake db:create db:migrate</tt>.<br />
<br />
<br />
Switch to your Diaspora system user<br />
<br />
sudo -iu diaspora<br />
<br />
Create a new empty database<br />
<br />
createdb -T template0 diaspora_production -U diaspora<br />
<br />
Restore your database backup<br />
<br />
psql diaspora_production < backup.sql<br />
<br />
== Further reading ==<br />
<br />
* [[Diasporas components explained]]<br />
* Is there anybody out there? [[FAQ_for_pod_maintainers#Am_I_alone_here.3F_.28Establish_connections_with_other_pods.29|Establish connections with other pods]]<br />
* [[FAQ_for_pod_maintainers#What_are_roles_and_how_do_I_use_them.3F_.2F_Make_yourself_an_admin_or_assign_moderators|Make yourself an admin]]<br />
* [[Updating#{{#switch: {{#var:mode}}|production=Updating_a_production_install|development=Updating_a_development_install}}|Updating Diaspora]]<br />
{{#ifeq: {{#var:mode}}|production|* [[Integrating other social networks]]<br />
* [[Alternative startup methods]] (Passenger, Init script, Daemontools, ...)<br />
* [[Asset hosting on S3]]|* [[Getting Started With Contributing]]|}}<br />
<br />
<includeonly><br />
[[Category:Installation]]<br />
[[Category:Podmin]]<br />
</includeonly><br />
<noinclude>[[Category:Installation-Templates]]</noinclude></div>Togarthttps://wiki.diasporafoundation.org/wiki/index.php?title=Alternative_startup_methods&diff=10170Alternative startup methods2017-10-08T09:43:41Z<p>Togart: Removed <code> tags</p>
<hr />
<div>This page is for listing alternative methods for starting up the Diaspora service automatical or in some manner other than calling the ./script/start<br />
<br />
{{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.}}<br />
<br />
== Init Scripts & Upstart ==<br />
* [https://anonscm.debian.org/cgit/pkg-ruby-extras/diaspora-installer.git/tree/debian/diaspora-common.init Init script of debian-installer package]<br />
<br />
Sample /etc/diaspora.conf required by the init script is given below<br />
<br />
<pre><br />
export SERVERNAME=localhost<br />
export ENVIRONMENT_URL=https://localhost<br />
export RAILS_ENV=production<br />
export DB=postgres</pre><br />
<br />
* <del>[https://github.com/netom/diaspora-init diaspora-init on Github by netom]</del> [https://github.com/ur5/diaspora-init fork of dead repo]<br />
* [https://github.com/jhass/old_diaspora_wiki/blob/master/Init-script-for-diaspora.md Init Script on OLD github page for diaspora]<br />
* [http://stackoverflow.com/questions/9122488/how-to-allow-diaspora-to-start-when-server-boot-up Stack Overflow Ubuntu init script]<br />
* [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>])<br />
<br />
== systemd ==<br />
<br />
<br />
=== Example configuration for Debian based systems like Ubuntu 16.04 or Debian 9.0 ===<br />
<br />
This configuration is based on a forum post of Benjamin Neff [https://discourse.diasporafoundation.org/t/installing-diaspora-on-debian-9/790/5]<br />
<br />
<pre>cd /etc/systemd/system</pre><br />
<br />
Create the following files with you preferred text editor e.g. ''nano''<br />
<br />
'''diaspora.target'''<br />
<br />
<pre><br />
[Unit]<br />
Description=Diaspora social network<br />
Wants=postgresql.service<br />
Wants=redis-server.service<br />
After=redis-server.service<br />
After=postgresql.service<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</pre><br />
<br />
'''diaspora-web.service'''<br />
<br />
<pre><br />
[Unit]<br />
Description=Diaspora social network (unicorn)<br />
PartOf=diaspora.target<br />
StopWhenUnneeded=true<br />
<br />
[Service]<br />
User=diaspora<br />
Environment=RAILS_ENV=production<br />
WorkingDirectory=/home/diaspora/diaspora<br />
ExecStart=/bin/bash -lc "bin/bundle exec unicorn -c config/unicorn.rb -E production"<br />
Restart=always<br />
<br />
[Install]<br />
WantedBy=diaspora.target<br />
</pre><br />
<br />
'''diaspora-sidekiq.service'''<br />
<br />
<pre><br />
[Unit]<br />
Description=Diaspora social network (sidekiq)<br />
PartOf=diaspora.target<br />
StopWhenUnneeded=true<br />
<br />
[Service]<br />
User=diaspora<br />
Environment=RAILS_ENV=production<br />
WorkingDirectory=/home/diaspora/diaspora<br />
ExecStart=/bin/bash -lc "bin/bundle exec sidekiq"<br />
Restart=always<br />
<br />
[Install]<br />
WantedBy=diaspora.target<br />
</pre><br />
<br />
Now you have to enable all of them<br />
<br />
<pre>systemctl enable diaspora.target diaspora-sidekiq.service diaspora-web.service</pre><br />
<br />
Start all services with<br />
<br />
<pre>systemctl restart diaspora.target</pre><br />
<br />
You can check if unicorn and sidekiq work with<br />
<br />
<pre><br />
systemctl status diaspora-web.service<br />
systemctl status diaspora-sidekiq.service<br />
</pre><br />
<br />
'''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.<br />
<br />
==== Other sources ====<br />
<br />
* [https://github.com/jhass/diaspora/blob/old_systemd/diaspora.service Old systemd unit starting script/server]<br />
* [https://github.com/jhass/diaspora/tree/systemd/systemd modular systemd units] (running puma instead of unicorn and chruby instead of RVM)<br />
<br />
== daemontools ==<br />
* [https://github.com/jhass/diaspora/tree/daemontools/daemontools Unmaintained scripts to start foreman directly]<br />
<br />
== god ==<br />
* [https://github.com/despora/diaspora/blob/despora/script/diaspora.god Despora god config]<br />
* [https://github.com/diasporg/diaspora/blob/master/script/diaspora.god diasp.org god config]<br />
<br />
== Passenger ==<br />
<br />
All you need is the following snippet of Apache configuration in e.g. a <code><VirtualHost></code> block:<br />
<br />
<code><pre><br />
DocumentRoot $diasporapath/public<br />
PassengerAppRoot $diasporapath<br />
PassengerAppEnv production<br />
PassengerRuby $rubypath<br />
</pre></code><br />
<br />
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).<br />
<br />
Note, however, that this does not automatically start Sidekiq. You need to do that yourself.<br />
<br />
[[Category:Technical]]</div>Togart