Add cac-litespeed image family (OpenLiteSpeed, native LSAPI)
New paid-tier per-customer image built on litespeedtech/openlitespeed:1.8.4-lsphpNN.
Matrix: 8.1-8.5. Native LSAPI suexec to customer uid, server-level LSCache,
all WP/WooCommerce extensions (memcached, redis, imagick, mbstring, etc.) baked in.
Files:
- Dockerfile.litespeed (FROM prebuilt LiteSpeed base, layers wp-cli/composer/mariadb)
- configs/litespeed/{httpd_config,site-template,lsphp-overrides}.tpl
- scripts/{entrypoint,create-vhost,detect-memory}-litespeed.sh + install-lscache-wp.sh
CI: new Build-LiteSpeed-Images matrix job. OLS_VERSION pinned to 1.8.4 (only
release with prebuilt images for all 5 PHP versions on Docker Hub).
Spec: whp/docs/superpowers/specs/2026-06-01-cac-litespeed-design.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-02 07:32:47 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
## create-vhost-litespeed.sh — sets up OLS config for one customer site.
|
|
|
|
|
##
|
|
|
|
|
## Approach: keep the stock LiteSpeed-shipped httpd_config.conf VERBATIM
|
|
|
|
|
## (it has all the cgid/lscgid plumbing that lscgid needs to actually
|
|
|
|
|
## create its IPC socket), and just APPEND our listeners + vhTemplate.
|
|
|
|
|
## The custom vhost template lives at conf/templates/site.conf and points
|
|
|
|
|
## at /home/${user}/public_html. envsubst renders our user/domain into
|
|
|
|
|
## both files at container start.
|
|
|
|
|
##
|
|
|
|
|
## Expects in env: user, domain, serveralias (optional).
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
TPL_DIR=${TPL_DIR:-/etc/lsws-templates}
|
|
|
|
|
LSWS_CONF=/usr/local/lsws/conf
|
|
|
|
|
|
|
|
|
|
## Ensure the conf dir has stock config to append to. On first boot with
|
|
|
|
|
## a fresh image this is a no-op (image ships with conf/ populated). With
|
|
|
|
|
## a future volume mount of conf/, the upstream entrypoint pattern would
|
|
|
|
|
## copy from .conf/* — keep parity:
|
|
|
|
|
if [ -z "$(ls -A -- "$LSWS_CONF/" 2>/dev/null)" ]; then
|
|
|
|
|
cp -R /usr/local/lsws/.conf/* "$LSWS_CONF/"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
## Build the serveralias suffix for vhDomain. Empty for none, else
|
|
|
|
|
## ",alias1,alias2" prepended to the comma list.
|
|
|
|
|
vhost_map_aliases=""
|
|
|
|
|
if [ -n "${serveralias:-}" ]; then
|
|
|
|
|
for alias in $(echo "$serveralias" | tr ',' ' '); do
|
|
|
|
|
[ -z "$alias" ] && continue
|
|
|
|
|
vhost_map_aliases="${vhost_map_aliases},${alias}"
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
export vhost_map_aliases user domain
|
|
|
|
|
|
|
|
|
|
## --- prep the stock httpd_config.conf before appending ours ---
|
|
|
|
|
## Stock ships with `listener HTTP {*:80}`, `listener HTTPS {*:443}`, and
|
|
|
|
|
## a `vhTemplate docker` mapped to /var/www/vhosts/$VH_NAME/html — these
|
|
|
|
|
## conflict with our ports and would shadow our siteVH vhost. Strip them
|
|
|
|
|
## and the demo `virtualHost Example`, but KEEP `listener Default` (it's
|
|
|
|
|
## bound to 8088 — harmless internally, removing risks unrelated breakage).
|
|
|
|
|
## Always restart from a stock copy so re-runs are idempotent (otherwise
|
|
|
|
|
## a second sed pass on already-stripped config corrupts it).
|
|
|
|
|
cp /usr/local/lsws/.conf/httpd_config.conf "$LSWS_CONF/httpd_config.conf"
|
|
|
|
|
|
|
|
|
|
## Strip the stock blocks we replace. Use awk: easier than sed range-deletes
|
|
|
|
|
## to skip a NAMED block of arbitrary length terminated by a top-level `}`.
|
2026-06-02 16:36:25 -07:00
|
|
|
## extProcessor lsphp is stripped because the stock one hard-codes
|
|
|
|
|
## PHP_LSAPI_CHILDREN=10 regardless of container size — our appended
|
|
|
|
|
## extProcessor scales it from detect-memory-litespeed.sh.
|
Add cac-litespeed image family (OpenLiteSpeed, native LSAPI)
New paid-tier per-customer image built on litespeedtech/openlitespeed:1.8.4-lsphpNN.
Matrix: 8.1-8.5. Native LSAPI suexec to customer uid, server-level LSCache,
all WP/WooCommerce extensions (memcached, redis, imagick, mbstring, etc.) baked in.
Files:
- Dockerfile.litespeed (FROM prebuilt LiteSpeed base, layers wp-cli/composer/mariadb)
- configs/litespeed/{httpd_config,site-template,lsphp-overrides}.tpl
- scripts/{entrypoint,create-vhost,detect-memory}-litespeed.sh + install-lscache-wp.sh
CI: new Build-LiteSpeed-Images matrix job. OLS_VERSION pinned to 1.8.4 (only
release with prebuilt images for all 5 PHP versions on Docker Hub).
Spec: whp/docs/superpowers/specs/2026-06-01-cac-litespeed-design.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-02 07:32:47 -07:00
|
|
|
awk '
|
|
|
|
|
BEGIN { skip = 0 }
|
2026-06-02 16:36:25 -07:00
|
|
|
/^listener HTTP \{/ || /^listener HTTPS \{/ || /^vhTemplate docker \{/ || /^extProcessor lsphp\{/ || /^extProcessor lsphp \{/ { skip = 1; next }
|
Add cac-litespeed image family (OpenLiteSpeed, native LSAPI)
New paid-tier per-customer image built on litespeedtech/openlitespeed:1.8.4-lsphpNN.
Matrix: 8.1-8.5. Native LSAPI suexec to customer uid, server-level LSCache,
all WP/WooCommerce extensions (memcached, redis, imagick, mbstring, etc.) baked in.
Files:
- Dockerfile.litespeed (FROM prebuilt LiteSpeed base, layers wp-cli/composer/mariadb)
- configs/litespeed/{httpd_config,site-template,lsphp-overrides}.tpl
- scripts/{entrypoint,create-vhost,detect-memory}-litespeed.sh + install-lscache-wp.sh
CI: new Build-LiteSpeed-Images matrix job. OLS_VERSION pinned to 1.8.4 (only
release with prebuilt images for all 5 PHP versions on Docker Hub).
Spec: whp/docs/superpowers/specs/2026-06-01-cac-litespeed-design.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-02 07:32:47 -07:00
|
|
|
skip && /^\}/ { skip = 0; next }
|
|
|
|
|
!skip { print }
|
|
|
|
|
' "$LSWS_CONF/httpd_config.conf" > "$LSWS_CONF/httpd_config.conf.new"
|
|
|
|
|
mv "$LSWS_CONF/httpd_config.conf.new" "$LSWS_CONF/httpd_config.conf"
|
|
|
|
|
|
2026-06-02 20:06:56 -07:00
|
|
|
## Server-level user/group → customer. Without this, OLS runs as nobody and
|
|
|
|
|
## either can't read customer files (no setUIDMode) or has to lscgid-spawn a
|
|
|
|
|
## per-uid lsphp for every httpd worker (the setUIDMode 2 pathway). With OLS
|
|
|
|
|
## itself running as ${user}, a single shared lsphp parent serves all httpd
|
|
|
|
|
## workers, LSAPI children-mode actually engages, and shmem stops fanning out.
|
|
|
|
|
## OLS still starts as root (PID 1 binds 80/443) then drops privs after bind.
|
|
|
|
|
sed -i \
|
|
|
|
|
-e "s|^user[[:space:]].*|user ${user}|" \
|
|
|
|
|
-e "s|^group[[:space:]].*|group ${user}|" \
|
|
|
|
|
"$LSWS_CONF/httpd_config.conf"
|
|
|
|
|
|
Add cac-litespeed image family (OpenLiteSpeed, native LSAPI)
New paid-tier per-customer image built on litespeedtech/openlitespeed:1.8.4-lsphpNN.
Matrix: 8.1-8.5. Native LSAPI suexec to customer uid, server-level LSCache,
all WP/WooCommerce extensions (memcached, redis, imagick, mbstring, etc.) baked in.
Files:
- Dockerfile.litespeed (FROM prebuilt LiteSpeed base, layers wp-cli/composer/mariadb)
- configs/litespeed/{httpd_config,site-template,lsphp-overrides}.tpl
- scripts/{entrypoint,create-vhost,detect-memory}-litespeed.sh + install-lscache-wp.sh
CI: new Build-LiteSpeed-Images matrix job. OLS_VERSION pinned to 1.8.4 (only
release with prebuilt images for all 5 PHP versions on Docker Hub).
Spec: whp/docs/superpowers/specs/2026-06-01-cac-litespeed-design.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-02 07:32:47 -07:00
|
|
|
## --- append our listeners + vhTemplate ---
|
|
|
|
|
SENTINEL="## ---- cac-litespeed append (do not edit below) ----"
|
|
|
|
|
{
|
|
|
|
|
echo ""
|
|
|
|
|
echo "$SENTINEL"
|
2026-06-02 16:36:25 -07:00
|
|
|
envsubst '${user} ${domain} ${vhost_map_aliases} ${PHPVER} ${LSAPI_CHILDREN}' < "$TPL_DIR/httpd_config.tpl"
|
Add cac-litespeed image family (OpenLiteSpeed, native LSAPI)
New paid-tier per-customer image built on litespeedtech/openlitespeed:1.8.4-lsphpNN.
Matrix: 8.1-8.5. Native LSAPI suexec to customer uid, server-level LSCache,
all WP/WooCommerce extensions (memcached, redis, imagick, mbstring, etc.) baked in.
Files:
- Dockerfile.litespeed (FROM prebuilt LiteSpeed base, layers wp-cli/composer/mariadb)
- configs/litespeed/{httpd_config,site-template,lsphp-overrides}.tpl
- scripts/{entrypoint,create-vhost,detect-memory}-litespeed.sh + install-lscache-wp.sh
CI: new Build-LiteSpeed-Images matrix job. OLS_VERSION pinned to 1.8.4 (only
release with prebuilt images for all 5 PHP versions on Docker Hub).
Spec: whp/docs/superpowers/specs/2026-06-01-cac-litespeed-design.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-02 07:32:47 -07:00
|
|
|
} >> "$LSWS_CONF/httpd_config.conf"
|
|
|
|
|
|
|
|
|
|
## --- write our vhost template to /usr/local/lsws/conf/templates/site.conf ---
|
|
|
|
|
envsubst '${user}' < "$TPL_DIR/site-template.tpl" \
|
|
|
|
|
> "$LSWS_CONF/templates/site.conf"
|
|
|
|
|
|
|
|
|
|
## --- per-vhost config file the vhTemplate will reference ---
|
|
|
|
|
## OLS creates conf/vhosts/$VH_NAME/ at template-instantiation time, but
|
|
|
|
|
## we pre-create it to satisfy the configFile path and write a minimal
|
|
|
|
|
## vhconf.conf (empty body — all real config is inline in the template's
|
|
|
|
|
## virtualHostConfig{} block).
|
|
|
|
|
mkdir -p "$LSWS_CONF/vhosts/siteVH"
|
|
|
|
|
echo "## auto-generated; real vhost config is in templates/site.conf" \
|
|
|
|
|
> "$LSWS_CONF/vhosts/siteVH/vhconf.conf"
|
|
|
|
|
|
|
|
|
|
## Permissions: OLS reads conf/ as lsadm. Don't break that.
|
|
|
|
|
chown -R lsadm:nogroup "$LSWS_CONF" 2>/dev/null || true
|