Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STALE: Alpine support for NGINX Unit #259

Closed
wants to merge 304 commits into from
Closed

STALE: Alpine support for NGINX Unit #259

wants to merge 304 commits into from

Conversation

jaydrogers
Copy link
Member

@jaydrogers jaydrogers commented Dec 8, 2023

What this PR does

This PR is focused on getting NGINX Unit to work with Debian and Alpine.

Proposed Solution

Notes on how things work

https://release-v3-0.docker-php.pages.dev/docs/getting-started/contributing

Add Embed support

Update installer to support Debian and Alpine

mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules && \
cd /usr/src/ && \
hg clone -u ${NGINX_UNIT_VERSION} https://hg.nginx.org/unit && \
cd unit && \
NCPU="$(getconf _NPROCESSORS_ONLN)" && \
DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" && \
CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" && \
LD_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_LDFLAGS_MAINT_APPEND="-Wl,--as-needed -pie" dpkg-buildflags --get LDFLAGS)" && \
CONFIGURE_ARGS_MODULES="--prefix=/usr \
--statedir=/var/lib/unit \
--control=unix:/var/run/control.unit.sock \
--runstatedir=/var/run \
--pid=/var/run/unit.pid \
--logdir=/var/log \
--log=/dev/stdout \
--tmpdir=/var/tmp \
--user=www-data \
--group=www-data \
--openssl \
--libdir=/usr/lib/$DEB_HOST_MULTIARCH" && \
CONFIGURE_ARGS="$CONFIGURE_ARGS_MODULES --njs" && \
make -j $NCPU -C pkg/contrib .njs && \
export PKG_CONFIG_PATH=$(pwd)/pkg/contrib/njs/build && \
./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --ld-opt="$LD_OPT" --modulesdir=/usr/lib/unit/debug-modules --debug && \
make -j $NCPU unitd && \
install -pm755 build/sbin/unitd /usr/sbin/unitd-debug && \
make clean && \
./configure $CONFIGURE_ARGS --cc-opt="$CC_OPT" --ld-opt="$LD_OPT" --modulesdir=/usr/lib/unit/modules && \
make -j $NCPU unitd && \
install -pm755 build/sbin/unitd /usr/sbin/unitd && \
make clean && \
/bin/true && \
./configure $CONFIGURE_ARGS_MODULES --cc-opt="$CC_OPT" --modulesdir=/usr/lib/unit/debug-modules --debug && \
./configure php && \
make -j $NCPU php-install && \
make clean && \
./configure $CONFIGURE_ARGS_MODULES --cc-opt="$CC_OPT" --modulesdir=/usr/lib/unit/modules && \
./configure php && \
make -j $NCPU php-install && \
mkdir -p /var/lib/unit/

  • Break the scripts into two separate files
  • Load the script based on the OS installing

Features to support

  • Compile NGINX Unit from source with the provided PHP version from the base image
  • Enable the copying of unitd for "production use"
  • Enable the copying of unitd-debug for debug use

Important notes on current functionality

  • We will continue to use the "Docker CMD Override" currently in place

https://github.com/serversideup/docker-php/blob/release/v3.0/src/variations/unit/etc/entrypoint.d/10-init-unit.sh#L192

Validating functionality

  • Ensure 8.3.12 works with bookworm
bash scripts/dev.sh --variation unit --version 8.3.13 --os bookworm
  • Ensure 8.3.12 works with alpine
bash scripts/dev.sh --variation unit --version 8.3.13 --os  alpine
  • Ensure 7.4.33 works with bullseye
bash scripts/dev.sh --variation unit --version 7.4.33 --os bullseye
  • Ensure 7.4.33 works with alpine
bash scripts/dev.sh --variation unit --version 7.4.33 --os  alpine

@jaydrogers jaydrogers changed the title Set to ZTS to get embed (https://github.com/docker-library/php/pull/1… Alpine support for NGINX Unit Dec 8, 2023
@jaydrogers
Copy link
Member Author

Pinging @tippexs for help 😃

@jaydrogers
Copy link
Member Author

Hey @tippexs,

Just checking in on this item. I know you're super busy and its a community contribution -- so no sweat!

Even if you could just give me a few pointers or things to read on how to compile from source for Alpine & Debian, I might be able to tackle this myself.

Let me know your thoughts. Hope you're getting rest in between all your work too!

Thanks a ton for your help. 👍

# Conflicts:
#	.github/workflows/action_marketing-site-preview.yml
#	.github/workflows/action_marketing-site-publish.yml
#	.github/workflows/service_docker-build-and-publish.yml
#	docs/content/docs/2.getting-started/3.default-configurations.md
#	docs/content/docs/2.getting-started/6.about.md
#	docs/content/docs/3.guide/4.adding-your-own-start-up-scripts.md
#	docs/content/docs/3.guide/7.migrating-from-v2-to-v3.md
#	docs/content/docs/6.reference/1.environment-variable-specification.md
#	docs/nuxt.config.ts
#	scripts/assemble-docker-tags.sh
#	scripts/conf/php-versions-base-config.yml
#	scripts/dev.sh
#	src/common/etc/entrypoint.d/0-container-info.sh
#	src/common/etc/entrypoint.d/1-debug-mode.sh
#	src/common/etc/entrypoint.d/50-laravel-automations.sh
#	src/common/usr/local/bin/docker-php-serversideup-entrypoint
#	src/common/usr/local/bin/docker-php-serversideup-install-php-ext-installer
#	src/common/usr/local/etc/php/php.ini
#	src/s6/etc/entrypoint.d/10-init-webserver-config.sh
#	src/s6/usr/local/bin/docker-php-serversideup-s6-init
#	src/variations/cli/Dockerfile
#	src/variations/fpm-apache/etc/apache2/conf-available/remoteip.conf
#	src/variations/fpm-apache/etc/apache2/conf-available/security.conf
#	src/variations/fpm-apache/etc/apache2/mods-available/mpm_event.conf
#	src/variations/fpm-apache/etc/apache2/sites-available/ssl-full.conf
#	src/variations/fpm-apache/etc/apache2/sites-available/ssl-mixed.conf
#	src/variations/fpm-apache/etc/apache2/sites-available/ssl-off.conf
#	src/variations/fpm-apache/etc/apache2/vhost-templates/http.conf
#	src/variations/fpm-apache/etc/apache2/vhost-templates/https.conf
#	src/variations/fpm-apache/etc/s6-overlay/s6-rc.d/apache2/data/check
#	src/variations/fpm-apache/etc/s6-overlay/s6-rc.d/apache2/notification-fd
#	src/variations/fpm-apache/etc/s6-overlay/s6-rc.d/apache2/run
#	src/variations/fpm-apache/etc/s6-overlay/s6-rc.d/apache2/type
#	src/variations/fpm-nginx/Dockerfile
#	src/variations/fpm-nginx/etc/nginx/nginx.conf.template
#	src/variations/fpm/Dockerfile
#	src/variations/unit/Dockerfile
#	src/variations/unit/etc/entrypoint.d/10-init-unit.sh
@jaydrogers jaydrogers changed the base branch from release/v3.0 to main February 7, 2024 18:40
@jaydrogers
Copy link
Member Author

I just did a big merge of the release/v3.0 into main and it will be cleaner to re-open this PR when this feature is ready.

I moved all the notes here: #233 (comment)

@jaydrogers jaydrogers closed this Feb 7, 2024
@jaydrogers jaydrogers changed the title Alpine support for NGINX Unit STALE: Alpine support for NGINX Unit Feb 7, 2024
@jaydrogers jaydrogers deleted the 233-unit-alpine branch February 7, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alpine version of NGINX Unit does not exist: no PHP embed SAPI found
2 participants