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

#66: Remove MultiViews from our Apache config + PHP plugin isolation #78

Merged
merged 25 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
21dac9c
#66: Remove MultiViews from our Apache config.
reynoldsalec Oct 25, 2023
16259ac
Include nginx plugin after the great decoupling.
reynoldsalec Oct 25, 2023
c1899b3
Refactor plugin to use new builders directory and break out utils.
reynoldsalec Oct 26, 2023
b021f6a
Isolate tests for hardcore. Fix pkger missing issue from refactor.
reynoldsalec Nov 7, 2023
2b90dab
Install all plugins to get nginx dependency.
reynoldsalec Nov 7, 2023
274b32d
Add install-composer.sh script.
reynoldsalec Nov 8, 2023
fdeff62
Update workflows to detach from other services.
reynoldsalec Nov 17, 2023
87ab260
Add php-nginx service to detach from reliance on global nginx.
reynoldsalec Nov 17, 2023
765ce40
Feed linter.
reynoldsalec Nov 17, 2023
2b27ee3
Include nginx in main php builder as well.
reynoldsalec Nov 17, 2023
78d2d41
Update .node-version file.
reynoldsalec Nov 18, 2023
81153bb
More updates to GA tests.
reynoldsalec Nov 18, 2023
1af24bd
Debug code.
reynoldsalec Nov 18, 2023
1f8c116
Try using explicit type on 5.3 tests.
reynoldsalec Nov 20, 2023
d741d1f
New loading scheme for php-nginx.
reynoldsalec Nov 20, 2023
9cd8b8c
Debugging info and get rid of type on custom_nginx 5.3.
reynoldsalec Nov 20, 2023
f3602ad
Isolate php extension tests and don't destroy 5.3 for debugging.
reynoldsalec Nov 20, 2023
eb490d7
Debugging.
reynoldsalec Nov 20, 2023
e2bdf09
Docker logs debugging.
reynoldsalec Nov 20, 2023
42534c8
Debug trying depends_on
reynoldsalec Nov 21, 2023
dc3ab75
Add depends_on for php-fpm universally.
reynoldsalec Nov 21, 2023
c289dcd
Isolate PHP Other tests.
reynoldsalec Nov 21, 2023
dcfc518
Clean up code.
reynoldsalec Nov 21, 2023
a63dd5c
Update Changelog and fix issue with composer dependency downloading.
reynoldsalec Nov 21, 2023
3ae7131
Feed the linter.
reynoldsalec Nov 21, 2023
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
11 changes: 4 additions & 7 deletions .github/workflows/build-php-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ jobs:
# Handle Lando Install to test the images after build
# We are hardcoding the dtaa normally included in the matrix
# due to how this testing is setup
- name: Install node 16
- name: Install node 18
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'
registry-url: https://registry.npmjs.org
cache: yarn
- name: Install Yarn dependencies
Expand All @@ -98,12 +98,9 @@ jobs:
with:
lando-version: ${{ matrix.lando-version }}
config: |
plugins.@lando/php=/home/runner/work/php/php
setup.skipCommonPlugins=true
setup.plugins.@lando/php=/home/runner/work/php/php
telemetry: false
- name: Verify Lando works and we are dogfooding this plugin for tests
run: |
lando version
lando config --path plugins | grep php | grep /home/runner/work/php/php || (echo "::error:: Not dogfooding this plugin correctly! " && exit 1)

# This block should eventually become use lando/actions-leia@v2
# @NOTE? Do we want a way for our leia-action to configure apparmor since
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-docs-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:
# Install deps and cache
- name: Checkout code
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/pr-legacy-php5-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:

- name: Checkout code
Expand All @@ -39,16 +39,16 @@ jobs:
with:
lando-version: ${{ matrix.lando-version }}
config: |
plugins.@lando/php=/home/runner/work/php/php
setup.skipCommonPlugins=true
setup.plugins.@lando/php=/home/runner/work/php/php
telemetry: false
- name: Verify Lando works and we are dogfooding this plugin for tests
run: |
lando version
lando config --path plugins | grep php | grep /home/runner/work/php/php || (echo "::error:: Not dogfooding this plugin correctly! " && exit 1)
- name: Run Leia Tests
uses: lando/run-leia-action@v2
with:
leia-test: "./${{ matrix.leia-tests }}/README.md"
cleanup-header: "Destroy tests"
shell: bash
stdin: true
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
9 changes: 3 additions & 6 deletions .github/workflows/pr-legacy-php7-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:

