This is debian specific customization of https://wiki.diasporafoundation.org/Integration/XMPP/Prosody

Needs at least Jessie and works with diaspora-installer package.

Note: Examples use im.example.org (substitute your pod name)

1. Install prosody

sudo apt-get install prosody/bookworm-backports prosody-modules/bookworm-backports

Note: Refer Installing Prosody guide for more detailed configuration.

2. Install lua bcrypt

sudo apt-get install luarocks liblua5.4-dev
sudo luarocks-5.4 install bcrypt
sudo luarocks-5.4 install LuaSec

3. ssl path in /etc/prosody/prosody.cfg.lua

ssl = {
        key = "/etc/diaspora/ssl/im.example.org.key";
        certificate = "/etc/diaspora/ssl/im.example.org-bundle.pem";
}

OR

# ln -sf /etc/diaspora/ssl/im.example.org-bundle.pem /etc/prosody/certs/localhost.cert 
# ln -sf /etc/diaspora/ssl/im.example.org.key /etc/prosody/certs/localhost.key

Also set c2s_require_encryption = true

4. Download diaspora auth modules

We'll store them in /usr/lib/prosody/modules which is the default location prosody looks for, for modules. Note: These modules are now available as ruby-diaspora-prosody-config package.

curl https://gist.githubusercontent.com/jhass/948e8e8d87b9143f97ad/raw/mod_auth_diaspora.lua > /usr/lib/prosody/modules/mod_auth_diaspora.lua

curl https://gist.githubusercontent.com/jhass/948e8e8d87b9143f97ad/raw/mod_diaspora_contacts.lua > /usr/lib/prosody/modules/mod_diaspora_contacts.lua

5. Install DBI module

If database in use is Postgresql

sudo apt-get install lua-dbi-postgresql

If database in use is MySQL

sudo apt-get install lua-dbi-mysql

6. Configure domain in /etc/prosody/prosody.cfg.lua

Or better create im.example.org.cfg.lua in /etc/prosody/conf.d

If database in use is Postgresql

VirtualHost "im.example.org"
  authentication = "diaspora"
  auth_diaspora = { driver = "PostgreSQL", database = "diaspora_production", username = "prosody", password = "pass", host = "/var/run/postgresql" }

  modules_enabled = {
    "diaspora_contacts";
  };

If database in use is MySQL

VirtualHost "im.example.org"
  authentication = "diaspora"
  auth_diaspora = { driver = "MySQL", database = "diaspora_production", username = "prosody", password = "pass", host = "localhost" }

  modules_enabled = {
    "diaspora_contacts";
  };

Note: although we downloaded two modules, we're enabling only the diaspora_contacts module via modules_enabled. The auth_diaspora module is enabled via authentication just above.

7. Add prosody database user and grant permissions

createuser --interactive can be used to create a postgres user easily. We need to create the role "prosody". Say no to all extra privileges.

sudo -u postgres psql diaspora_production;
grant all privileges on database diaspora_production to prosody;

GRANT SELECT ON ALL TABLES IN SCHEMA public TO prosody;

Note for letsencrypt users: You'll need to give permissions to prosody user to the certificates.

 # chown -R root:ssl-cert /etc/letsencrypt
 # chmod g+r -R /etc/letsencrypt
 # chmod g+x /etc/letsencrypt/{archive,live}

8. Other recommendations

9. Restart prosody

sudo /etc/init.d/prosody restart

10. Further steps

Troubleshooting

For troubleshooting, look at following log files

/var/log/prosody/prosody.err
/var/log/prosody/prosody.log

/var/log/postgresql/*.log

/var/log/mysql.log
/var/log/mysql/error.log

In prosody.cfg.lua, under logging, change info to debug to get more detailed log messages of prosody.