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