Skip to content

Commit 39168fc

Browse files
committed
WIP proper rhel
1 parent 2194bee commit 39168fc

File tree

2 files changed

+62
-23
lines changed

2 files changed

+62
-23
lines changed

.github/workflows/release.yml

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,63 @@ jobs:
2323
release_name: Release ${{ github.event.inputs.version }}
2424
draft: false
2525
prerelease: false
26-
release_assets:
27-
name: Release assets
28-
needs: create_release # we need to know the upload URL
29-
runs-on: ${{ matrix.config.os }} # we run many different builds
26+
# right now only test rhel
27+
# release_ubuntu_assets:
28+
# name: Release Ubuntu 24 Assets
29+
# needs: create_release
30+
# runs-on: ${{ matrix.config.os }}
31+
# strategy:
32+
# matrix:
33+
# config:
34+
# - os: ubuntu-24.04
35+
# filename: nginx-builder-ubuntu-24-amd64.tar.gz
36+
# - os: ubuntu-24.04-arm
37+
# filename: nginx-builder-ubuntu-24-arm64.tar.gz
38+
# steps:
39+
# - name: Checkout code
40+
# uses: actions/checkout@v4
41+
# - name: Install deps
42+
# run: |
43+
# sudo apt-get install -y libcurl4-openssl-dev
44+
# sudo /usr/bin/ruby3.2 /usr/bin/gem install rack
45+
# - name: Build Binary
46+
# run: make build
47+
# - name: Upload release assets
48+
# uses: softprops/action-gh-release@v1
49+
# env:
50+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
# with:
52+
# upload_url: ${{ needs.create_release.outputs.upload_url }}
53+
# asset_name: ${{ matrix.config.filename }}.tar.gz
54+
# asset_path: nginx-builder.tar.gz
55+
# asset_content_type: application/gzip
56+
release_rocky_assets:
57+
name: Release Rocky 9 Assets
58+
needs: create_release
59+
runs-on: ${{ matrix.config.os }}
60+
container:
61+
image: rockylinux/rockylinux:9
3062
strategy:
3163
matrix:
3264
config:
3365
- os: ubuntu-24.04
66+
filename: nginx-builder-ubuntu-24-amd64.tar.gz
3467
- os: ubuntu-24.04-arm
68+
filename: nginx-builder-ubuntu-24-arm64.tar.gz
3569
steps:
3670
- name: Checkout code
3771
uses: actions/checkout@v4
3872
- name: Install deps
3973
run: |
40-
sudo apt-get install -y libcurl4-openssl-dev
41-
sudo /usr/bin/ruby3.2 /usr/bin/gem install rack
74+
yum install git gcc gcc-c++ make
4275
- name: Build Binary
4376
run: make build
4477
- name: Upload release assets
45-
uses: actions/upload-release-asset@v1
78+
uses: softprops/action-gh-release@v1
4679
env:
4780
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4881
with:
4982
upload_url: ${{ needs.create_release.outputs.upload_url }}
50-
asset_name: nginx-builder-artifacts-${{ matrix.config.os }}
83+
asset_name: ${{ matrix.config.filename }}.tar.gz
5184
asset_path: nginx-builder.tar.gz
52-
asset_content_type: application/octet-stream
85+
asset_content_type: application/gzip