- name: Checkout code
Expand All @@ -38,12 +38,9 @@ jobs:
with:
lando-version: ${{ matrix.lando-version }}
config: |
plugins.@lando/php=/home/runner/work/php/php
setup.skipCommonPlugins=true
setup.plugins.@lando/php=/home/runner/work/php/php
telemetry: false
- name: Verify Lando works and we are dogfooding this plugin for tests
run: |
lando version
lando config --path plugins | grep php | grep /home/runner/work/php/php || (echo "::error:: Not dogfooding this plugin correctly! " && exit 1)
- name: Run Leia Tests
uses: lando/run-leia-action@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:
# Install deps and cache
- name: Checkout code
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/pr-php-extension-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -35,12 +35,9 @@ jobs:
with:
lando-version: ${{ matrix.lando-version }}
config: |
plugins.@lando/php=/home/runner/work/php/php
setup.skipCommonPlugins=true
setup.plugins.@lando/php=/home/runner/work/php/php
telemetry: false
- name: Verify Lando works and we are dogfooding this plugin for tests
run: |
lando version
lando config --path plugins | grep php | grep /home/runner/work/php/php || (echo "::error:: Not dogfooding this plugin correctly! " && exit 1)
- name: Run Leia Tests
uses: lando/run-leia-action@v2
with:
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/pr-php-other-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:

- name: Checkout code
Expand All @@ -38,12 +38,9 @@ jobs:
with:
lando-version: ${{ matrix.lando-version }}
config: |
plugins.@lando/php=/home/runner/work/php/php
setup.skipCommonPlugins=true
setup.plugins.@lando/php=/home/runner/work/php/php
telemetry: false
- name: Verify Lando works and we are dogfooding this plugin for tests
run: |
lando version
lando config --path plugins | grep php | grep /home/runner/work/php/php || (echo "::error:: Not dogfooding this plugin correctly! " && exit 1)
- name: Run Leia Tests
uses: lando/run-leia-action@v2
with:
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/pr-php7-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:

- name: Checkout code
Expand All @@ -37,12 +37,9 @@ jobs:
with:
lando-version: ${{ matrix.lando-version }}
config: |
plugins.@lando/php=/home/runner/work/php/php
setup.skipCommonPlugins=true
setup.plugins.@lando/php=/home/runner/work/php/php
telemetry: false
- name: Verify Lando works and we are dogfooding this plugin for tests
run: |
lando version
lando config --path plugins | grep php | grep /home/runner/work/php/php || (echo "::error:: Not dogfooding this plugin correctly! " && exit 1)
- name: Build Local Docker Apache Image
run: |
cd ./images/${{ matrix.php-versions }}-apache
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/pr-php8-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:

- name: Checkout code
Expand All @@ -38,12 +38,9 @@ jobs:
with:
lando-version: ${{ matrix.lando-version }}
config: |
plugins.@lando/php=/home/runner/work/php/php
setup.skipCommonPlugins=true
setup.plugins.@lando/php=/home/runner/work/php/php
telemetry: false
- name: Verify Lando works and we are dogfooding this plugin for tests
run: |
lando version
lando config --path plugins | grep php | grep /home/runner/work/php/php || (echo "::error:: Not dogfooding this plugin correctly! " && exit 1)
- name: Build Local Docker Apache Image
run: |
cd ./images/${{ matrix.php-versions }}-apache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- ubuntu-22.04
- macos-12
node-version:
- '16'
- '18'
steps:
# Install deps and cache
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:
# Install deps and cache
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v0.10.0 - [November 21, 2023](https://github.com/lando/php/releases/tag/v0.10.0)
* Removed MultiViews from Apache config. [#66](https://github.com/lando/php/issues/66)
* Isolated PHP to work as a standalone service. [#78](https://github.com/lando/php/pull/78)

## v0.9.0 - [July 3, 2023](https://github.com/lando/php/releases/tag/v0.9.0)
* Removed bundle-dependencies and version-bump-prompt from plugin.
* Updated package to use prepare-release-action.
Expand Down
15 changes: 15 additions & 0 deletions builders/php-nginx.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

const _ = require('lodash');
const LandoNginx = require('./../node_modules/@lando/nginx/builders/nginx.js');

// Builder
module.exports = {
name: 'php-nginx',
parent: '_webserver',
builder: (parent, config) => class PhpNginx extends LandoNginx.builder(parent, LandoNginx.config) {
constructor(id, options = {}) {
super(id, options, {services: _.set({}, options.name)});
};
},
};
28 changes: 17 additions & 11 deletions services/php/builder.js → builders/php.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
const _ = require('lodash');
const path = require('path');
const semver = require('semver');
const utils = require('./../../lib/utils');

const addBuildStep = require('./../utils/add-build-step');
/*
* Helper to get nginx config
*/
Expand All @@ -18,11 +17,11 @@ const nginxConfig = options => ({
info: {managed: true},
home: options.home,
name: `${options.name}_nginx`,
overrides: utils.cloneOverrides(options.overrides),
overrides: require('../utils/clone-overrides')(options.overrides),
project: options.project,
root: options.root,
ssl: options.nginxSsl,
type: 'nginx',
type: 'php-nginx',
userConfRoot: options.userConfRoot,
webroot: options.webroot,
version: options.via.split(':')[1],
Expand Down Expand Up @@ -108,7 +107,7 @@ module.exports = {
'/var/www/.composer/vendor/bin',
'/helpers',
],
confSrc: __dirname,
confSrc: path.resolve(__dirname, '..', 'config'),
command: ['sh -c \'a2enmod rewrite && apache2-foreground\''],
composer_version: '2.2.18',
image: 'apache',
Expand Down Expand Up @@ -171,34 +170,41 @@ module.exports = {

// Add our composer things to run step
if (!_.isEmpty(options.composer)) {
const commands = utils.getInstallCommands(options.composer, pkger, ['composer', 'global', 'require', '-n']);
utils.addBuildStep(commands, options._app, options.name, 'build_internal');
const commands =
require('../utils/get-install-commands')(options.composer, pkger, ['composer', 'global', 'require', '-n']);
addBuildStep(commands, options._app, options.name, 'build_internal');
}

// Add activate steps for xdebug
if (options.xdebug) {
utils.addBuildStep(['docker-php-ext-enable xdebug'], options._app, options.name, 'build_as_root_internal');
addBuildStep(['docker-php-ext-enable xdebug'], options._app, options.name, 'build_as_root_internal');
}

// Install the desired composer version
if (options.composer_version) {
const commands = [`/helpers/install-composer.sh ${options.composer_version}`];
utils.addBuildStep(commands, options._app, options.name, 'build_internal', true);
addBuildStep(commands, options._app, options.name, 'build_internal', true);
}

// Add in nginx if we need to
if (_.startsWith(options.via, 'nginx')) {
// Set another lando service we can pass down the stream
const nginxOpts = nginxConfig(options);

// Merge in any user specifified
const LandoNginx = factory.get('nginx');
const data = new LandoNginx(nginxOpts.name, nginxOpts);
const PhpNginx = factory.get('php-nginx');
const data = new PhpNginx(nginxOpts.name, nginxOpts);
// If the user has overriden this service lets make sure we include that as well
const userOverrides = _.get(options, `_app.config.services.${nginxOpts.name}.overrides`, {});
data.data.push({
services: _.set({}, nginxOpts.name, userOverrides),
version: _.get(data, 'data[0].version'),
});
// Add a depends_on to make sure nginx waits for php-fpm to be up.
data.data.push({
services: _.set({}, nginxOpts.name, {'depends_on': [options.name]}),
version: _.get(data, 'data[0].version'),
});
// This is a trick to basically replicate what happens upstream
options._app.add(data);
options._app.info.push(data.info);
Expand Down
4 changes: 2 additions & 2 deletions services/php/default-ssl.conf → config/default-ssl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ServerAdmin webmaster@localhost
DocumentRoot ${LANDO_WEBROOT}
<Directory />
Options Indexes FollowSymLinks MultiViews
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Expand Down Expand Up @@ -48,7 +48,7 @@

DocumentRoot ${LANDO_WEBROOT}
<Directory />
Options Indexes FollowSymLinks MultiViews
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion services/php/default.conf → config/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ServerAdmin webmaster@localhost
DocumentRoot ${LANDO_WEBROOT}
<Directory />
Options Indexes FollowSymLinks MultiViews
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/5.3/.lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ tooling:
# This is important because it lets lando know to test against the plugin in this repo
# DO NOT REMOVE THIS!
plugins:
"@lando/php": ./../../
"@lando/php": ./../../
5 changes: 2 additions & 3 deletions examples/5.3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ Destroy tests
Run the following commands to trash this app like nothing ever happened.

```bash
# Should be destroyed with success
lando destroy -y
lando poweroff
# Should print out docker logs
docker logs landophp53_custom_nginx_1
```
Loading
Loading