Skip to content

Commit

Permalink
Merge pull request #276 from xwp/fix-apache
Browse files Browse the repository at this point in the history
Upgrade to PHP 8.2 and enable public directory override for local Apache
  • Loading branch information
kasparsd authored Feb 6, 2024
2 parents d02859c + 8805e73 commit de5a3f7
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
tools: composer:v2

- name: Get Composer cache directory
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:

language: php

php: '8.0'
php: '8.2'

before_install:
- nvm install
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"preferred-install": "dist",
"vendor-dir": "plugins/vendor",
"platform": {
"php": "8.0"
"php": "8.2"
},
"allow-plugins": {
"johnpbloch/wordpress-core-installer": true,
Expand All @@ -26,18 +26,18 @@
}
},
"require": {
"php": ">=8.0",
"php": ">=8.2",
"composer/installers": "^1.12",
"wpackagist-theme/twentytwenty": "^2.4"
},
"require-dev": {
"automattic/vip-go-mu-plugins": "dev-master",
"automattic/vipwpcs": "^3.0.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
"automattic/vipwpcs": "^3.0",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"johnpbloch/wordpress": "dev-master",
"phpunit/phpunit": "^9.6.13",
"wp-cli/wp-cli-bundle": "^2.8",
"wp-phpunit/wp-phpunit": "^6.4.2",
"wp-phpunit/wp-phpunit": "^6.4",
"xwp/wait-for": "^0.0.2",
"yoast/phpunit-polyfills": "^2.0"
},
Expand Down
80 changes: 47 additions & 33 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,15 @@ services:
depends_on:
- db
build: ./local/docker/wordpress
image: ghcr.io/xwp/vip-site-template--wordpress:2.0.0
image: ghcr.io/xwp/vip-site-template--wordpress:2.1.0
restart: always
volumes:
- ./local/public:/var/www/html
- .:/var/www/html/wp-content
- ./vip-config:/var/www/html/vip-config # Match the VIP production setup where vip-config is mapped to the root directory.
- webgrind_data:/tmp
environment:
APACHE_DOCUMENT_ROOT: /var/www/html
VIRTUAL_HOST: ${DEV_URL:-local.wpenv.net}, *.${DEV_URL:-local.wpenv.net}
SMTPSERVER: mailhog
EMAIL: local@${DEV_URL:-local.wpenv.net}
Expand Down
17 changes: 12 additions & 5 deletions local/docker/wordpress/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM wordpress:php8.0-apache
FROM wordpress:php8.2-apache

# Can be overridden in docker-compose.yml via the build args.
ARG NODE_VERSION=18
Expand All @@ -10,10 +10,17 @@ ENV npm_config_cache /tmp/.npmcache
# Add path to Composer binaries to this environment.
ENV PATH /var/www/html/wp-content/plugins/vendor/bin:$PATH

# Allow this to be customized by the environment.
ENV APACHE_DOCUMENT_ROOT /var/www/html

# Replace the hardcoded location with an environment variable.
RUN sed -i 's#/var/www/html#\${APACHE_DOCUMENT_ROOT}#g' /etc/apache2/sites-available/*.conf
RUN sed -i 's#/var/www#\${APACHE_DOCUMENT_ROOT}#g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf

# Development tooling dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl netcat pv bash less default-mysql-client ssh git zip unzip sudo gnupg \
curl pv bash less default-mysql-client ssh git zip unzip sudo gnupg \
msmtp libz-dev libmemcached-dev libsecret-1-0 \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -22,18 +29,18 @@ RUN mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_VERSION}.x nodistro main" >> /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install nodejs \
&& apt-get -y --no-install-recommends install nodejs npm \
&& rm -rf /var/lib/apt/lists/*

# Install PHP Composer.
RUN curl -s https://getcomposer.org/installer | \
php --version=2.4.4 --filename=composer --install-dir=/usr/local/bin
php --version=2.6.6 --filename=composer --install-dir=/usr/local/bin

# Include our custom config for PHP and Xdebug.
COPY config/php/* /usr/local/etc/php/conf.d/

# Setup xdebug and memcached.
RUN pecl install xdebug-3.1.5 memcached-3.2.0 \
RUN pecl install xdebug-3.3.1 memcached-3.2.0 \
&& docker-php-ext-enable xdebug memcached

# Enable HTTPS endpoints for reverse proxy requests. Used for images.
Expand Down
9 changes: 1 addition & 8 deletions local/docker/wordpress/config/apache/proxy-ssl.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
# Enable HTTPS requests for reverse proxies.

<VirtualHost *:443>
SSLProxyEngine on
</VirtualHost>

<VirtualHost *:80>
SSLProxyEngine on
</VirtualHost>
SSLProxyEngine on
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Site setup, development environment and deploy tooling for [WordPress VIP](https

## Requirements

- PHP 8.0
- PHP 8.2
- [Composer](https://getcomposer.org)
- [Node.js](https://nodejs.org) version 18
- [Docker with Docker Compose](https://docs.docker.com/compose/install/)
Expand All @@ -32,7 +32,7 @@ Site setup, development environment and deploy tooling for [WordPress VIP](https

We suggest using [Homebrew](https://brew.sh) on macOS or [Chocolatey](https://chocolatey.org) for Windows to install the project dependencies.

brew install git php@8.0 composer node@18 mkcert
brew install git php@8.2 composer node@18 mkcert
brew install --cask docker


Expand Down

0 comments on commit de5a3f7

Please sign in to comment.