Makefile

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,27 @@ all: opt
33
NGINX_V := 1.26.2
44
LIBRE_V := 4.0.0
55
PASSENGER_V := 6.0.26
6-
# Added by passenger itself: http_ssl_module http_v2_module http_realip_module http_gzip_static_module http_stub_status_module http_addition_module
76
ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
7+
HOST_OS := $(shell if [ -f /etc/lsb-release ]; then echo debian; elif [ -f /etc/redhat-release ]; then echo fedora; else echo unknown; fi)
8+
DOWNLOAD_V ?= "" # option for install with prebuilt GitHub version
9+
810
NGINX_PASSENGER_MODULES := --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_addition_module --add-module='$(ROOT_DIR)passenger/src/nginx_module'
911
NGINX_MODULES := --user=nginx --group=nginx --with-compat --with-debug --with-file-aio --with-http_v3_module --with-pcre --with-pcre-jit --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-openssl="../libressl"
1012
NGINX_OPTIMIZATIONS := --with-cc-opt='-I../libressl/build/include -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection' --with-ld-opt='-L../libressl/build/lib -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -Wl,-E'
1113
NGINX_FEDORA_CONFIG := --sbin-path=/usr/local/sbin/nginx --modules-path=/usr/local/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx
1214
NGINX_DEBIAN_CONFIG := --sbin-path=/usr/local/sbin/nginx --modules-path=/usr/local/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --http-scgi-temp-path=/var/lib/nginx/scgi --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock
15+
NGINX_TMP_FEDORA_DIRS := /var/lib/nginx/tmp/{client_body,fastcgi,proxy,scgi,uwsgi}
16+
NGINX_TMP_DEBIAN_DIRS := /var/lib/nginx/{body,fastcgi,proxy,scgi,uwsgi}
17+
18+
ifeq ($(HOST_OS),fedora)
19+
NGINX_CONFIG := $(NGINX_FEDORA_CONFIG)
20+
NGINX_TMP_DIRS := $(NGINX_TMP_FEDORA_DIRS)
21+
else ifeq ($(OS),fedora)
22+
NGINX_CONFIG := $(NGINX_DEBIAN_CONFIG)
23+
NGINX_TMP_DIRS := $(NGINX_TMP_DEBIAN_DIRS)
24+
else
25+
$(error Unsupported OS detected)
26+
endif
1327

1428
nginx-$(NGINX_V).tar.gz:
1529
curl -sSLO "https://www.nginx.org/download/nginx-$(NGINX_V).tar.gz"
@@ -45,28 +59,20 @@ opt: nginx passenger libressl
4559

4660
build: nginx passenger libressl
4761
rm -rf build
48-
mkdir -p build/debian
62+
mkdir -p build
4963
./passenger/bin/passenger-install-nginx-module --auto --languages=ruby,python,nodejs \
5064
--nginx-source-dir=./nginx --prefix=/usr/local/share/nginx --nginx-no-install \
51-
"--extra-configure-flags=$(NGINX_DEBIAN_CONFIG) $(NGINX_MODULES) $(NGINX_OPTIMIZATIONS)"
52-
cp -a nginx/objs/nginx build/debian/nginx
53-
mkdir -p build/fedora
54-
# For faster build we extract commands from passenger-install-nginx-module
55-
cd nginx && sh ./configure --prefix='/usr/local/share/nginx' \
56-
$(NGINX_PASSENGER_MODULES) $(NGINX_FEDORA_CONFIG) $(NGINX_MODULES) $(NGINX_OPTIMIZATIONS) && make
57-
cp -a nginx/objs/nginx build/fedora/nginx
58-
cp -a passenger/buildout build/passenger
59-
find build -type f -name "*.o" -delete
60-
tar -czvf nginx-builder.tar.gz build
65+
"--extra-configure-flags=$(NGINX_CONFIG) $(NGINX_MODULES) $(NGINX_OPTIMIZATIONS)"
66+
cp -a nginx/objs/nginx build/nginx
6167

6268
install: nginx passenger libressl
6369
# Run the Passenger installation with Nginx module
6470
./passenger/bin/passenger-install-nginx-module --auto --languages=ruby,python,nodejs \
6571
--nginx-source-dir=./nginx --prefix=/usr/local --nginx-no-install \
66-
"--extra-configure-flags=$(NGINX_FEDORA_CONFIG) $(NGINX_MODULES) $(NGINX_OPTIMIZATIONS)"
72+
"--extra-configure-flags=$(NGINX_CONFIG) $(NGINX_MODULES) $(NGINX_OPTIMIZATIONS)"
6773
cp -a nginx/objs/nginx /usr/local/sbin/nginx; chmod +x /usr/local/sbin/nginx
6874
# Create necessary directories and set permissions
69-
mkdir -p /usr/local/lib64/nginx/modules /var/log/nginx /var/lib/nginx/tmp/{client_body,fastcgi,proxy,scgi,uwsgi} /etc/nginx/conf.d /var/run/passenger-instreg
75+
mkdir -p /usr/local/lib64/nginx/modules /var/log/nginx $(NGINX_TMP_DIRS) /etc/nginx/conf.d /var/run/passenger-instreg
7076
getent group nginx > /dev/null || groupadd -r nginx && id -u nginx > /dev/null 2>&1 || useradd -r -g nginx -s /sbin/nologin -d /nonexistent -c "nginx user" nginx
7177
chmod 0700 -R /var/log/nginx /var/lib/nginx/
7278
chown -R nginx:root /var/lib/nginx

0 commit comments

Comments
 (0)