Skip to content

Commit

Permalink
Merge pull request #468 from furlongm/django3
Browse files Browse the repository at this point in the history
django3 / 2023 distro support
  • Loading branch information
furlongm authored Dec 7, 2023
2 parents 40569b4 + 548b277 commit e5f1be5
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 34 deletions.
46 changes: 29 additions & 17 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,48 @@ mysql or postgresql instead, see the database configuration section.


## Supported Install Options
- [Ubuntu 20.04](#ubuntu-2004-focal)
- [Debian 11](#debian-11-bullseye)
- [CentOS 8](#centos-8)
- [Ubuntu 22.04](#ubuntu-2204-jammy)
- [Debian 12](#debian-12-bookworm)
- [CentOS 9](#centos-9)
- [virtualenv + pip](#virtualenv--pip)
- [Source](#source)


### Ubuntu 20.04 (focal)
### Ubuntu 22.04 (jammy)

```shell
curl -sS https://repo.openbytes.ie/openbytes.gpg > /usr/share/keyrings/openbytes.gpg
echo "deb [signed-by=/usr/share/keyrings/openbytes.gpg] https://repo.openbytes.ie/patchman/ubuntu focal main" > /etc/apt/sources.list.d/patchman.list
echo "deb [signed-by=/usr/share/keyrings/openbytes.gpg] https://repo.openbytes.ie/patchman/ubuntu jammy main" > /etc/apt/sources.list.d/patchman.list
apt update
apt -y install python3-patchman patchman-client
patchman-manage createsuperuser
```

### Debian 11 (bullseye)
### Debian 12 (bookworm)

```shell
curl -sS https://repo.openbytes.ie/openbytes.gpg > /usr/share/keyrings/openbytes.gpg
echo "deb [signed-by=/usr/share/keyrings/openbytes.gpg] https://repo.openbytes.ie/patchman/debian bullseye main" > /etc/apt/sources.list.d/patchman.list
echo "deb [signed-by=/usr/share/keyrings/openbytes.gpg] https://repo.openbytes.ie/patchman/debian bookworm main" > /etc/apt/sources.list.d/patchman.list
apt update
apt -y install python3-patchman patchman-client
patchman-manage createsuperuser
```

### CentOS 8
### CentOS 9

This also applies to Rocky/Alma/RHEL

```shell
curl -sS https://repo.openbytes.ie/openbytes.gpg > /etc/pki/rpm-gpg/RPM-GPG-KEY-openbytes
cat <<EOF >> /etc/yum.repos.d/openbytes.repo
[openbytes]
name=openbytes
baseurl=https://repo.openbytes.ie/patchman/el8
baseurl=https://repo.openbytes.ie/patchman/el9
enabled=1
gpgcheck=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-openbytes
EOF
update-crypto-policies --set DEFAULT:SHA1
dnf -y install epel-release
dnf makecache
dnf -y install patchman patchman-client
Expand All @@ -55,7 +60,7 @@ TBD - not working yet

```shell
apt -y install gcc libxml2-dev libxslt1-dev virtualenv python3-dev zlib1g-dev # (debian/ubuntu)
dnf -y install gcc libxml2-devel libxslt-devel python3-virtualenv # (centos/rhel)
dnf -y install gcc libxml2-devel libxslt-devel python3-virtualenv # (centos/rocky/alma)
mkdir /srv/patchman
cd /srv/patchman
virtualenv .
Expand All @@ -69,7 +74,7 @@ gunicorn patchman.wsgi -b 0.0.0.0:80

### Source

#### Ubuntu 20.04 (focal)
#### Ubuntu 22.04 (jammy)

1. Install dependencies

Expand Down Expand Up @@ -111,7 +116,7 @@ be configured:

* ADMINS - set up an admin email address
* SECRET_KEY - create a random secret key
* STATICFILES_DIRS - should point to /srv/patchman/patchman/static if installing from
* STATIC_ROOT - should point to `/srv/patchman/run/static` if installing from
source


Expand Down Expand Up @@ -212,6 +217,8 @@ postgres=# ALTER ROLE patchman SET timezone TO 'UTC';
ALTER ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE patchman to patchman;
GRANT
postgres=# GRANT ALL ON SCHEMA public TO patchman;
GRANT
```

3. Modify `/etc/patchman/local_settings.py` as follows:
Expand Down Expand Up @@ -314,7 +321,9 @@ apt -y install python3-celery redis python3-redis python-celery-common
C_FORCE_ROOT=1 celery -b redis://127.0.0.1:6379/0 -A patchman worker -l INFO -E
```

#### CentOS / RHEL
#### CentOS / Rocky / Alma

Currently waiting on https://bugzilla.redhat.com/show_bug.cgi?id=2032543

```shell
dnf -y install python3-celery redis python3-redis
Expand All @@ -334,8 +343,8 @@ Enable celery by adding `USE_ASYNC_PROCESSING = True` to `/etc/patchman/local_se
Memcached can optionally be run to reduce the load on the server.

```shell
apt -y install memcached python3-memcache # (debian/ubuntu)
dnf -y install memcached python3-memcached # (centos/rhel)
apt -y install memcached python3-pymemcache # (debian/ubuntu)
dnf -y install memcached python3-pymemcache # (centos/rocky/alma)
systemctl restart memcached
```

Expand All @@ -344,8 +353,11 @@ and add the following to `/etc/patchman/local_settings.py`
```
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
'LOCATION': '127.0.0.1:11211',
'OPTIONS': {
'ignore_exc': True,
},
}
}
```
Expand Down
8 changes: 4 additions & 4 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ Section: python
Priority: optional
Maintainer: Marcus Furlong <[email protected]>
Uploaders: Marcus Furlong <[email protected]>
Build-Depends: debhelper (>=12), python3 (>= 3.6), dh-python, dh-exec
Standards-Version: 4.3.0
Build-Depends: debhelper (>=13), python3 (>= 3.10), dh-python, dh-exec
Standards-Version: 4.6.2
Homepage: https://github.com/furlongm/patchman
Vcs-Git: git://github.com/furlongm/patchman
Vcs-Browser: https://github.com/furlongm/patchman
X-Python3-Version: >= 3.6
X-Python3-Version: >= 3.10

Package: python3-patchman
Architecture: all
Homepage: https://github.com/furlongm/patchman
Depends: ${misc:Depends}, python3 (>= 3.6), python3-django (>= 2.2),
Depends: ${misc:Depends}, python3 (>= 3.10), python3-django (>= 3.2),
python3-django-tagging, python3-django-extensions, python3-django-bootstrap3,
python3-djangorestframework, python3-django-filters, python3-debian,
python3-rpm, python3-progressbar, python3-lxml, python3-defusedxml,
Expand Down
5 changes: 4 additions & 1 deletion etc/patchman/local_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
# Enable memcached
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
'LOCATION': '127.0.0.1:11211',
'OPTIONS': {
'ignore_exc': True,
},
}
}
2 changes: 2 additions & 0 deletions patchman/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
USE_L10N = True
USE_TZ = False

DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'

DEFAULT_APPS = [
'django.contrib.admin',
'django.contrib.auth',
Expand Down
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Django==2.2.28
Django==3.2.22
django-tagging==0.5.0
django-extensions==3.1.5
django-bootstrap3==15.0.0
django-extensions==3.2.1
django-bootstrap3==23.1
progressbar==2.5
python-debian==0.1.43
lxml==4.7.1
python-debian==0.1.49
lxml==4.9.2
defusedxml==0.7.1
PyYAML==6.0
chardet==4.0.0
Expand All @@ -15,4 +15,4 @@ django-filter==21.1
humanize==3.13.1
version-utils==0.3.0
python-magic==0.4.25
python-memcached==1.59
pymemcache==4.0.0
7 changes: 4 additions & 3 deletions scripts/rpm-post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ if [ ! -e /etc/httpd/conf.d/patchman.conf ] ; then
cp /etc/patchman/apache.conf.example /etc/httpd/conf.d/patchman.conf
fi

if ! grep /usr/lib/python3.6/site-packages /etc/httpd/conf.d/patchman.conf >/dev/null 2>&1 ; then
sed -i -e "s/^\(Define patchman_pythonpath\).*/\1 \/usr\/lib\/python3.6\/site-packages/" \
if ! grep /usr/lib/python3.9/site-packages /etc/httpd/conf.d/patchman.conf >/dev/null 2>&1 ; then
sed -i -e "s/^\(Define patchman_pythonpath\).*/\1 \/usr\/lib\/python3.9\/site-packages/" \
/etc/httpd/conf.d/patchman.conf
fi

service httpd reload
systemctl enable httpd
systemctl restart httpd

patchman-set-secret-key
chown apache /etc/patchman/local_settings.py
Expand Down
7 changes: 4 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ doc_files = README.md AUTHORS COPYING INSTALL.md
install-script = scripts/rpm-install.sh
post-install = scripts/rpm-post-install.sh
requires = /usr/bin/python3
python3-django >= 2.2.9
python3-django >= 3.2.20
python3-django-tagging
python3-django-extensions
django-bootstrap3
python3-django-bootstrap3
python3-django-rest-framework
python3-django-filter
python3-debian
Expand All @@ -19,7 +19,8 @@ requires = /usr/bin/python3
python3-magic
python3-humanize
memcached
python3-memcached
python3-pyyaml
python3-pymemcache
python3-mod_wsgi
python3-importlib-metadata
policycoreutils-python-utils
Expand Down

0 comments on commit e5f1be5

Please sign in to comment.