Skip to content

Commit 8f7a145

Browse files
committed
php8.0 does not support openssl 3
1 parent c4b7d7e commit 8f7a145

29 files changed

+1164
-8
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: "Litespeed 8.0"
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '35 23 * * 2'
7+
8+
env:
9+
# The default repo env will be 'ComputeStacks'; uppercase is not allowed.
10+
GH_REPO: computestacks/cs-docker-php
11+
12+
jobs:
13+
build:
14+
strategy:
15+
matrix:
16+
image: [ "ghcr.io/computestacks/cs-docker-php", "cmptstks/php" ]
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Log into Github Registry
30+
if: github.event_name != 'pull_request'
31+
uses: docker/login-action@v3
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Log into DockerHub
38+
if: github.event_name != 'pull_request'
39+
uses: docker/login-action@v3
40+
with:
41+
username: ${{ secrets.DOCKERHUB_USERNAME }}
42+
password: ${{ secrets.DOCKERHUB_TOKEN }}
43+
44+
- name: Extract metadata (tags, labels) for Docker
45+
id: meta
46+
uses: docker/metadata-action@v5
47+
with:
48+
images: ${{ matrix.image }}
49+
tags: |
50+
8.0-litespeed
51+
52+
- name: Build and prepare to test
53+
uses: docker/build-push-action@v5
54+
with:
55+
context: litespeed/8.0/
56+
load: true
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
60+
- name: Test container image
61+
run: >
62+
docker run --name=testphp -d \
63+
-e CS_AUTH_KEY=FcUpBTaoi746JbAdhWqJwtmXC0en1M3u -e METADATA_SERVICE=http://localhost \
64+
-e METADATA_AUTH=foobar123 -e LS_ADMIN_PW=ch3ngm3 ${{ matrix.image }}:8.0-litespeed
65+
bash ./scripts/container-health.sh testphp
66+
67+
- name: Build and push
68+
id: build-and-push
69+
uses: docker/build-push-action@v5
70+
with:
71+
context: litespeed/8.0/
72+
push: ${{ github.event_name != 'pull_request' }}
73+
tags: ${{ steps.meta.outputs.tags }}
74+
labels: ${{ steps.meta.outputs.labels }}
75+
cache-from: type=gha
76+
cache-to: type=gha,mode=max

.github/workflows/litespeed-8.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ jobs:
1313
build:
1414
strategy:
1515
matrix:
16-
include:
17-
- php_version: "8.0"
18-
lsphp_version: "80"
19-
image: "ghcr.io/computestacks/cs-docker-php"
20-
- php_version: "8.0"
21-
lsphp_version: "80"
22-
image: "cmptstks/php"
2316
- php_version: "8.1"
2417
lsphp_version: "81"
2518
image: "ghcr.io/computestacks/cs-docker-php"

