This runs WordPress instances for developing and testing Gutenberg like the project’s own wp-env setup but without needing to run Docker.
This doesn’t include the Gutenberg repo itself. It’s expected to provide the path of a local cloned repo to the script setup_wp
in the env variable GUTENBERG_REPO
.
Given devbox is installed (see Getting Started) to ready the environment run:
devbox services up -b
devbox run setup_db
Then set up the WP instances and provide the path to the gutenberg repo either in the command:
devbox run --env GUTENBERG_REPO=/yer/gutenberg setup_wp
Or through an env file:
devbox run --env-file .env.devbox setup_wp
Example env file:
GUTENBERG_REPO=/yer/gutenberg
# wp cli is used and you may wish to control its cache directory:
WP_CLI_CACHE_DIR=/yer/Library/Caches
That should be it 🍾.
It’s mostly working. Not all e2e tests pass but the vast majority do.
This project uses devbox to manage its development environment.
Install devbox:
curl -fsSL https://get.jetpack.io/devbox | bash
Start the devbox shell:
devbox shell
Run a script in the devbox environment:
devbox run <script>
Scripts are custom commands that can be run using this project's environment. This project has the following scripts:
GUTENBERG_REPO="~/Repos/gutenberg"
MYSQL_BASEDIR="/Users/m/Repos/devbox-gutenberg/.devbox/nix/profile/default"
MYSQL_DATADIR="/Users/m/Repos/devbox-gutenberg/.devbox/virtenv/mysql80/data"
MYSQL_HOME="/Users/m/Repos/devbox-gutenberg/.devbox/virtenv/mysql80/run"
MYSQL_PID_FILE="/Users/m/Repos/devbox-gutenberg/.devbox/virtenv/mysql80/run/mysql.pid"
MYSQL_UNIX_PORT="/Users/m/Repos/devbox-gutenberg/.devbox/virtenv/mysql80/run/mysql.sock"
NGINX_CONF="/Users/m/Repos/devbox-gutenberg/devbox.d/nginx/nginx.conf"
NGINX_CONFDIR="/Users/m/Repos/devbox-gutenberg/devbox.d/nginx"
NGINX_DEV_PORT="8888"
NGINX_DEV_ROOT="../../../devbox.d/web/dev-wp"
NGINX_PATH_PREFIX="/Users/m/Repos/devbox-gutenberg/.devbox/virtenv/nginx"
NGINX_TEST_PORT="8889"
NGINX_TEST_ROOT="../../../devbox.d/web/test-wp"
NGINX_TMPDIR="/Users/m/Repos/devbox-gutenberg/.devbox/virtenv/nginx/temp"
NGINX_WEB_PORT="80"
NGINX_WEB_ROOT="../../../devbox.d/web"
NGINX_WEB_SERVER_NAME="localhost"
PHPFPM_ERROR_LOG_FILE="/Users/m/Repos/devbox-gutenberg/.devbox/virtenv/php/php-fpm.log"
PHPFPM_PID_FILE="/Users/m/Repos/devbox-gutenberg/.devbox/virtenv/php/php-fpm.pid"
PHPFPM_PORT="8082"
PHPRC="/Users/m/Repos/devbox-gutenberg/devbox.d/php"
WP_CLI_CACHE_DIR="~/Library/Caches"
The Shell Init Hook is a script that runs whenever the devbox environment is instantiated. It runs
on devbox shell
and on devbox run
.
bash /Users/m/Repos/devbox-gutenberg/.devbox/virtenv/mysql80/setup_db.sh
echo 'Welcome to devbox!' > /dev/null
- path:/Users/m/Repos/devbox-gutenberg/.devbox/virtenv/php/flake
- path:/Users/m/Repos/devbox-gutenberg/.devbox/virtenv/php/flake#composer
- gettext@latest
- gawk@latest
- path:/Users/m/Repos/devbox-gutenberg/.devbox/virtenv/mysql80/flake
- nginx@latest
- wp-cli@latest
mysql -u root < setup_db.sql
./setup_wp.sh
echo "Error: no test specified" && exit 1