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

Playground Boot: Align the boot process between remote.html and CLI #1389

Merged
merged 3 commits into from
May 15, 2024

Conversation

adamziel
Copy link
Collaborator

What is this PR doing?

Aligns the boot process between the in-browser Playground Remote and Node-oriented Playground CLI.

With this PR, both apps use a similar createPHP() function that:

  • Sets up the SAPI name
  • Sets up PHP ini entries
  • Sets up the /phpinfo.php route
  • Sets up platform-level mu0plugins
  • Proxies filesystem directories from secondary PHP instances to primary
  • Sets up PHP runtime rotation to avoid OOM errors in long-running primary processes

There are still the following discrepancies:

  • The in-browser PHP sets up a SAPI name conditionally, Node.js one always uses cli (it probably shouldn't)
  • The in-browser PHP uses a custom spawn handler
  • The in-browser PHP uses a different set of php.ini directives
  • The in-browser PHP loads more mu-plugins
  • The Node.js PHP sets up CA certificates for HTTPS connections (the in-browser PHP will fake the CA chain eventually)

This is the first step towards a consistent Boot Protocol, see #1379 for more details.

Testing Instructions

  • Confirm the CI checks work
  • Run bun packages/playground/cli/src/cli.ts server --login, confirm the server starts without issues, test wp-admin and HTTPS-reliant features like the plugin directories.

We'll need a set of unit tests for these new boot-related features, let's create them sooner than later.

@adamziel adamziel changed the base branch from setup-sqlite-integration-without-creating-db-php to trunk May 14, 2024 10:21
@adamziel adamziel force-pushed the install-sqlite-function branch from cc703f5 to 8fff9cc Compare May 14, 2024 10:24
@adamziel adamziel changed the title PHP Boot: Align the boot process between remote and CLI PHP Boot: Align the boot process between remote.html and CLI May 14, 2024
@adamziel adamziel changed the title PHP Boot: Align the boot process between remote.html and CLI Playground Boot: Align the boot process between remote.html and CLI May 14, 2024
@adamziel
Copy link
Collaborator Author

The remaining parts start looking similar, too – there's handling mounts, setting site URL etc. We're getting closer to a consistent boot flow!

@adamziel adamziel merged commit a52a716 into trunk May 15, 2024
5 checks passed
@adamziel adamziel deleted the install-sqlite-function branch May 15, 2024 08:48
@adamziel adamziel mentioned this pull request May 15, 2024
1 task
adamziel added a commit that referenced this pull request May 15, 2024
…1389)

Aligns the boot process between the in-browser Playground Remote and
Node-oriented Playground CLI.

With this PR, both apps use a similar `createPHP()` function that:

* Sets up the SAPI name
* Sets up PHP ini entries
* Sets up the `/phpinfo.php` route
* Sets up platform-level mu0plugins
* Proxies filesystem directories from secondary PHP instances to primary
* Sets up PHP runtime rotation to avoid OOM errors in long-running
primary processes

There are still the following discrepancies:

* The in-browser PHP sets up a SAPI name conditionally, Node.js one
always uses `cli` (it probably shouldn't)
* The in-browser PHP uses a custom spawn handler
* The in-browser PHP uses a different set of php.ini directives
* The in-browser PHP loads more mu-plugins
* The Node.js PHP sets up CA certificates for HTTPS connections (the
in-browser PHP [will fake the CA chain
eventually](#1093))

This is the first step towards a consistent Boot Protocol, see
#1379 for
more details.

## Testing Instructions

* Confirm the CI checks work
* Run `bun packages/playground/cli/src/cli.ts server --login`, confirm
the server starts without issues, test wp-admin and HTTPS-reliant
features like the plugin directories.

We'll need a set of unit tests for these new boot-related features,
let's create them sooner than later.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant