Mercurial > libervia-pubsub
annotate doc/installation.rst @ 437:454f61a32427
backend: fixed item retractation notification
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 08 Feb 2021 19:01:29 +0100 |
parents | 80aca1cf1543 |
children | b38b8beac609 |
rev | line source |
---|---|
404 | 1 ============ |
2 Installation | |
3 ============ | |
4 | |
5 This are the instructions to install SàT Pubsub. | |
6 | |
7 .. note:: | |
8 | |
9 SàT PubSub is not released yet and this documentation is work in progress | |
10 | |
436
80aca1cf1543
doc: added a warning for people using SàT Pubsub on a server already used in production
Goffi <goffi@goffi.org>
parents:
427
diff
changeset
|
11 .. note:: |
80aca1cf1543
doc: added a warning for people using SàT Pubsub on a server already used in production
Goffi <goffi@goffi.org>
parents:
427
diff
changeset
|
12 |
80aca1cf1543
doc: added a warning for people using SàT Pubsub on a server already used in production
Goffi <goffi@goffi.org>
parents:
427
diff
changeset
|
13 /!\ Beware, if you're installing SàT Pubsub on a server already running in production, |
80aca1cf1543
doc: added a warning for people using SàT Pubsub on a server already used in production
Goffi <goffi@goffi.org>
parents:
427
diff
changeset
|
14 it will replace your legacy Pubsub service, meaning that everything stored there won't |
80aca1cf1543
doc: added a warning for people using SàT Pubsub on a server already used in production
Goffi <goffi@goffi.org>
parents:
427
diff
changeset
|
15 be available anymore (this includes, and is not limited to, bookmarks, encryption |
80aca1cf1543
doc: added a warning for people using SàT Pubsub on a server already used in production
Goffi <goffi@goffi.org>
parents:
427
diff
changeset
|
16 keys, blogs, etc.). |
80aca1cf1543
doc: added a warning for people using SàT Pubsub on a server already used in production
Goffi <goffi@goffi.org>
parents:
427
diff
changeset
|
17 |
80aca1cf1543
doc: added a warning for people using SàT Pubsub on a server already used in production
Goffi <goffi@goffi.org>
parents:
427
diff
changeset
|
18 Be sure to save everything from your legacy Pubsub service before switching to SàT |
80aca1cf1543
doc: added a warning for people using SàT Pubsub on a server already used in production
Goffi <goffi@goffi.org>
parents:
427
diff
changeset
|
19 Pubsub. |
80aca1cf1543
doc: added a warning for people using SàT Pubsub on a server already used in production
Goffi <goffi@goffi.org>
parents:
427
diff
changeset
|
20 |
80aca1cf1543
doc: added a warning for people using SàT Pubsub on a server already used in production
Goffi <goffi@goffi.org>
parents:
427
diff
changeset
|
21 Migration scripts are not yet available, help is welcome to write them. |
80aca1cf1543
doc: added a warning for people using SàT Pubsub on a server already used in production
Goffi <goffi@goffi.org>
parents:
427
diff
changeset
|
22 |
404 | 23 |
24 Requirements | |
25 ------------ | |
26 | |
421
f124ed5ea78b
doc: remove python2 references + added a warning for `python setup.py install`
Goffi <goffi@goffi.org>
parents:
409
diff
changeset
|
27 - Python 3.7+ |
425
968091cea547
doc: installation instructions corrections
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
28 - Python 3 "venv", which may be installed with Python 3 |
968091cea547
doc: installation instructions corrections
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
29 - Mercurial |
404 | 30 - Twisted >= 15.2.0: |
31 - Twisted Core | |
32 - Twisted Words | |
33 - Wokkel >= 0.7.1 (http://wokkel.ik.nu/) | |
34 - A XMPP server that supports the component protocol (XEP-0114), | |
35 and, to enable the micro-blogging feature, Namespace Delegation (XEP-0355) | |
36 and privileged entity (XEP-0356) are needed. | |
37 We recommend using Prosody with mod_privilege and mod_delegation modules (those modules | |
38 are maintained by us). | |
39 - SàT tmp (http://repos.goffi.org/sat_tmp) is currently needed for MAM and RSM handling | |
40 | |
41 For the PostgreSQL backend, the following is also required: | |
42 | |
43 - PostgreSQL >= 9.5 (including development files for psycopg2) | |
44 - psycopg2 | |
45 | |
46 Installation From Sources | |
47 ------------------------- | |
48 | |
49 To install SàT PubSub we'll work in a virtual environment. On Debian and derivatives you | |
50 should easily install dependencies with this:: | |
51 | |
425
968091cea547
doc: installation instructions corrections
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
52 sudo apt-get install postgresql python3-dev python3-venv python3-wheel mercurial |
404 | 53 |
54 Now go in a location where you can install SàT Pubsub, for instance your home directory:: | |
55 | |
56 $ cd | |
57 | |
421
f124ed5ea78b
doc: remove python2 references + added a warning for `python setup.py install`
Goffi <goffi@goffi.org>
parents:
409
diff
changeset
|
58 And enter the following commands:: |
404 | 59 |
421
f124ed5ea78b
doc: remove python2 references + added a warning for `python setup.py install`
Goffi <goffi@goffi.org>
parents:
409
diff
changeset
|
60 $ python3 -m venv env |
404 | 61 $ source env/bin/activate |
427
f6f4f99f1a1b
doc: explicite "wheel" installation + renamed "sat-pubsub.*" jids to simpler "pubsub.*"
Goffi <goffi@goffi.org>
parents:
425
diff
changeset
|
62 $ pip install wheel |
404 | 63 $ pip install hg+https://repos.goffi.org/sat_pubsub |
64 | |
421
f124ed5ea78b
doc: remove python2 references + added a warning for `python setup.py install`
Goffi <goffi@goffi.org>
parents:
409
diff
changeset
|
65 .. note:: |
f124ed5ea78b
doc: remove python2 references + added a warning for `python setup.py install`
Goffi <goffi@goffi.org>
parents:
409
diff
changeset
|
66 |
f124ed5ea78b
doc: remove python2 references + added a warning for `python setup.py install`
Goffi <goffi@goffi.org>
parents:
409
diff
changeset
|
67 If your are installing from a local clone of the repository, it has been reported that |
f124ed5ea78b
doc: remove python2 references + added a warning for `python setup.py install`
Goffi <goffi@goffi.org>
parents:
409
diff
changeset
|
68 installation with ``python setup.py install`` is not working properly. Please use ``pip |
f124ed5ea78b
doc: remove python2 references + added a warning for `python setup.py install`
Goffi <goffi@goffi.org>
parents:
409
diff
changeset
|
69 install .`` instead. |
f124ed5ea78b
doc: remove python2 references + added a warning for `python setup.py install`
Goffi <goffi@goffi.org>
parents:
409
diff
changeset
|
70 |
f124ed5ea78b
doc: remove python2 references + added a warning for `python setup.py install`
Goffi <goffi@goffi.org>
parents:
409
diff
changeset
|
71 |
404 | 72 Post Installation |
73 ----------------- | |
74 | |
75 Once SàT Pubsub is installed, you'll need to create a PostgreSQL user, and create the | |
76 database:: | |
77 | |
425
968091cea547
doc: installation instructions corrections
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
78 % sudo -u postgres createuser -d -P $(whoami) |
968091cea547
doc: installation instructions corrections
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
79 % createdb pubsub |
404 | 80 % cd /tmp && wget https://repos.goffi.org/sat_pubsub/raw-file/tip/db/pubsub.sql |
425
968091cea547
doc: installation instructions corrections
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
81 % psql pubsub < pubsub.sql |
404 | 82 |
83 | |
84 .. _prosody_configuration: | |
85 | |
86 Prosody Configuration | |
87 --------------------- | |
88 | |
89 SàT PubSub can work with any XMPP server (which supports components), but if you want to | |
90 use it as your PEP service, you need a server which supports `XEP-0355`_ and `XEP-0356`_. | |
91 | |
92 Below you'll find the instruction to use SàT PubSub as a PEP service with Prosody: | |
93 | |
94 - add these two lines at the end of your ``prosody.cfg.lua`` file, adapting them to your XMPP | |
95 server domain (virtual host) and selecting a password of your choice: | |
96 | |
97 .. sourcecode:: lua | |
98 | |
425
968091cea547
doc: installation instructions corrections
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
99 Component "pubsub.<xmpp_domain>" |
404 | 100 component_secret = "<password>" |
101 | |
102 - there are extra steps to enable the micro-blogging feature with Prosody. Please follow | |
103 the installation and configuration instructions that are given on these pages: | |
104 | |
105 - https://modules.prosody.im/mod_delegation.html | |
106 - https://modules.prosody.im/mod_privilege.html | |
107 | |
108 To keep your modules up to date, we recommend to clone the full modules | |
109 repository and then to symlink them like that: | |
110 | |
111 .. sourcecode:: shell | |
112 | |
113 % cd /path/to/install_dir | |
114 % hg clone https://hg.prosody.im/prosody-modules | |
115 % cd /path/to/prosody_plugins | |
116 % ln -sf /path/to/install_dir/prosody-modules/mod_delegation ./ | |
117 % ln -sf /path/to/install_dir/prosody-modules/mod_privilege ./ | |
118 | |
119 Or course, you have to adapt ``/path/to/install_dir`` to the directory where you want to | |
120 install the modules, and ``/path/to/prosody_plugins`` to the directory where prosody | |
121 modules are installed (hint: check ``prosodyctl about`` to find the latter). The ``ln`` | |
122 commands may have to be run as root depending on your installation. | |
123 | |
124 Once your symlinks are set, to update the modules we just need to type this: | |
125 | |
126 .. sourcecode:: shell | |
127 | |
425
968091cea547
doc: installation instructions corrections
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
128 % cd /path/to/install_dir/prosody-modules |
968091cea547
doc: installation instructions corrections
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
129 % hg pull -u |
404 | 130 |
131 Here is an example of how your ``prosody.cfg.lua`` should look like with | |
132 ``mod_delegation`` and ``mod_privilege`` activated: | |
133 | |
134 .. sourcecode:: lua | |
135 | |
136 [...] | |
137 modules_enabled = { | |
138 [...] | |
139 "delegation"; | |
140 "privilege"; | |
141 } | |
142 [...] | |
143 VirtualHost "<xmpp_domain>" | |
144 privileged_entities = { | |
427
f6f4f99f1a1b
doc: explicite "wheel" installation + renamed "sat-pubsub.*" jids to simpler "pubsub.*"
Goffi <goffi@goffi.org>
parents:
425
diff
changeset
|
145 ["pubsub.<xmpp_domain>"] = { |
404 | 146 roster = "get"; |
147 message = "outgoing"; | |
148 presence = "roster"; | |
149 }, | |
150 } | |
151 delegations = { | |
152 ["urn:xmpp:mam:2"] = { | |
153 filtering = {"node"}; | |
427
f6f4f99f1a1b
doc: explicite "wheel" installation + renamed "sat-pubsub.*" jids to simpler "pubsub.*"
Goffi <goffi@goffi.org>
parents:
425
diff
changeset
|
154 jid = "pubsub.<xmpp_domain>"; |
404 | 155 }, |
156 ["http://jabber.org/protocol/pubsub"] = { | |
427
f6f4f99f1a1b
doc: explicite "wheel" installation + renamed "sat-pubsub.*" jids to simpler "pubsub.*"
Goffi <goffi@goffi.org>
parents:
425
diff
changeset
|
157 jid = "pubsub.<xmpp_domain>"; |
404 | 158 }, |
159 ["http://jabber.org/protocol/pubsub#owner"] = { | |
427
f6f4f99f1a1b
doc: explicite "wheel" installation + renamed "sat-pubsub.*" jids to simpler "pubsub.*"
Goffi <goffi@goffi.org>
parents:
425
diff
changeset
|
160 jid = "pubsub.<xmpp_domain>"; |
404 | 161 }, |
162 ["https://salut-a-toi/protocol/schema:0"] = { | |
427
f6f4f99f1a1b
doc: explicite "wheel" installation + renamed "sat-pubsub.*" jids to simpler "pubsub.*"
Goffi <goffi@goffi.org>
parents:
425
diff
changeset
|
163 jid = "pubsub.<xmpp_domain>"; |
404 | 164 }, |
165 ["http://jabber.org/protocol/disco#items:*"] = { | |
427
f6f4f99f1a1b
doc: explicite "wheel" installation + renamed "sat-pubsub.*" jids to simpler "pubsub.*"
Goffi <goffi@goffi.org>
parents:
425
diff
changeset
|
166 jid = "pubsub.<xmpp_domain>"; |
404 | 167 }, |
168 ["https://salut-a-toi.org/spec/pubsub_admin:0"] = { | |
427
f6f4f99f1a1b
doc: explicite "wheel" installation + renamed "sat-pubsub.*" jids to simpler "pubsub.*"
Goffi <goffi@goffi.org>
parents:
425
diff
changeset
|
169 jid = "pubsub.<xmpp_domain>"; |
404 | 170 }, |
171 } | |
172 | |
427
f6f4f99f1a1b
doc: explicite "wheel" installation + renamed "sat-pubsub.*" jids to simpler "pubsub.*"
Goffi <goffi@goffi.org>
parents:
425
diff
changeset
|
173 Component "pubsub.<xmpp_domain>" |
404 | 174 component_secret = "<password>" |
175 modules_enabled = {"delegation", "privilege"} | |
176 | |
177 Of course, you still have to replace and adapt to your own settings. | |
178 | |
179 .. _XEP-0355: https://xmpp.org/extensions/xep-0355.html | |
180 .. _XEP-0356: https://xmpp.org/extensions/xep-0356.html | |
181 | |
182 Running SàT PubSub | |
183 ------------------ | |
184 | |
185 The minimal example for running sat_pubsub is: | |
186 | |
425
968091cea547
doc: installation instructions corrections
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
187 % twistd sat-pubsub |
404 | 188 |
189 This will start the service and run it in the background. It generates a | |
190 file twistd.pid that holds the PID of the service and a log file twistd.log. | |
191 The twistd utility has a fair number of options that might be useful, and | |
192 can be viewed with: | |
193 | |
194 % twistd --help | |
195 | |
196 When the service starts, it will connect to the XMPP server at the local machine using the | |
197 component protocol, and assumes the JID ``pubsub``. This assumes a couple of defaults | |
198 which can be overridden by passing parameters to the twistd plugin. You can get an | |
199 overview of the parameters and their defaults using: | |
200 | |
425
968091cea547
doc: installation instructions corrections
Goffi <goffi@goffi.org>
parents:
421
diff
changeset
|
201 % twistd sat-pubsub --help |
404 | 202 |
203 In particular, the following parameters will be of interest: | |
204 | |
205 ``--jid`` | |
206 The Jabber ID the component will assume. | |
207 | |
208 ``--rport`` | |
209 the port number of the XMPP server to connect to | |
210 | |
211 ``--xmpp_pwd`` | |
212 the secret used to authenticate with the XMPP server. | |
213 | |
214 For example:: | |
215 | |
427
f6f4f99f1a1b
doc: explicite "wheel" installation + renamed "sat-pubsub.*" jids to simpler "pubsub.*"
Goffi <goffi@goffi.org>
parents:
425
diff
changeset
|
216 twistd sat-pubsub --jid=pubsub.<your_xmpp_domain> --xmpp_pwd=<password> |
404 | 217 |
218 You can set your options in ``sat.conf`` which is the same file used as for Salut à Toi | |
219 ecosystem. Please check backend ``configuration`` section for details. The SàT PubSub | |
220 options must be in ``[pubsub]`` section. | |
221 |