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

Upgrade PHP7.4 to PHP8.1 #379

Merged
merged 8 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 25 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
APACHE_LOG_DIR=/var/log/apache2

# System setup
RUN set x; \

Check failure on line 17 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`

Check failure on line 17 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3015 info: Avoid additional packages by specifying `--no-install-recommends`

Check failure on line 17 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3047 info: Avoid use of wget without progress bar. Use `wget --progress=dot:giga <url>`.Or consider using `-q` or `-nv` (shorthands for `--quiet` or `--no-verbose`).
apt-get clean \
&& apt-get update \
&& apt-get install -y aptitude \
Expand All @@ -28,6 +28,7 @@
apt-transport-https \
ca-certificates \
wget \
lsb-release \
imagemagick \
librsvg2-bin \
python3-pygments \
Expand All @@ -45,23 +46,25 @@
rsync \
lynx \
poppler-utils \
&& wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg \
&& echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list \
&& aptitude update \
&& aptitude install -y \
php7.4 \
php7.4-mysql \
php7.4-cli \
php7.4-gd \
php7.4-mbstring \
php7.4-xml \
php7.4-mysql \
php7.4-intl \
php7.4-opcache \
php7.4-apcu \
php7.4-redis \
php7.4-curl \
php7.4-zip \
php7.4-fpm \
php7.4-yaml \
php8.1 \
php8.1-mysql \
php8.1-cli \
php8.1-gd \
php8.1-mbstring \
php8.1-xml \
php8.1-mysql \
php8.1-intl \
php8.1-opcache \
php8.1-apcu \
php8.1-redis \
php8.1-curl \
php8.1-zip \
php8.1-fpm \
php8.1-yaml \
libapache2-mod-fcgid \
&& aptitude clean \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -76,7 +79,7 @@
&& a2enmod rewrite \
# enabling mpm_event and php-fpm
&& a2dismod mpm_prefork \
&& a2enconf php7.4-fpm \
&& a2enconf php8.1-fpm \
&& a2enmod mpm_event \
&& a2enmod proxy_fcgi \
# Create directories
Expand All @@ -85,7 +88,7 @@
&& mkdir -p $MW_VOLUME

# Composer
RUN set -x; \

Check failure on line 91 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL4001 warning: Either use Wget or Curl but not both
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer self-update 2.1.3

Expand Down Expand Up @@ -136,13 +139,13 @@
COPY _sources/scripts/extension-setup.sh /tmp/extension-setup.sh
COPY _sources/configs/extensions.yaml /tmp/extensions.yaml
RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
RUN chmod a+x /usr/local/bin/yq

Check failure on line 142 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
RUN set -x; \

Check failure on line 143 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3015 info: Avoid additional packages by specifying `--no-install-recommends`

Check failure on line 143 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.

Check failure on line 143 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
apt-get update \
&& apt-get install -y jq \
&& chmod +x /tmp/extension-setup.sh

RUN /tmp/extension-setup.sh

Check failure on line 148 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.

# Patch composer
RUN set -x; \
Expand Down Expand Up @@ -225,11 +228,11 @@
COPY _sources/configs/msmtprc /etc/
COPY _sources/configs/mediawiki.conf /etc/apache2/sites-enabled/
COPY _sources/configs/status.conf /etc/apache2/mods-available/
COPY _sources/configs/php_error_reporting.ini _sources/configs/php_upload_max_filesize.ini /etc/php/7.4/cli/conf.d/
COPY _sources/configs/php_error_reporting.ini _sources/configs/php_upload_max_filesize.ini /etc/php/7.4/fpm/conf.d/
COPY _sources/configs/php_max_input_vars.ini _sources/configs/php_max_input_vars.ini /etc/php/7.4/fpm/conf.d/
COPY _sources/configs/php_timeouts.ini /etc/php/7.4/fpm/conf.d/
COPY _sources/configs/php-fpm-www.conf /etc/php/7.4/fpm/pool.d/www.conf
COPY _sources/configs/php_error_reporting.ini _sources/configs/php_upload_max_filesize.ini /etc/php/8.1/cli/conf.d/
COPY _sources/configs/php_error_reporting.ini _sources/configs/php_upload_max_filesize.ini /etc/php/8.1/fpm/conf.d/
COPY _sources/configs/php_max_input_vars.ini _sources/configs/php_max_input_vars.ini /etc/php/8.1/fpm/conf.d/
COPY _sources/configs/php_timeouts.ini /etc/php/8.1/fpm/conf.d/
COPY _sources/configs/php-fpm-www.conf /etc/php/8.1/fpm/pool.d/www.conf
COPY _sources/scripts/*.sh /
COPY _sources/scripts/maintenance-scripts/*.sh /maintenance-scripts/
COPY _sources/scripts/*.php $MW_HOME/maintenance/
Expand Down Expand Up @@ -259,7 +262,7 @@
&& a2enmod expires \
&& a2disconf other-vhosts-access-log \
# Enable environment variables for FPM workers
&& sed -i '/clear_env/s/^;//' /etc/php/7.4/fpm/pool.d/www.conf
&& sed -i '/clear_env/s/^;//' /etc/php/8.1/fpm/pool.d/www.conf

COPY _sources/images/Powered-by-Canasta.png /var/www/mediawiki/w/resources/assets/

Expand Down
8 changes: 4 additions & 4 deletions _sources/configs/extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extensions:
commit: d53357a6839e94800a617de4fc451b6c64d0a1c8
- Cargo:
branch: master
commit: 7e8ea881cdb41e79687d059670fc68872a6a892c # v. 3.4.2
commit: a2865938165c1389d852df762f8c85073859e5dd # v. 3.5.1
- CharInsert:
commit: 54c0f0ca9119a3ce791fb5d53edd4ec32035a5c5
- CheckUser:
Expand Down Expand Up @@ -169,7 +169,7 @@ extensions:
commit: 28482410564e38d2b97ab7321e99c4281c6e5877
- PageForms:
branch: master
commit: f90d67ecc2c111e82db454c71592c83384ff9704 # v. 5.6.1
commit: b3be227fa9650f1a165ab1cc549100f643646714 # v. 5.7.2
- PluggableAuth:
commit: 4be1e402e1862d165a4feb003c492ddc9525057e
- Popups:
Expand Down Expand Up @@ -209,7 +209,7 @@ extensions:
commit: 4b56baa752401b4ff9fe555fd57fc5c3309601d4
- SemanticMediaWiki:
repository: https://github.com/SemanticMediaWiki/SemanticMediaWiki
commit: 5c94879171d5f741b896828c25a9f2bb07a03dff # v. 4.1.2
commit: b5e2afe11991fe21a335cb90426de24b85bc9fe7 # v. 4.1.3
- SemanticResultFormats:
repository: https://github.com/SemanticMediaWiki/SemanticResultFormats
commit: d5196722a56f9b65475be68d1e97063d7b975cb9 # v. 4.0.2
Expand Down Expand Up @@ -271,7 +271,7 @@ extensions:
commit: 183bb7a8f78cbe365bec0fbd4b3ecdd4fae1a359
- UserPageViewTracker:
branch: master
commit: f4b7c20c372165541164d449c12df1e74e98ed0b # v. 0.7
commit: 276ead8fb0ecaa4c77b587267aa52e17de81c542 # v. 0.8
- Variables:
commit: b4a9063f16a928567e3b6788cda9246c2e94797f
- VEForAll:
Expand Down
2 changes: 1 addition & 1 deletion _sources/configs/php-fpm-www.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ group = "${WWW_GROUP}"
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /run/php/php7.4-fpm.sock
listen = /run/php/php8.1-fpm.sock

; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
Expand Down
2 changes: 1 addition & 1 deletion _sources/scripts/extension-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
MW_HOME="$MW_HOME"
MW_VERSION="$MW_VERSION"
# Since yq cannot process data from variables, a conversion is made to JSON format to utilise jq.
commands=$(yq eval '. | to_json' extensions.yaml)
commands=$(yq eval '. | to_json' /tmp/extensions.yaml)
echo "$commands" | jq -r '.extensions' | jq -c '.[]' | while read -r obj; do
extension_data=$(echo "$obj" | jq -r 'keys_unsorted[] as $key | select(has($key)) | "\($key) \(.[$key].repository) \(.[$key].commit) \(.[$key].branch)"')
read -r extension_name repository commit branch <<< "$extension_data"
Expand Down
2 changes: 1 addition & 1 deletion _sources/scripts/run-php-fpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -x
echo "starting php-fpm"
# Running php-fpm
mkdir -p /run/php
exec /usr/sbin/php-fpm7.4
exec /usr/sbin/php-fpm8.1
Loading