litespeed/8.0/Dockerfile

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
FROM ghcr.io/computestacks/cs-docker-base:ubuntu-focal
2+
3+
ENV PHP_VERSION="8.0"
4+
5+
LABEL maintainer="https://computestacks.com"
6+
LABEL org.opencontainers.image.authors="https://computestacks.com"
7+
LABEL org.opencontainers.image.source="https://github.com/ComputeStacks/cs-docker-php/tree/main/litespeed/8.0"
8+
LABEL org.opencontainers.image.url="https://github.com/ComputeStacks/cs-docker-php/tree/main/litespeed/8.0"
9+
LABEL org.opencontainers.image.title="PHP 8.0 with OpenLiteSpeed"
10+
11+
COPY root/monarx-agent.sh /tmp/
12+
COPY root/postfix-run.sh /tmp/
13+
COPY root/postfix-log-run.sh /tmp/
14+
COPY root/40-ls-config.sh /etc/my_init.d/
15+
COPY root/50-entrypoint.sh /etc/my_init.d/
16+
COPY root/51-ls-env.sh /etc/my_init.d/
17+
COPY root/60-litespeed-upgrade.sh /etc/my_init.d/
18+
COPY root/60-php-config.sh /etc/my_init.d/
19+
COPY root/61-newrelic.sh /etc/my_init.d/
20+
COPY root/90-litespeed-password.sh /etc/my_init.d/
21+
COPY root/91-litespeed-config.sh /etc/my_init.d/
22+
COPY root/90-monarx-entry.sh /etc/my_init.d/
23+
COPY root/90-postfix.sh /etc/my_init.d/
24+
COPY root/90-relay.sh /etc/my_init.d/
25+
COPY root/99-litespeed.sh /etc/my_init.d/
26+
COPY root/migrate_php.sh /usr/local/bin/migrate_php_version
27+
28+
RUN set -ex; \
29+
\
30+
apt-get update; \
31+
apt-get install -y --no-install-recommends \
32+
autoconf \
33+
build-essential \
34+
wget \
35+
dpkg-dev \
36+
file \
37+
g++ \
38+
gcc \
39+
libc-dev \
40+
make \
41+
pkg-config \
42+
re2c \
43+
dirmngr \
44+
gnupg \
45+
libcurl4-openssl-dev \
46+
libedit-dev \
47+
libsodium-dev \
48+
libsqlite3-dev \
49+
libssl-dev \
50+
libxml2-dev \
51+
zlib1g-dev \
52+
procps \
53+
vim \
54+
tree \
55+
zip \
56+
unzip \
57+
libpng-dev \
58+
libbz2-dev \
59+
libmemcached-dev \
60+
libfreetype6-dev \
61+
libc-client-dev \
62+
libkrb5-dev \
63+
libxslt-dev \
64+
libicu-dev \
65+
imagemagick \
66+
libmagickwand-dev \
67+
libmariadb-dev \
68+
mariadb-client \
69+
libmcrypt-dev \
70+
mcrypt \
71+
expect \
72+
net-tools \
73+
ca-certificates \
74+
curl \
75+
xz-utils \
76+
inotify-tools \
77+
mailutils \
78+
apt-utils \
79+
libzstd-dev \
80+
liblzf-dev \
81+
git \
82+
; \
83+
echo "postfix postfix/mailname string docker.local" | debconf-set-selections \
84+
&& echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections \
85+
&& apt-get -y install postfix postfix-pcre libsasl2-modules \
86+
; \
87+
wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debain_repo.sh | bash \
88+
; \
89+
apt-get install -y --no-install-recommends \
90+
lsphp80 \
91+
lsphp80-common \
92+
lsphp80-curl \
93+
lsphp80-dev \
94+
lsphp80-imap \
95+
lsphp80-imagick \
96+
lsphp80-intl \
97+
lsphp80-memcached \
98+
lsphp80-msgpack \
99+
lsphp80-mysql \
100+
lsphp80-opcache \
101+
lsphp80-pgsql \
102+
lsphp80-sqlite3 \
103+
lsphp80-modules-source \
104+
php-cli \
105+
php-mysql \
106+
openlitespeed \
107+
rcs \
108+
sudo \
109+
libonig-dev \
110+
libzip-dev \
111+
; \
112+
mkdir -p /var/www && mkdir /usr/src/default \
113+
; \
114+
ln -s /usr/local/lsws/lsphp80/bin/phpize /usr/local/bin/phpize; \
115+
ln -s /usr/local/lsws/lsphp80/bin/php-config /usr/local/bin/php-config \
116+
; \
117+
curl https://repository.monarx.com/repository/monarx/publickey/monarxpub.gpg | gpg -o /usr/share/keyrings/monarx-archive-keyring.gpg --dearmor \
118+
&& echo "deb [signed-by=/usr/share/keyrings/monarx-archive-keyring.gpg] https://repository.monarx.com/repository/ubuntu-jammy/ jammy main" > /etc/apt/sources.list.d/monarx.list \
119+
; \
120+
apt-get update \
121+
&& apt-get -y install monarx-agent monarx-protect \
122+
; \
123+
mkdir -p /etc/service/monarx \
124+
&& mv /tmp/monarx-agent.sh /etc/service/monarx/run \
125+
&& touch /etc/service/monarx/down \
126+
&& chmod +x /etc/service/monarx/run \
127+
&& chmod +x /usr/local/bin/migrate_php_version \
128+
; \
129+
apt-get clean \
130+
&& rm -rf /var/lib/apt/lists/*
131+
132+
RUN cd /usr/src; \
133+
git clone https://github.com/phpredis/phpredis.git \
134+
&& cd /usr/src/phpredis \
135+
&& git checkout $(curl -fs -L https://api.github.com/repos/phpredis/phpredis/releases/latest | grep -i "tag_name" | awk -F '"' '{print $4}') \
136+
&& phpize \
137+
&& ./configure --enable-redis-igbinary --enable-redis-zstd --with-liblzf --enable-redis-msgpack \
138+
&& make \
139+
&& make install \
140+
&& echo "extension=redis.so" > /usr/local/lsws/lsphp80/etc/php/8.0/mods-available/redis.ini \
141+
; \
142+
RELAY_VERSION=$(curl -fs -L https://builds.r2.relay.so/meta/latest | awk -F '"' '{print $1}') \
143+
&& wget -O /tmp/relay.tar.gz "https://builds.r2.relay.so/$RELAY_VERSION/relay-$RELAY_VERSION-php8.0-debian-x86-64.tar.gz" \
144+
&& tar -xzf /tmp/relay.tar.gz -C /usr/src \
145+
&& mv /usr/src/relay-* /usr/src/relay \
146+
&& sed -i "s/00000000-0000-0000-0000-000000000000/$(cat /proc/sys/kernel/random/uuid)/" /usr/src/relay/relay-pkg.so \
147+
&& rm /tmp/relay.tar.gz \
148+
; \
149+
wget -O /tmp/newrelic.tar.gz https://download.newrelic.com$(curl -fs -L https://download.newrelic.com/php_agent/release/ | grep -Eo "/\S+-linux.tar.gz\"" | tr -d '"') \
150+
&& tar -xzvf /tmp/newrelic.tar.gz -C /usr/src \
151+
&& mv /usr/src/newrelic-php5-*-linux /usr/src/newrelic \
152+
&& mv /usr/src/newrelic/daemon/newrelic-daemon.x64 /usr/bin/newrelic-daemon \
153+
&& chown root: /usr/bin/newrelic-daemon \
154+
&& mkdir -p /var/log/newrelic \
155+
&& touch /var/log/newrelic/newrelic-daemon.log \
156+
&& chmod 666 /var/log/newrelic/newrelic-daemon.log \
157+
&& touch /var/log/newrelic/php_agent.log \
158+
&& chmod 644 /var/log/newrelic/php_agent.log \
159+
&& rm /tmp/newrelic.tar.gz
160+
161+
COPY root/www /usr/src/default/
162+
COPY root/vhosts /usr/local/lsws/conf/vhosts/
163+
164+
RUN mkdir -p /etc/service/postfix \
165+
&& mkdir -p /etc/service/postfix-log \
166+
&& mv /tmp/postfix-run.sh /etc/service/postfix/run \
167+
&& mv /tmp/postfix-log-run.sh /etc/service/postfix-log/run \
168+
&& chmod +x /etc/service/postfix/run \
169+
&& chmod +x /etc/service/postfix-log/run \
170+
&& touch /etc/service/postfix/down \
171+
&& touch /etc/service/postfix-log/down \
172+
; \
173+
cd /usr/local/lsws/fcgi-bin/ \
174+
&& rm lsphp \
175+
&& ln -s /usr/local/lsws/lsphp80/bin/lsphp lsphp \
176+
&& cd /usr/local/lsws/lsphp80/bin \
177+
&& chmod +x /etc/my_init.d/*.sh \
178+
&& rm /usr/local/lsws/conf/httpd_config.conf \
179+
; \
180+
mv /usr/local/lsws /usr/src \
181+
&& chown -R lsadm:lsadm /usr/src/lsws/conf \
182+
&& echo "max_input_vars = 3000" >> /usr/src/lsws/lsphp80/etc/php/8.0/litespeed/php.ini \
183+
&& sed -i 's/memory_limit = .*/memory_limit = 192M/g' /usr/src/lsws/lsphp80/etc/php/8.0/litespeed/php.ini \
184+
&& sed -i 's/upload_max_filesize = .*/upload_max_filesize = 250M/g' /usr/src/lsws/lsphp80/etc/php/8.0/litespeed/php.ini \
185+
&& sed -i 's/max_input_time = .*/max_input_time = 300/g' /usr/src/lsws/lsphp80/etc/php/8.0/litespeed/php.ini \
186+
&& sed -i 's/max_execution_time = .*/max_execution_time = 300/g' /usr/src/lsws/lsphp80/etc/php/8.0/litespeed/php.ini \
187+
&& echo "date.timezone = 'UTC'" >> /usr/src/lsws/lsphp80/etc/php/8.0/litespeed/php.ini \
188+
&& echo "post_max_size = 250M" >> /usr/src/lsws/lsphp80/etc/php/8.0/litespeed/php.ini \
189+
; \
190+
usermod -u 1001 www-data && groupmod -g 1001 www-data
191+
192+
COPY root/lswsctrl.sh /usr/local/bin/lswsctrl
193+
COPY root/httpd_config.conf /usr/src/lsws/conf/httpd_config.conf
194+
COPY root/monarx-agent.conf /etc/monarx-agent.conf
195+
196+
HEALTHCHECK --interval=30s --timeout=3s \
197+
CMD curl --get --fail http://localhost/healthcheck/ || exit 1
198+
199+
EXPOSE 80 7080

