Skip to content

Conversation

@helen
Copy link
Owner

@helen helen commented Nov 17, 2022

Opening a PR so I can track / talk to myself.

Todo:

  • Go back to default workspaceFolder as for core dev you're using the top level repo
  • Do we actually need to be using the www-data user?
  • Can we use the same containers that wp env uses?
  • Add setup.log to .gitignore
  • Allow some output to the terminal so it's clear what's happening

@helen
Copy link
Owner Author

helen commented Nov 17, 2022

Right now it starts the Codespace successfully but setup.sh seems to be running before npm is ready or something, though I do get /var/www/.nvm/versions/node/v14.17.6/bin/npm when I run which npm. The script is clearly not catching failures correctly because it continues on when it shouldn't, but for the moment that's helpful because we then see that mysql is not available as a command.

setup.log output (the PHP warnings at the end are from the build process not having run):

/workspaces/wordpress-develop/.devcontainer/setup.sh: line 18: npm: command not found
Setting up WordPress at https://helen-upgraded-space-waddle-q774jq9j5x24gxj-8080.preview.app.github.dev
Error: Failed to get current SQL modes. Reason: /usr/bin/env: 'mysql': No such file or directory

Success: WordPress installed successfully.
[17-Nov-2022 04:20:48 UTC] Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (through xdebug.client_host/xdebug.client_port) :-(
[17-Nov-2022 04:20:49 UTC] PHP Warning:  include(/var/www/html/wp-includes/assets/script-loader-react-refresh-entry.php): failed to open stream: No such file or directory in /var/www/html/wp-includes/script-loader.php on line 241
[17-Nov-2022 04:20:49 UTC] PHP Warning:  include(): Failed opening '/var/www/html/wp-includes/assets/script-loader-react-refresh-entry.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/wp-includes/script-loader.php on line 241
[17-Nov-2022 04:20:49 UTC] PHP Warning:  include(/var/www/html/wp-includes/assets/script-loader-packages.php): failed to open stream: No such file or directory in /var/www/html/wp-includes/script-loader.php on line 276
[17-Nov-2022 04:20:49 UTC] PHP Warning:  include(): Failed opening '/var/www/html/wp-includes/assets/script-loader-packages.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/wp-includes/script-loader.php on line 276
[17-Nov-2022 04:20:49 UTC] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-includes/script-loader.php on line 278

Oddly though, if I then run npm install && npm run build:dev myself from /workspaces/wordpress-develop it succeeds and everything is up and running. wp-cli is clearly working as is the DB, for instance:

www-data@ab39145bb8ea:/workspaces/wordpress-develop$ wp option get siteurl
[17-Nov-2022 04:48:47 UTC] Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (through xdebug.client_host/xdebug.client_port) :-(
https://helen-upgraded-space-waddle-q774jq9j5x24gxj-8080.preview.app.github.dev

(Xdebug is clearly still not working here)

@helen
Copy link
Owner Author

helen commented Nov 18, 2022

Interactive mode worked, thanks to @wirecat and @sam1el for the look and suggestion! Now just some cruft that only shows in setup.log so for the moment I think we can move to the "what's the right container strategy" part. This takes forever and a day to finish running (or I'm very impatient) - we should probably output more to let users know when setup is complete rather than swallowing it all into the log. Pre-builds will also figure into this I think but still.

## snipped npm install+build output ##
Done.
Setting up WordPress at https://helen-literate-tribble-7vv569r4q73pxp4-8080.preview.app.github.dev
Error: Failed to get current SQL modes. Reason: /usr/bin/env: 'mysql': No such file or directory

Success: WordPress installed successfully.
t_host/xdebug.client_port) :-(
[18-Nov-2022 01:31:58 UTC] Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (through xdebug.client_host/xdebug.client_port) :-(

@helen
Copy link
Owner Author

helen commented Nov 21, 2022

I have now switched this to building from a custom Dockerfile in /.devcontainer for ease of iteration and also to kinda prove out that that can be an option if the correct thing to do in terms of containers/Docker images is more baseline. Currently using the Docker-published wordpress one; IMO the more correct-seeming thing is use the wordpressdevelop-published ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants