Replace Rocky Linux support with RHEL 9

This commit is contained in:
Théophile Diot 2024-02-06 15:26:38 +01:00
parent 578a97e28c
commit 1bedc4b766
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06
23 changed files with 152 additions and 489 deletions

View file

@ -94,7 +94,7 @@ jobs:
needs: [create-arm]
strategy:
matrix:
linux: [ubuntu, debian, fedora, rhel, rockylinux]
linux: [ubuntu, debian, fedora, rhel, rhel9]
platforms: [linux/amd64, linux/arm64]
include:
- release: beta
@ -106,7 +106,7 @@ jobs:
package: rpm
- linux: rhel
package: rpm
- linux: rockylinux
- linux: rhel9
package: rpm
uses: ./.github/workflows/linux-build.yml
with:
@ -179,7 +179,7 @@ jobs:
needs: [wait-builds]
strategy:
matrix:
linux: [ubuntu, debian, fedora, rhel, rockylinux]
linux: [ubuntu, debian, fedora, el]
arch: [amd64, arm64]
include:
- release: beta
@ -204,10 +204,10 @@ jobs:
suffix: "1."
version: 8
package: rpm
- linux: rockylinux
- linux: el
separator: "-"
suffix: "1."
version: 9.3
version: 9
package: rpm
- linux: ubuntu
arch: amd64
@ -221,9 +221,11 @@ jobs:
- linux: el
arch: amd64
package_arch: x86_64
- linux: rockylinux
version: 8
- linux: el
arch: amd64
package_arch: x86_64
version: 9
- linux: ubuntu
arch: arm64
package_arch: arm64
@ -236,9 +238,11 @@ jobs:
- linux: el
arch: arm64
package_arch: aarch64
- linux: rockylinux
version: 8
- linux: el
arch: arm64
package_arch: aarch64
version: 9
uses: ./.github/workflows/push-packagecloud.yml
with:
SEPARATOR: ${{ matrix.separator }}

View file

@ -43,7 +43,7 @@ jobs:
packages: write
strategy:
matrix:
linux: [ubuntu, debian, fedora, rhel, rockylinux]
linux: [ubuntu, debian, fedora, rhel, rhel9]
include:
- linux: ubuntu
package: deb
@ -53,7 +53,7 @@ jobs:
package: rpm
- linux: rhel
package: rpm
- linux: rockylinux
- linux: rhel9
package: rpm
uses: ./.github/workflows/linux-build.yml
with:
@ -164,7 +164,7 @@ jobs:
needs: [tests-ui-linux, tests-core-linux]
strategy:
matrix:
linux: [ubuntu, debian, fedora, el, rockylinux]
linux: [ubuntu, debian, fedora, el]
arch: [amd64]
include:
- release: dev
@ -193,11 +193,11 @@ jobs:
suffix: "1."
version: 8
package: rpm
- linux: rockylinux
- linux: el
package_arch: x86_64
separator: "-"
suffix: "1."
version: 9.3
version: 9
package: rpm
uses: ./.github/workflows/push-packagecloud.yml
with:

View file

@ -51,12 +51,12 @@ jobs:
- uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
if: inputs.LINUX != 'el'
with:
name: package-${{ inputs.LINUX }}-${{ inputs.PACKAGE_ARCH }}
name: package-rhel-${{ inputs.PACKAGE_ARCH }}
path: /tmp/${{ inputs.LINUX }}
- uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
if: inputs.LINUX == 'el'
if: inputs.LINUX == 'el' and inputs.VERSION == '9'
with:
name: package-rhel-${{ inputs.PACKAGE_ARCH }}
name: package-rhel9-${{ inputs.PACKAGE_ARCH }}
path: /tmp/${{ inputs.LINUX }}
# Remove existing packages
- name: Remove existing package

View file

@ -104,7 +104,7 @@ jobs:
needs: [create-arm]
strategy:
matrix:
linux: [ubuntu, debian, fedora, rhel, rockylinux]
linux: [ubuntu, debian, fedora, rhel, rhel9]
platforms: [linux/amd64, linux/arm64]
include:
- release: latest
@ -116,7 +116,7 @@ jobs:
package: rpm
- linux: rhel
package: rpm
- linux: rockylinux
- linux: rhel9
package: rpm
uses: ./.github/workflows/linux-build.yml
with:
@ -191,7 +191,7 @@ jobs:
needs: [wait-builds]
strategy:
matrix:
linux: [ubuntu, debian, fedora, el, rockylinux]
linux: [ubuntu, debian, fedora, el]
arch: [amd64, arm64]
include:
- release: latest
@ -216,10 +216,10 @@ jobs:
suffix: "1."
version: 8
package: rpm
- linux: rockylinux
- linux: el
separator: "-"
suffix: "1."
version: 9.3
version: 9
package: rpm
- linux: ubuntu
arch: amd64
@ -233,9 +233,11 @@ jobs:
- linux: el
arch: amd64
package_arch: x86_64
- linux: rockylinux
version: 8
- linux: el
arch: amd64
package_arch: x86_64
version: 9
- linux: ubuntu
arch: arm64
package_arch: arm64
@ -248,9 +250,11 @@ jobs:
- linux: el
arch: arm64
package_arch: aarch64
- linux: rockylinux
version: 8
- linux: el
arch: arm64
package_arch: aarch64
version: 9
uses: ./.github/workflows/push-packagecloud.yml
with:
SEPARATOR: ${{ matrix.separator }}

View file

@ -84,9 +84,9 @@ jobs:
- name: Pull BW linux rhel test image
if: inputs.TYPE == 'linux'
run: docker pull ghcr.io/bunkerity/rhel-tests:testing && docker tag ghcr.io/bunkerity/rhel-tests:testing local/rhel:latest
- name: Pull BW linux rockylinux test image
if: inputs.TYPE == 'linux'
run: docker pull ghcr.io/bunkerity/rockylinux-tests:testing && docker tag ghcr.io/bunkerity/rockylinux-tests:testing local/rockylinux:latest
- name: Pull BW linux rhel9 test image
if: inputs.TYPE == 'rhel9'
run: docker pull ghcr.io/bunkerity/rhel9-tests:testing && docker tag ghcr.io/bunkerity/rhel9-tests:testing local/rhel9:latest
# Do tests
- name: Run tests
if: inputs.TYPE == 'docker'
@ -139,9 +139,9 @@ jobs:
env:
TEST_DOMAINS: ${{ secrets.TEST_DOMAINS_LINUX }}
ROOT_DOMAIN: ${{ secrets.ROOT_DOMAIN }}
- name: Run Linux rockylinux tests
- name: Run Linux rhel9 tests
if: inputs.TYPE == 'linux'
run: export $(echo "$TEST_DOMAINS" | xargs) && ./tests/main.py "linux" "rockylinux"
run: export $(echo "$TEST_DOMAINS" | xargs) && ./tests/main.py "linux" "rhel9"
env:
TEST_DOMAINS: ${{ secrets.TEST_DOMAINS_LINUX }}
ROOT_DOMAIN: ${{ secrets.ROOT_DOMAIN }}

View file

@ -43,7 +43,7 @@ jobs:
packages: write
strategy:
matrix:
linux: [ubuntu, debian, fedora, rhel, rockylinux]
linux: [ubuntu, debian, fedora, rhel, rhel9]
include:
- linux: ubuntu
package: deb
@ -53,7 +53,7 @@ jobs:
package: rpm
- linux: rhel
package: rpm
- linux: rockylinux
- linux: rhel9
package: rpm
uses: ./.github/workflows/linux-build.yml
with:
@ -199,7 +199,7 @@ jobs:
needs: [staging-tests, tests-ui-linux, tests-core-linux]
strategy:
matrix:
linux: [ubuntu, debian, fedora, el, rockylinux]
linux: [ubuntu, debian, fedora, el]
arch: [amd64]
include:
- release: testing
@ -228,11 +228,11 @@ jobs:
suffix: "1."
version: 8
package: rpm
- linux: rockylinux
- linux: el
package_arch: x86_64
separator: "-"
suffix: "1."
version: 9.3
version: 9
package: rpm
uses: ./.github/workflows/push-packagecloud.yml
with:

View file