litespeed/8.0/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# PHP 8.0 with OpenLiteSpeed
2+
3+
> NOTE! IonCube is not included in this release. Once they release a version for php 8.2, we will update our image to support that.
4+
5+
## SMTP Configuration
6+
7+
<table>
8+
<thead>
9+
<tr>
10+
<th>Name</th>
11+
<th>Value</th>
12+
<th>Default</th>
13+
</tr>
14+
</thead>
15+
<tbody>
16+
<tr>
17+
<td>SMTP_SERVER</td>
18+
<td>IP or Hostname of the SMTP server</td>
19+
<td><pre>null</pre></td>
20+
</tr>
21+
<tr>
22+
<td>SMTP_PASSWORD</td>
23+
<td>SMTP Password</td>
24+
<td><pre>null</pre></td>
25+
</tr>
26+
<tr>
27+
<td>SMTP_USERNAME</td>
28+
<td>Username</td>
29+
<td><pre>null</pre></td>
30+
</tr>
31+
<tr>
32+
<td>SMTP_PORT</td>
33+
<td>smtp port</td>
34+
<td><pre>null</pre></td>
35+
</tr>
36+
<tr>
37+
<td>PM_STREAM</td>
38+
<td>Postmark Message Stream ID</td>
39+
<td><pre>null</pre></td>
40+
</tr>
41+
</tbody>
42+
</table>
43+
44+
## Monarx Support
45+
46+
This image includes support for [Monarx](https://www.monarx.com). By default it's _**disabled**_ unless you include the following environmental variables at boot (_can be enabled after initial install_):
47+
48+
* `MONARX_ID`
49+
* `MONARX_SECRET`

litespeed/8.0/root/40-ls-config.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
mkdir -p /usr/local/lsws
4+
5+
if ! [ "$(ls -A /usr/local/lsws)" ]; then
6+
echo >&2 "OpenLiteSpeed not configured, setting configuration..."
7+
8+
if [ -z ${PHP_LSAPI_CHILDREN} ]; then
9+
echo >&2 "SET_PHP_CHILDREN not set, setting default of 50."
10+
sed -i "s/SET_PHP_CHILDREN/50/g" /usr/src/lsws/conf/httpd_config.conf
11+
else
12+
sed -i "s/SET_PHP_CHILDREN/$PHP_LSAPI_CHILDREN/g" /usr/src/lsws/conf/httpd_config.conf
13+
fi
14+
15+
if [ -z ${PHP_MAX_CONN} ]; then
16+
echo >&2 "PHP_MAX_CONN not set, setting default of 50."
17+
sed -i "s/SET_PHP_MAX_CONN/50/g" /usr/src/lsws/conf/httpd_config.conf
18+
else
19+
sed -i "s/SET_PHP_MAX_CONN/$PHP_MAX_CONN/g" /usr/src/lsws/conf/httpd_config.conf
20+
fi
21+
22+
fi
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
if ! [ "$(ls -A /var/www)" ]; then
4+
echo >&2 "No files found in volume - copying default files..."
5+
mv /usr/src/default/* /var/www/
6+
chown -R www-data:www-data /var/www
7+
echo >&2 "Complete! Sample files have been successfully copied to /var/www/"
8+
fi
9+
10+
mkdir -p /var/www/logs && chown www-data:www-data /var/www/logs
11+
12+
if [ -f /var/www/crontab ]; then
13+
echo >&2 "Crontab found, moving to cron.d directory..."
14+
cp /var/www/crontab /etc/cron.d/myapp && chown root:root /etc/cron.d/myapp
15+
else
16+
if [ -f /etc/cron.d/myapp ]; then
17+
echo >&2 "Removing stale crontab..."
18+
rm /etc/cron.d/myapp
19+
fi
20+
fi
21+
22+
if ! [ "$(ls -A /usr/local/lsws)" ]; then
23+
echo >&2 "No files found in config volume - copying files..."
24+
mkdir -p /usr/local/lsws
25+
mv /usr/src/lsws/* /usr/local/lsws/
26+
chown -R lsadm: /usr/local/lsws/conf/vhosts
27+
echo >&2 "Complete! Configuration files have been successfully copied to /usr/local/lsws/"
28+
fi

0 commit comments

Comments
 (0)