@@ -4,19 +4,19 @@ The default installation uses sqlite3 for the django database. To configure
4
4
mysql or postgresql instead, see the database configuration section.
5
5
6
6
7
- ## Supported Install Options
8
- - [ Ubuntu 22 .04] ( #ubuntu-2204-jammy )
7
+ ## Supported Server Installation Options
8
+ - [ Ubuntu 24 .04] ( #ubuntu-2404-noble )
9
9
- [ Debian 12] ( #debian-12-bookworm )
10
- - [ CentOS 9 ] ( #centos-9 )
10
+ - [ Rocky 10 ] ( #rocky-10 )
11
11
- [ virtualenv + pip] ( #virtualenv--pip )
12
12
- [ Source] ( #source )
13
13
14
14
15
- ### Ubuntu 22 .04 (jammy )
15
+ ### Ubuntu 24 .04 (noble )
16
16
17
17
``` shell
18
18
curl -sS https://repo.openbytes.ie/openbytes.gpg > /usr/share/keyrings/openbytes.gpg
19
- echo " deb [signed-by=/usr/share/keyrings/openbytes.gpg] https://repo.openbytes.ie/patchman/ubuntu jammy main" > /etc/apt/sources.list.d/patchman.list
19
+ echo " deb [signed-by=/usr/share/keyrings/openbytes.gpg] https://repo.openbytes.ie/patchman/ubuntu noble main" > /etc/apt/sources.list.d/patchman.list
20
20
apt update
21
21
apt -y install python3-patchman patchman-client
22
22
patchman-manage createsuperuser
@@ -27,21 +27,23 @@ patchman-manage createsuperuser
27
27
``` shell
28
28
curl -sS https://repo.openbytes.ie/openbytes.gpg > /usr/share/keyrings/openbytes.gpg
29
29
echo " deb [signed-by=/usr/share/keyrings/openbytes.gpg] https://repo.openbytes.ie/patchman/debian bookworm main" > /etc/apt/sources.list.d/patchman.list
30
+ echo " deb http://deb.debian.org/debian bookworm-backports main" > /etc/apt/sources.list.d/backports.list
30
31
apt update
32
+ apt -y install -t bookworm-backports python3-django
31
33
apt -y install python3-patchman patchman-client
32
34
patchman-manage createsuperuser
33
35
```
34
36
35
- ### CentOS 9
37
+ ### Rocky 10
36
38
37
- This also applies to Rocky/ Alma/ RHEL
39
+ This also applies to Alma, RHEL, etc.
38
40
39
41
``` shell
40
42
curl -sS https://repo.openbytes.ie/openbytes.gpg > /etc/pki/rpm-gpg/RPM-GPG-KEY-openbytes
41
43
cat << EOF >> /etc/yum.repos.d/openbytes.repo
42
44
[openbytes]
43
45
name=openbytes
44
- baseurl=https://repo.openbytes.ie/patchman/el9
46
+ baseurl=https://repo.openbytes.ie/patchman/el10
45
47
enabled=1
46
48
gpgcheck=1
47
49
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-openbytes
@@ -60,7 +62,7 @@ TBD - not working yet
60
62
61
63
``` shell
62
64
apt -y install gcc libxml2-dev libxslt1-dev virtualenv python3-dev zlib1g-dev # (debian/ubuntu)
63
- dnf -y install gcc libxml2-devel libxslt-devel python3-virtualenv # (centos/ rocky/alma)
65
+ dnf -y install gcc libxml2-devel libxslt-devel python3-virtualenv # (rocky/alma/redhat )
64
66
mkdir /srv/patchman
65
67
cd /srv/patchman
66
68
python3 -m venv .venv
@@ -74,7 +76,7 @@ gunicorn patchman.wsgi -b 0.0.0.0:80
74
76
75
77
### Source
76
78
77
- #### Ubuntu 22 .04 (jammy )
79
+ #### Ubuntu 24 .04 (noble )
78
80
79
81
1 . Install dependencies
80
82
@@ -107,9 +109,9 @@ cp /srv/patchman/etc/patchman/local_settings.py /etc/patchman/
107
109
108
110
# Configuration
109
111
110
- ## Patchman Settings
112
+ ## Patchman Server Settings
111
113
112
- Modify ` /etc/patchman/local_settings.py ` to configure patchman.
114
+ Modify ` /etc/patchman/local_settings.py ` to configure the patchman server .
113
115
114
116
If installing from source or using virtualenv, the following settings should
115
117
be configured:
@@ -119,28 +121,32 @@ be configured:
119
121
* STATIC_ROOT - should point to ` /srv/patchman/run/static ` if installing from
120
122
source
121
123
122
- ## Patchman-client Settings
124
+ The default settings for errata downloading may include operating systems that
125
+ are not relevant to a given deployment. If this is the case, modify the
126
+ ` ERRATA_OS_UPDATES ` setting in ` /etc/patchman/local_settings.py ` . Further
127
+ distribution-specific settings are also available to only download errata
128
+ for specific versions/codenames.
123
129
124
- The client comes with a default configuration. This configuration will attempt to upload the reports to a server at * patchman.example.com * . This configuration needs to be updated to connect to your own patchman installation.
130
+ ## Patchman Client Settings
125
131
126
- In ` /etc/patchman/patchman-client.conf ` , look for the following line(s):
132
+ The client comes with a default configuration that will attempt to upload the
133
+ reports to a server at * patchman.example.com* . This configuration needs to be
134
+ updated to connect to the correct patchman server.
135
+
136
+ Change the following lines in ` /etc/patchman/patchman-client.conf ` :
127
137
128
138
```
129
139
# Patchman server
130
- server=https://patchman.example.com
140
+ server=https://patchman.example.com
131
141
132
142
# Options to curl
133
143
curl_options="--insecure --connect-timeout 60 --max-time 300"
134
144
135
- ...
136
145
```
137
- * * server* needs to point the URL where your patchman server
138
- is running
139
- * * --insecure* in the curl_options tells the client to ignore certificates, if you set them up correctly and are using patchman with "https:/...", you could remove this flag to increase security
140
-
141
-
142
-
143
-
146
+ * * server* needs to point the URL where the local patchman server is running
147
+ * * --insecure* in the curl options tells the client to ignore certificates.
148
+ If the patchman server is set up correctly with certificates this flag can
149
+ be removed to increase security.
144
150
145
151
## Configure Database
146
152
@@ -151,10 +157,13 @@ production deployments. MySQL or PostgreSQL are better choices.
151
157
152
158
To configure the sqlite database backend:
153
159
154
- 1 . Create the database directory specified in the settings file:
160
+ 1 . Create the database directory specified in the settings file, touch the
161
+ database file and set the journal mode to WAL:
155
162
156
163
``` shell
157
164
mkdir -p /var/lib/patchman/db
165
+ touch /var/lib/patchman/db/patchman.db
166
+ sqlite3 /var/lib/patchman/db/patchman.db ' PRAGMA journal_mode=WAL;'
158
167
```
159
168
160
169
2 . Modify ` /etc/patchman/local_settings.py ` as follows:
@@ -163,7 +172,7 @@ mkdir -p /var/lib/patchman/db
163
172
DATABASES = {
164
173
'default': {
165
174
'ENGINE': 'django.db.backends.sqlite3',
166
- 'NAME': '/var/lib/patchman/db/patchman.db'
175
+ 'NAME': '/var/lib/patchman/db/patchman.db',
167
176
}
168
177
}
169
178
```
@@ -199,16 +208,16 @@ Query OK, 0 rows affected (0.00 sec)
199
208
200
209
```
201
210
DATABASES = {
202
- 'default': {
203
- 'ENGINE': 'django.db.backends.mysql',
204
- 'NAME': 'patchman',
205
- 'USER': 'patchman',
206
- 'PASSWORD': 'changeme',
207
- 'HOST': '',
208
- 'PORT': '',
209
- 'STORAGE_ENGINE': 'INNODB',
210
- 'CHARSET' : 'utf8'
211
- }
211
+ 'default': {
212
+ 'ENGINE': 'django.db.backends.mysql',
213
+ 'NAME': 'patchman',
214
+ 'USER': 'patchman',
215
+ 'PASSWORD': 'changeme',
216
+ 'HOST': '',
217
+ 'PORT': '',
218
+ 'STORAGE_ENGINE': 'INNODB',
219
+ 'CHARSET': 'utf8',
220
+ }
212
221
}
213
222
```
214
223
@@ -250,15 +259,15 @@ GRANT
250
259
251
260
```
252
261
DATABASES = {
253
- 'default': {
254
- 'ENGINE': 'django.db.backends.postgresql_psycopg2',
255
- 'NAME': 'patchman',
256
- 'USER': 'patchman',
257
- 'PASSWORD': 'changeme',
258
- 'HOST': '127.0.0.1',
259
- 'PORT': '',
260
- 'CHARSET' : 'utf8'
261
- }
262
+ 'default': {
263
+ 'ENGINE': 'django.db.backends.postgresql_psycopg2',
264
+ 'NAME': 'patchman',
265
+ 'USER': 'patchman',
266
+ 'PASSWORD': 'changeme',
267
+ 'HOST': '127.0.0.1',
268
+ 'PORT': '',
269
+ 'CHARSET': 'utf8',
270
+ }
262
271
}
263
272
```
264
273
@@ -273,8 +282,7 @@ After configuring a database backend, the django database should be synced:
273
282
collect static files:
274
283
275
284
``` shell
276
- patchman-manage makemigrations
277
- patchman-manage migrate --run-syncdb --fake-initial
285
+ patchman-manage migrate --run-syncdb
278
286
patchman-manage createsuperuser
279
287
patchman-manage collectstatic
280
288
```
@@ -285,6 +293,27 @@ N.B. To run patchman-manage when installing from source, run `./manage.py`
285
293
2 . Restart the web server after syncing the database.
286
294
287
295
296
+ ### Migrate from sqlite to another database backend
297
+
298
+ The prebuilt package installations use sqlite as the default database backend,
299
+ but this is not recommended in production. To migrate from sqlite to another
300
+ database backend, use the following procedure:
301
+
302
+ 1 . Dump the sqlite database to a json file
303
+
304
+ ``` shell
305
+ patchman-manage dumpdata --exclude packages.Packagestring -e contenttypes -e auth.Permission --natural-foreign --natural-primary --indent 4 > patchman-db.json
306
+ ```
307
+
308
+ 2 . Create the new database and add the new database settings to ` /etc/patchman/local_settings.py `
309
+
310
+ 3 . Sync the new database and load the existing data:
311
+
312
+ ```
313
+ patchman-manage migrate --run-syncdb
314
+ patchman-manage loaddata patchman-db.json
315
+ ```
316
+
288
317
## Configure Web Server
289
318
290
319
### Apache
@@ -301,7 +330,7 @@ a2enconf patchman
301
330
302
331
``` shell
303
332
vi /etc/apache2/conf-available/patchman.conf
304
- service apache2 reload
333
+ systemctl reload apache2
305
334
```
306
335
307
336
3 . If installing from source, allow apache access to the settings and to the sqlite db:
@@ -321,9 +350,10 @@ The django interface should be available at http://127.0.0.1/patchman/
321
350
322
351
#### Daily cronjob on patchman server
323
352
324
- A daily cronjob on the patchman server should be run to process reports,
325
- perform database maintenance, check for upstream updates, and find updates for
326
- clients.
353
+ A daily cronjob on the patchman server can be run to process reports, perform
354
+ database maintenance, check for upstream updates, and find updates for clients.
355
+ Alternatively, run celery as outlined below for finer granularity over the
356
+ timing of these tasks and for increased concurrency.
327
357
328
358
```
329
359
patchman -a
@@ -337,16 +367,17 @@ patchman-client
337
367
338
368
### Celery
339
369
340
- Install Celery for realtime processing of reports from clients:
370
+ Install Celery for realtime processing of reports from clients and for periodic
371
+ maintenance tasks. The celery configuation file is in ` /etc/patchman/celery.conf `
341
372
342
373
#### Ubuntu / Debian
343
374
344
375
``` shell
345
376
apt -y install python3-celery redis python3-redis python-celery-common
346
- C_FORCE_ROOT=1 celery -b redis://127.0.0.1:6379/0 -A patchman worker -l INFO -E
377
+ /usr/bin/ celery --broker redis://127.0.0.1:6379/0 --app patchman worker --loglevel info --beat --scheduler django_celery_beat.schedulers:DatabaseScheduler --task-events --pool threads
347
378
```
348
379
349
- #### CentOS / Rocky / Alma
380
+ #### Rocky / Alma / RHEL
350
381
351
382
Currently waiting on https://bugzilla.redhat.com/show_bug.cgi?id=2032543
352
383
@@ -355,35 +386,69 @@ dnf -y install python3-celery redis python3-redis
355
386
systemctl restart redis
356
387
semanage port -a -t http_port_t -p tcp 6379
357
388
setsebool -P httpd_can_network_connect 1
358
- C_FORCE_ROOT=1 celery -b redis://127.0.0.1:6379/0 -A patchman worker -l INFO -E
389
+ /usr/bin/celery --broker redis://127.0.0.1:6379/0 --app patchman worker --loglevel info --beat --scheduler django_celery_beat.schedulers:DatabaseScheduler --task-events --pool threads
390
+ ```
391
+
392
+ #### Persistence
393
+
394
+ There is a systemd unit file for celery to make the service persistent over reboot:
395
+
396
+ ` etc/systemd/system/patchman-celery.service `
397
+
398
+ If installing from prebuilt packages, this should be enabled by default.
399
+
400
+
401
+ ### Caching
402
+
403
+ Memcached or Redis can optionally be run to reduce the load on the server.
404
+ Note that caching may result in the web interface showing results that are
405
+ out of date with the database, so this is disabled by default.
406
+
407
+
408
+ #### Redis
409
+
410
+ Install Redis:
411
+
412
+ ``` shell
413
+ apt -y install redis python3-redis # (debian/ubuntu)
414
+ dnf -y install redis python3-redis # (rocky/alma/redhat)
415
+ systemctl restart redis/redis-server
359
416
```
360
417
361
- Add the last command to an initscript (e.g. /etc/rc.local) to make celery
362
- persistent over reboot.
418
+ and add the following to ` /etc/patchman/local_settings.py `
363
419
364
- Enable celery by adding ` USE_ASYNC_PROCESSING = True ` to ` /etc/patchman/local_settings.py `
420
+ ```
421
+ CACHES = {
422
+ 'default': {
423
+ 'BACKEND': 'django.core.cache.backends.redis.RedisCache',
424
+ 'LOCATION': 'redis://127.0.0.1:6379',
425
+ 'TIMEOUT': 30,
426
+ }
427
+ }
428
+ ```
365
429
366
- ### Memcached
430
+ #### Memcacached
367
431
368
- Memcached can optionally be run to reduce the load on the server.
432
+ Install Memcached
369
433
370
434
``` shell
371
435
apt -y install memcached python3-pymemcache # (debian/ubuntu)
372
- dnf -y install memcached python3-pymemcache # (centos/ rocky/alma)
436
+ dnf -y install memcached python3-pymemcache # (rocky/alma/redhat )
373
437
systemctl restart memcached
374
438
```
375
439
376
440
and add the following to ` /etc/patchman/local_settings.py `
377
441
378
442
```
379
443
CACHES = {
380
- 'default': {
381
- 'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
382
- 'LOCATION': '127.0.0.1:11211',
444
+ 'default': {
445
+ 'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
446
+ 'LOCATION': '127.0.0.1:11211',
447
+ 'TIMEOUT': 30,
383
448
'OPTIONS': {
384
449
'ignore_exc': True,
385
450
},
386
- }
451
+ }
387
452
}
388
453
```
389
454
0 commit comments