@ -2,7 +2,7 @@
## v1.5.6 - YYYY/MM/DD
- [LINUX] Support Rocky Linux 9.3
- [LINUX] Support RHEL 9.3
- [BUGFIX] Fix issues with the antibot feature ([#866](https://github.com/bunkerity/bunkerweb/issues/866), [#870](https://github.com/bunkerity/bunkerweb/issues/870))
- [UI] Add bans management page in the web UI
- [UI] Add blocked requests page in the web UI

View file

@ -259,7 +259,7 @@ List of supported Linux distros :
- Ubuntu 22.04 "Jammy"
- Fedora 39
- RHEL 8.9
- Rocky Linux 9.3
- RHEL 9.3
Repositories of Linux packages for BunkerWeb are available on [PackageCloud](https://packagecloud.io/bunkerity/bunkerweb), they provide a bash script to automatically add and trust the repository (but you can also follow the [manual installation](https://packagecloud.io/bunkerity/bunkerweb/install) instructions if you prefer).
@ -277,7 +277,7 @@ List of supported Linux distros :
- Ubuntu 22.04 "Jammy"
- Fedora 39
- RHEL 8.9
- Rocky Linux 9.3
- RHEL 9.3
[Ansible](https://www.ansible.com/) is an IT automation tool. It can configure systems, deploy software, and orchestrate more advanced IT tasks such as continuous deployments or zero downtime rolling updates.

View file

@ -950,7 +950,7 @@ Supported Linux distributions for BunkerWeb (amd64/x86_64 and arm64/aarch64 arch
- Ubuntu 22.04 "Jammy"
- Fedora 39
- Red Hat Enterprise Linux (RHEL) 8.9
- Rocky Linux 9.3
- Red Hat Enterprise Linux (RHEL) 9.3
Please ensure that you have **NGINX 1.24.0 installed before installing BunkerWeb**. For all distributions, except Fedora, it is mandatory to use prebuilt packages from the [official NGINX repository](https://nginx.org/en/linux_packages.html). Compiling NGINX from source or using packages from different repositories will not work with the official prebuilt packages of BunkerWeb. However, you have the option to build BunkerWeb from source.
@ -1055,7 +1055,7 @@ To simplify the installation process, Linux package repositories for BunkerWeb a
sudo dnf versionlock add bunkerweb
```
=== "RedHat / Rocky Linux"
=== "RedHat"
The first step is to add NGINX official repository. Create the following file at `/etc/yum.repos.d/nginx.repo` :
@ -1126,7 +1126,7 @@ Supported Linux distributions for BunkerWeb (amd64/x86_64 and arm64/aarch64 arch
- Ubuntu 22.04 "Jammy"
- Fedora 39
- Red Hat Enterprise Linux (RHEL) 8.9
- Rocky Linux 9.3
- Red Hat Enterprise Linux (RHEL) 9.3
To simplify the deployment and configuration process, [Ansible](https://docs.ansible.com/ansible/latest/index.html) can be used as an IT automation tool. Ansible enables you to configure systems, deploy software, and perform advanced IT tasks such as continuous deployments or zero downtime rolling updates.

View file

@ -309,7 +309,7 @@ In case you lost your UI credentials or have 2FA issues, you can connect to the
sudo apt install sqlite3
```
Install SQLite (Fedora/RedHat/Rocky Linux) :
Install SQLite (Fedora/RedHat) :
```shell
sudo dnf install sqlite

View file

@ -12,7 +12,6 @@ COPY src/linux/RPM-GPG-KEY-centosofficial /etc/pki/rpm-gpg/RPM-GPG-KEY-centosoff
# Import RPM-GPG-KEY-CentOS-Official
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
COPY src/linux/nginx.repo /etc/yum.repos.d/nginx.repo
# Install Nginx, fpm and dependencies
RUN dnf install -y ruby ruby-devel make gcc redhat-rpm-config rpm-build wget \

View file

@ -1,14 +1,26 @@
FROM rockylinux:9.3@sha256:c944604c0c759f5d164ffbdf0bbab2fac582b739938937403c067ab634a0518a
FROM redhat/ubi9:9.3@sha256:1fafb0905264413501df60d90a92ca32df8a2011cbfb4876ddff5ceb20c8f165
ENV OS=rockylinux
ENV OS=rhel
ENV NGINX_VERSION 1.24.0
# Copy centos repo
COPY src/linux/centos-9.repo /etc/yum.repos.d/centos.repo
RUN sed -i "s/%ARCH%/$(uname -m)/g" /etc/yum.repos.d/centos.repo
# Copy RPM-GPG-KEY-CentOS-Official
COPY src/linux/RPM-GPG-KEY-centosofficial /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
# Import RPM-GPG-KEY-CentOS-Official
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
# Install Nginx, fpm and dependencies
RUN dnf install -y epel-release ruby ruby-devel make gcc redhat-rpm-config rpm-build wget \
RUN dnf install -y ruby ruby-devel make gcc redhat-rpm-config rpm-build wget \
yum-utils && \
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
rpm -Uvh epel-release*rpm && \
dnf module -y reset ruby && dnf module -y enable ruby:3.1 && dnf module -y install ruby:3.1/common && \
gem install fpm && \
dnf install -y --skip-broken --setopt=install_weak_deps=False readline-devel python39 python39-devel python39-setuptools brotli brotli-devel gperftools-devel perl libxslt-devel libxml2 yajl yajl-devel libxslt bash gd gd-devel gcc-c++ curl znc-modtcl gawk libtool pcre-devel automake autoconf gcc make openssl-devel git zlib-devel libxml2-devel pkgconf libcurl-devel geoip-devel && \
dnf install -y --skip-broken --setopt=install_weak_deps=False readline-devel python39 brotli brotli-devel gperftools-devel perl libxslt-devel libxml2 yajl libxslt bash gd gd-devel gcc-c++ znc-modtcl gawk libtool pcre-devel automake autoconf gcc make openssl-devel git zlib-devel libxml2-devel pkgconf libcurl-devel libmaxminddb && \
wget https://nginx.org/packages/rhel/9/$(uname -m)/RPMS/nginx-${NGINX_VERSION}-1.el9.ngx.$(uname -m).rpm && \
dnf install nginx-${NGINX_VERSION}-1.el9.ngx.$(uname -m).rpm -y && \
rm -rf nginx-${NGINX_VERSION}-1.el9.ngx.$(uname -m).rpm
@ -88,7 +100,7 @@ RUN cp helpers/bwcli /usr/bin/ && \
COPY src/linux/scripts scripts
COPY src/linux/fpm.sh /usr/share/fpm.sh
RUN chmod +x scripts/*.sh /usr/share/fpm.sh
COPY src/linux/fpm-rockylinux /usr/share/.fpm
COPY src/linux/fpm-rhel9 /usr/share/.fpm
COPY src/linux/*.service /lib/systemd/system/
# Generate RPM at startup

13
src/linux/centos-9.repo Normal file
View file

@ -0,0 +1,13 @@
[centos9-base]
name = CentOS 9 Base OS
baseurl = https://mirror.stream.centos.org/9-stream/BaseOS/%ARCH%/os/
gpgcheck = 1
enabled = 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[centos9-appstream]
name = CentOS 9 AppStream
baseurl = https://mirror.stream.centos.org/9-stream/AppStream/%ARCH%/os/
gpgcheck = 1
enabled = 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

View file

@ -4,7 +4,7 @@
--version %VERSION%
--architecture %ARCH%
--depends bash --depends python39 --depends 'nginx >= 1:1.24.0' --depends 'nginx < 1:1.25.0' --depends libcurl-devel --depends libxml2 --depends yajl --depends file-libs --depends net-tools --depends gd --depends sudo --depends procps --depends lsof --depends libmaxminddb --depends libpq --depends libcap --depends openssl
--description "BunkerWeb %VERSION% for Rocky Linux 9"
--description "BunkerWeb %VERSION% for RHEL 9"
--url "https://www.bunkerweb.io"
--maintainer "Bunkerity <contact at bunkerity dot com>"
--before-install /usr/share/bunkerweb/scripts/beforeInstall.sh

View file

@ -38,7 +38,7 @@ if [ -f "src/VERSION" ] ; then
version="$(tr -d '\n' < src/VERSION)"
fi
type="deb"
if [ "$linux" = "fedora" ] || [ "$linux" = "centos" ] || [ "$linux" = "rhel" ] || [ "$linux" = "rockylinux" ] ; then
if [ "$linux" = "fedora" ] || [ "$linux" = "centos" ] || [[ "$linux" = rhel* ]] ; then
type="rpm"
fi
do_and_check_cmd docker run --rm -v "${package_dir}:/data" "local/bunkerweb-${linux}:latest" "$type"

View file

@ -118,7 +118,7 @@ else
OS=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
fi
if ! [[ "$OS" =~ (centos|fedora|redhat|rockylinux) ]]; then
if ! [[ "$OS" =~ (centos|fedora|redhat) ]]; then
echo "❌ Unsupported Operating System"
exit 1
fi

View file

@ -29,7 +29,7 @@ if [ -f /etc/os-release ]; then
echo " Copy /var/tmp/ui.env to /etc/bunkerweb/ui.env"
do_and_check_cmd cp -f /var/tmp/ui.env /etc/bunkerweb/ui.env
fi
elif [[ "$OS" == "Red Hat Enterprise Linux" || "$OS" == "Fedora" || "$OS" == "Rocky Linux" ]]; then
elif [[ "$OS" == "Red Hat Enterprise Linux" || "$OS" == "Fedora" ]]; then
# Get the version of the package
VERSION=$(rpm -q --queryformat '%{VERSION}' bunkerweb)
if [ "$(printf '%s\n' "$VERSION" "$(echo '1.5.6' | tr -d ' ')" | sort -V | head -n 1)" = "$VERSION" ] && [ -f /var/tmp/variables.env ] && [ -f /var/tmp/ui.env ]; then

View file

@ -11,7 +11,7 @@ class LinuxTest(Test):
def __init__(self, name, timeout, tests, distro, domains={}):
super().__init__(name, "linux", timeout, tests, delay=20)
self._domains = domains
if distro not in ("ubuntu", "debian", "fedora", "centos", "rhel", "rockylinux"):
if distro not in ("ubuntu", "debian", "fedora", "centos") and not distro.startswith("rhel"):
raise Exception(f"unknown distro {distro}")
self.__distro = distro
@ -26,7 +26,7 @@ class LinuxTest(Test):
raise Exception("docker run failed (linux stack)")
if distro in ("ubuntu", "debian"):
cmd = "echo force-bad-version >> /etc/dpkg/dpkg.cfg ; apt install -y /opt/\\$(ls /opt | grep deb)"
elif distro in ("centos", "fedora", "rhel", "rockylinux"):
elif distro in ("centos", "fedora") or distro.startswith("rhel"):
cmd = "dnf install -y /opt/\\$(ls /opt | grep rpm)"
proc = LinuxTest.docker_exec(distro, cmd)
if proc.returncode != 0:
@ -53,7 +53,7 @@ class LinuxTest(Test):
"/etc/php/8.2/fpm/pool.d/www.conf",
)
LinuxTest.docker_exec(distro, "systemctl stop php8.2-fpm ; systemctl start php8.2-fpm")
elif distro in ("centos", "fedora", "rhel", "rockylinux"):
elif distro in ("centos", "fedora") or distro.startswith("rhel"):
LinuxTest.docker_exec(distro, "dnf install -y php-fpm unzip")
LinuxTest.docker_cp(distro, "./tests/www-rpm.conf", "/etc/php-fpm.d/www.conf")
LinuxTest.docker_exec(

View file

@ -1584,7 +1584,7 @@ elif distro == "fedora":
if "KO" in test_results.values():
sys.exit(1)
elif distro == "rhel":
elif distro.startswith("rhel"):
test_results = {
"Installation test": None,
"Reloading test": None,
@ -1597,9 +1597,9 @@ elif distro == "rhel":
"docker",
"build",
"-t",
"rhel-image",
f"{distro}-image",
"-f",
"src/linux/Dockerfile-rhel",
f"src/linux/Dockerfile-{distro}",
".",
]
)
@ -1610,10 +1610,10 @@ elif distro == "rhel":
"run",
"-it",
"--name",
"rhel-container",
f"{distro}-container",
"-v",
"deb:/data",
"rhel-image",
f"{distro}-image",
]
)
subprocess.run(
@ -1622,35 +1622,44 @@ elif distro == "rhel":
"run",
"-d",
"--name",
"systemd-rhel",
f"systemd-{distro}",
"-v",
"deb:/data",
"--privileged",
"-v",
"/sys/fs/cgroup:/sys/fs/cgroup",
"registry.access.redhat.com/ubi8/ubi-init:8.9-1",
"registry.access.redhat.com/redhat/ubi9-init:9.3-10" if distro.endswith("9") else "registry.access.redhat.com/ubi8/ubi-init:8.9-1",
]
)
# Installing test
print("Installing bunkerweb...")
bash_script = """
bash_script = (
"""
dnf install yum-utils wget sudo -y
wget https://nginx.org/packages/rhel/9/x86_64/RPMS/nginx-1.24.0-1.el9.ngx.x86_64.rpm
dnf install nginx-1.24.0-1.el9.ngx.x86_64.rpm -y
dnf install /data/bunkerweb.rpm -y
"""
if distro.endswith("9")
else """
dnf install yum-utils wget sudo -y
wget https://nginx.org/packages/rhel/8/x86_64/RPMS/nginx-1.24.0-1.el8.ngx.x86_64.rpm
dnf install nginx-1.24.0-1.el8.ngx.x86_64.rpm -y
dnf install /data/bunkerweb.rpm -y
"""
)
with tempfile.NamedTemporaryFile(mode="w") as f:
f.write(bash_script)
f.flush()
subprocess.run(["docker", "cp", f.name, "systemd-rhel:/data/install_nginx.sh"])
subprocess.run(["docker", "cp", f.name, f"systemd-{distro}:/data/install_nginx.sh"])
result = subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"/data/install_nginx.sh",
]
@ -1661,7 +1670,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"systemctl status bunkerweb.service",
@ -1675,7 +1684,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"systemctl status bunkerweb-ui.service",
@ -1705,7 +1714,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"echo 'HTTPS_PORT=8443' >> /etc/bunkerweb/variables.env",
@ -1716,7 +1725,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"echo 'new_value=1' >> /etc/bunkerweb/ui.env",
@ -1727,7 +1736,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"systemctl reload bunkerweb",
@ -1738,7 +1747,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"systemctl reload bunkerweb-ui",
@ -1750,7 +1759,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"systemctl is-active bunkerweb.service",
@ -1763,7 +1772,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"journalctl -u bunkerweb.service",
@ -1777,7 +1786,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"systemctl is-active bunkerweb-ui.service",
@ -1790,7 +1799,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"journalctl -u bunkerweb-ui.service",
@ -1820,7 +1829,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"dnf remove -y bunkerweb",
@ -1832,7 +1841,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"[ -d /usr/share/bunkerweb ]",
@ -1849,7 +1858,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"[ -d /var/tmp/bunkerweb ]",
@ -1866,7 +1875,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"[ -d /var/cache/bunkerweb ]",
@ -1883,7 +1892,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"[ -f /usr/bin/bwcli ]",
@ -1900,7 +1909,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"[ -d /var/lib/bunkerweb ]",
@ -1917,7 +1926,7 @@ elif distro == "rhel":
"docker",
"exec",
"-it",
"systemd-rhel",
f"systemd-{distro}",
"bash",
"-c",
"[ -d /etc/bunkerweb ]",
@ -2095,376 +2104,6 @@ elif distro == "rhel":
if "KO" in test_results.values():
sys.exit(1)
elif distro == "rockylinux":
test_results = {
"Installation test": None,
"Reloading test": None,
"Removing test": None,
"Upgrading test": None,
}
subprocess.run(
[
"sudo",
"docker",
"build",
"-t",
"rockylinux-image",
"-f",
"src/linux/Dockerfile-rockylinux",
".",
]
)
subprocess.run(
[
"sudo",
"docker",
"run",
"-it",
"--name",
"rockylinux-container",
"-v",
"deb:/data",
"rockylinux-image",
]
)
subprocess.run(
[
"docker",
"run",
"-d",
"--name",
"systemd-rockylinux",
"-v",
"deb:/data",
"--privileged",
"-v",
"/sys/fs/cgroup:/sys/fs/cgroup",
"rockylinux:9.3",
]
)
# Installing test
print("Installing bunkerweb...")
bash_script = """
dnf install yum-utils wget sudo -y
wget https://nginx.org/packages/rhel/9/x86_64/RPMS/nginx-1.24.0-1.el9.ngx.x86_64.rpm
dnf install nginx-1.24.0-1.el9.ngx.x86_64.rpm -y
dnf install /data/bunkerweb.rpm -y
"""
with tempfile.NamedTemporaryFile(mode="w") as f:
f.write(bash_script)
f.flush()
subprocess.run(["docker", "cp", f.name, "systemd-rockylinux:/data/install_nginx.sh"])
result = subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"/data/install_nginx.sh",
]
)
if result.returncode != 0:
bunkerweb_logs = subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"systemctl status bunkerweb.service",
],
capture_output=True,
)
print("Logs from bunkerweb:", bunkerweb_logs.stdout.decode())
bunkerweb_ui_logs = subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"systemctl status bunkerweb-ui.service",
],
capture_output=True,
)
print("Logs from bunkerweb-ui:", bunkerweb_ui_logs.stdout.decode())
sys.exit(result.returncode)
exit(result.returncode)
else:
print("✔️ Installation successful ✔️")
# Checking Installation test
try:
if result.returncode == 0:
test_results["Installation test"] = "OK"
else:
test_results["Installation test"] = "KO"
sys.exit(1)
except:
test_results["Installation test"] = "KO"
sys.exit(1)
# Reloading test
print("Reloading bunkerweb...")
subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"echo 'HTTPS_PORT=8443' >> /etc/bunkerweb/variables.env",
]
)
subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"echo 'new_value=1' >> /etc/bunkerweb/ui.env",
]
)
subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"systemctl reload bunkerweb",
]
)
subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"systemctl reload bunkerweb-ui",
]
)
bunkerweb_state = subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"systemctl is-active bunkerweb.service",
],
capture_output=True,
)
if bunkerweb_state.stdout.decode().strip() != "active":
bunkerweb_logs = subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"journalctl -u bunkerweb.service",
],
capture_output=True,
)
print("❌ bunkerweb.service is not running. Logs:", bunkerweb_logs.stdout.decode())
bunkerweb_ui_state = subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"systemctl is-active bunkerweb-ui.service",
],
capture_output=True,
)
if bunkerweb_ui_state.stdout.decode().strip() != "active":
bunkerweb_ui_logs = subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"journalctl -u bunkerweb-ui.service",
],
capture_output=True,
)
print(
"❌ bunkerweb-ui.service is not running. Logs:",
bunkerweb_ui_logs.stdout.decode(),
)
else:
print("✔️ bunkerweb.service and bunkerweb-ui.service are running ✔️")
# Checking Reloading test
try:
if bunkerweb_state.stdout.decode().strip() == "active":
test_results["Reloading test"] = "OK"
else:
test_results["Reloading test"] = "KO"
except:
test_results["Reloading test"] = "KO"
# Removing test
print("Removing bunkerweb...")
subprocess.run(
[
"sudo",
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"dnf remove -y bunkerweb",
]
)
result = subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"[ -d /usr/share/bunkerweb ]",
],
capture_output=True,
)
if result.returncode != 0:
print("✔️ /usr/share/bunkerweb not found.")
else:
print("❌ /usr/share/bunkerweb found.")
result = subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"[ -d /var/tmp/bunkerweb ]",
],
capture_output=True,
)
if result.returncode != 0:
print("✔️ /var/tmp/bunkerweb not found.")
else:
print("❌ /var/tmp/bunkerweb found.")
result = subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"[ -d /var/cache/bunkerweb ]",
],
capture_output=True,
)
if result.returncode != 0:
print("✔️ /var/cache/bunkerweb not found.")
else:
print("❌ /var/cache/bunkerweb found.")
result = subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"[ -f /usr/bin/bwcli ]",
],
capture_output=True,
)
if result.returncode != 0:
print("✔️ /usr/bin/bwcli not found.")
else:
print("❌ /usr/bin/bwcli found.")
result = subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"[ -d /var/lib/bunkerweb ]",
],
capture_output=True,
)
if result.returncode != 0:
print("✔️ /var/lib/bunkerweb not found.")
else:
print("❌ /var/lib/bunkerweb found.")
result = subprocess.run(
[
"docker",
"exec",
"-it",
"systemd-rockylinux",
"bash",
"-c",
"[ -d /etc/bunkerweb ]",
],
capture_output=True,
)
if result.returncode != 0:
print("✔️ /etc/bunkerweb not found.")
else:
print("❌ /etc/bunkerweb found.")
# Checking Removing test
try:
if (
pathlib.Path("/usr/share/bunkerweb").is_dir()
or pathlib.Path("/var/tmp/bunkerweb").is_dir()
or pathlib.Path("/var/cache/bunkerweb").is_dir()
or pathlib.Path("/usr/bin/bwcli").is_file()
or pathlib.Path("/var/lib/bunkerweb").is_dir()
or pathlib.Path("/etc/bunkerweb").is_dir()
):
test_results["Removing test"] = "KO"
else:
test_results["Removing test"] = "OK"
except:
test_results["Removing test"] = "KO"
############################################################################################################
# Upgrading test is disabled because Rocky Linux is the new Integration test #
############################################################################################################
# Print summary
for key, value in test_results.items():
print(f"{key}: {value}")
if "KO" in test_results.values():
sys.exit(1)
elif distro == "centos":
test_results = {
"Installation test": None,
@ -2981,5 +2620,5 @@ elif distro == "centos":
if "KO" in test_results.values():
sys.exit(1)
else:
print("Invalid argument. Please pass one of: ubuntu, debian, fedora, rhel, centos, rockylinux")
print("Invalid argument. Please pass one of: ubuntu, debian, fedora, rhel, centos, , rhel9")
sys.exit(1)

View file

@ -17,7 +17,7 @@ function gen_package() {
mode="$1"
linux="$2"
version="$(tr -d '\n' < VERSION)"
if [ "$linux" = "fedora" ] || [ "$linux" = "centos" ] || [ "$linux" = "rhel" ] || [ "$linux" = "rockylinux" ] ; then
if [ "$linux" = "fedora" ] || [ "$linux" = "centos" ] || [[ "$linux" = rhel* ]] ; then
type="rpm"
else
type="deb"
@ -59,8 +59,8 @@ echo "Building fedora package ..."
gen_package "$1" "fedora"
echo "Building rhel package ..."
gen_package "$1" "rhel"
echo "Building rockylinux package ..."
gen_package "$1" "rockylinux"
echo "Building rhel9 package ..."
gen_package "$1" "rhel9"
# Copy packages in the Docker context
do_and_check_cmd cp -r "/opt/packages/$1" ./packages
@ -76,7 +76,7 @@ echo "Building fedora test image ..."
build_image "fedora"
echo "Building rhel test image ..."
build_image "rhel"
echo "Building rockylinux test image ..."
build_image "rockylinux"
echo "Building rhel9 test image ..."
build_image "rhel9"
exit 0

View file

@ -0,0 +1,21 @@
FROM redhat/ubi9-init:9.3-10@sha256:a7db519a1068bee207b821e9ab6b3776599e80008355fa93202e3a2ff768c577
ENV NGINX_VERSION 1.24.0
# Copy centos repo
COPY src/linux/centos.repo /etc/yum.repos.d/centos.repo
RUN sed -i "s/%ARCH%/$(uname -m)/g" /etc/yum.repos.d/centos.repo
# Copy RPM-GPG-KEY-CentOS-Official
COPY src/linux/RPM-GPG-KEY-centosofficial /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
# Import RPM-GPG-KEY-CentOS-Official
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
COPY src/linux/nginx.repo /etc/yum.repos.d/nginx.repo
RUN rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && \
dnf install php-fpm curl yum-utils -y && \
dnf install nginx-${NGINX_VERSION} -y
COPY ./package-rhel/*.rpm /opt

View file

@ -1,29 +0,0 @@
FROM rockylinux:9.3@sha256:c944604c0c759f5d164ffbdf0bbab2fac582b739938937403c067ab634a0518a
ENV NGINX_VERSION 1.24.0
RUN dnf -y update \
&& dnf -y install systemd \
&& dnf clean all
RUN cd /lib/systemd/system/sysinit.target.wants/; \
for i in *; do [ $i = systemd-tmpfiles-setup.service ] || rm -f $i; done
RUN rm -f /lib/systemd/system/multi-user.target.wants/* \
/etc/systemd/system/*.wants/* \
/lib/systemd/system/local-fs.target.wants/* \
/lib/systemd/system/sockets.target.wants/*udev* \
/lib/systemd/system/sockets.target.wants/*initctl* \
/lib/systemd/system/basic.target.wants/* \
/lib/systemd/system/anaconda.target.wants/*
COPY src/linux/nginx.repo /etc/yum.repos.d/nginx.repo
RUN dnf install epel-release php-fpm yum-utils -y && \
dnf install nginx-${NGINX_VERSION} -y
COPY ./package-rockylinux/*.rpm /opt
VOLUME ["/sys/fs/cgroup"]
CMD ["/usr/sbin/init"]

View file

@ -34,8 +34,8 @@ function buildPackage() {
if [ "$DISTRO" = "rhel" ]; then
sudo docker build -t linux-rhel -f src/linux/Dockerfile-rhel .
fi
if [ "$DISTRO" = "rockylinux" ]; then
sudo docker build -t linux-rockylinux -f src/linux/Dockerfile-rockylinux .
if [ "$DISTRO" = "rhel9" ]; then
sudo docker build -t linux-rhel9 -f src/linux/Dockerfile-rhel9 .
fi
fi
}
@ -59,8 +59,8 @@ function createContainer() {
if [ "$DISTRO" = "rhel" ]; then
sudo docker run -v /tmp/rhel:/data linux-rhel
fi
if [ "$DISTRO" = "rockylinux" ]; then
sudo docker run -v /tmp/rockylinux:/data linux-rockylinux
if [ "$DISTRO" = "rhel9" ]; then
sudo docker run -v /tmp/rhel9:/data linux-rhel9
fi
fi
}
@ -68,7 +68,7 @@ function createContainer() {
# Retrieve $DISTRO from the user
function retrieveDistro() {
echo "Which distro do you want to use? (ubuntu, debian, centos, fedora, rhel, rockylinux)"
echo "Which distro do you want to use? (ubuntu, debian, centos, fedora, rhel, rhel9)"
read -r DISTRO
}