From c1e38c19e124448853961fa0f6a94c76f060ba4e Mon Sep 17 00:00:00 2001 From: Gagan Deep Singh Date: Wed, 8 Jun 2022 06:17:36 +0530 Subject: [PATCH 1/5] Allow Lando config to be committed to the repo in gitignore --- .gitignore | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 878a77cd4..83ace146c 100755 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ sftp-config.json *.sublime-workspace .phpintel selenium-debug.log -.lando.wp-cli.yml -.lando.yml -/wordpress \ No newline at end of file +.lando.local.yml +/wordpress +/slow.log +/profiler-output \ No newline at end of file From 9f3a422ede7dd60f5e5f7efe5a91a41c915fa08f Mon Sep 17 00:00:00 2001 From: Gagan Deep Singh Date: Wed, 8 Jun 2022 06:18:14 +0530 Subject: [PATCH 2/5] Add Lando local development helper files --- .lando/php.ini | 2 ++ .lando/wp-cli.yml | 1 + .lando/xdebug.sh | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 .lando/php.ini create mode 100644 .lando/wp-cli.yml create mode 100755 .lando/xdebug.sh diff --git a/.lando/php.ini b/.lando/php.ini new file mode 100644 index 000000000..f6350ede6 --- /dev/null +++ b/.lando/php.ini @@ -0,0 +1,2 @@ +memory_limit = 1G +xdebug.start_with_request = trigger \ No newline at end of file diff --git a/.lando/wp-cli.yml b/.lando/wp-cli.yml new file mode 100644 index 000000000..cd9c12c27 --- /dev/null +++ b/.lando/wp-cli.yml @@ -0,0 +1 @@ +path: /app/wordpress diff --git a/.lando/xdebug.sh b/.lando/xdebug.sh new file mode 100755 index 000000000..9fda6d2b6 --- /dev/null +++ b/.lando/xdebug.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +if [ "$#" -ne 1 ]; then + echo "Xdebug has been turned off, please use the following syntax: 'lando xdebug '." + echo "Valid modes: https://xdebug.org/docs/all_settings#mode." + echo xdebug.mode = off > /usr/local/etc/php/conf.d/zzz-lando-xdebug.ini + pkill -o -USR2 php-fpm +else + mode="$1" + echo xdebug.mode = "$mode" > /usr/local/etc/php/conf.d/zzz-lando-xdebug.ini + if [[ $mode = *"profile"* ]]; then + if [ ! -d "$PROFILER_OUTPUT_DIR" ]; then + mkdir "$PROFILER_OUTPUT_DIR" + chown $LANDO_HOST_UID:$LANDO_HOST_GID "$PROFILER_OUTPUT_DIR" + fi + echo xdebug.output_dir = "/app/$PROFILER_OUTPUT_DIR" >> /usr/local/etc/php/conf.d/zzz-lando-xdebug.ini + fi + pkill -o -USR2 php-fpm + echo "Xdebug is loaded in "$mode" mode." +fi From e3eea3e44f34d623a2ca227c014fa85425a298c2 Mon Sep 17 00:00:00 2001 From: Gagan Deep Singh Date: Wed, 8 Jun 2022 06:18:24 +0530 Subject: [PATCH 3/5] Add Lando config --- .lando.yml | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .lando.yml diff --git a/.lando.yml b/.lando.yml new file mode 100644 index 000000000..ea9fedb2b --- /dev/null +++ b/.lando.yml @@ -0,0 +1,54 @@ +name: rtmedia +recipe: wordpress +config: + via: nginx + php: 7.4 + webroot: wordpress + database: mariadb + xdebug: true + config: + php: .lando/php.ini +services: + appserver: + overrides: + environment: + # Make this environment variable empty or else runtime xdebug mode change will not work + XDEBUG_MODE: '' + # Support debugging Drush with XDEBUG. + PHP_IDE_CONFIG: "serverName=appserver" + PROFILER_OUTPUT_DIR: "profiler-output" # If changing this value, change in .gitignore also + volumes: + - '.lando/wp-cli.yml:/wp-cli.yml' + - '.:/app/wordpress/wp-content/plugins/buddypress-media' + - '/app/wordpress/wp-content/plugins/buddypress-media/wordpress' + - '/app/wordpress/wp-content/plugins/buddypress-media/node_modules' + build_as_root: + - curl -sL https://deb.nodesource.com/setup_14.x | bash - + - apt-get install -y nodejs + build: + - wp core download --force --skip-content + run: + - wp config create --dbname=wordpress --dbuser=wordpress --dbpass=wordpress --dbhost=database --skip-check --force + - wp config set WP_DEBUG true --raw + - wp config set WP_DEBUG_LOG true --raw + - wp config set WP_DEBUG_DISPLAY false --raw + - wp config set WP_DISABLE_FATAL_ERROR_HANDLER true --raw + - wp config set WP_ENVIRONMENT_TYPE 'local' + - sleep 2 # For some reason, we have to wait at least a second till database is up. + - | # If core is not installed, install it + if ! wp core is-installed; then + wp core install --url=https://$LANDO_APP_NAME.$LANDO_DOMAIN --title=$LANDO_APP_NAME --admin_user=rtcamp --admin_email=lando@rtcamp.com --admin_password=goodwork + wp theme install --activate twentytwenty + wp plugin install --activate query-monitor + fi + mailhog: + type: mailhog + portforward: false + hogfrom: + - appserver +tooling: + xdebug: + description: Loads Xdebug in the selected mode. + cmd: + - appserver: /app/.lando/xdebug.sh + user: root \ No newline at end of file From 276e89fe3eefe7dcecb31a71cbe68901518ed75f Mon Sep 17 00:00:00 2001 From: Gagan Deep Singh Date: Wed, 8 Jun 2022 06:54:47 +0530 Subject: [PATCH 4/5] Add NPM support and update rewrite structure when local install --- .lando.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.lando.yml b/.lando.yml index ea9fedb2b..84e5f3cfb 100644 --- a/.lando.yml +++ b/.lando.yml @@ -25,8 +25,10 @@ services: build_as_root: - curl -sL https://deb.nodesource.com/setup_14.x | bash - - apt-get install -y nodejs + - npm install -g npm@latest build: - wp core download --force --skip-content + - npm install run: - wp config create --dbname=wordpress --dbuser=wordpress --dbpass=wordpress --dbhost=database --skip-check --force - wp config set WP_DEBUG true --raw @@ -40,6 +42,10 @@ services: wp core install --url=https://$LANDO_APP_NAME.$LANDO_DOMAIN --title=$LANDO_APP_NAME --admin_user=rtcamp --admin_email=lando@rtcamp.com --admin_password=goodwork wp theme install --activate twentytwenty wp plugin install --activate query-monitor + wp rewrite structure '/%postname%/' + # Not activating rtMedia directly when building containers because it does not allow us to debug + # issues that are specific to first time plugin activation + # wp plugin activate buddypress-media fi mailhog: type: mailhog @@ -51,4 +57,8 @@ tooling: description: Loads Xdebug in the selected mode. cmd: - appserver: /app/.lando/xdebug.sh - user: root \ No newline at end of file + user: root + node: + service: appserver + npm: + service: appserver \ No newline at end of file From 80f727ce715cd803da6c2de2bb33dd3d971e1740 Mon Sep 17 00:00:00 2001 From: Gagan Deep Singh Date: Wed, 8 Jun 2022 06:57:45 +0530 Subject: [PATCH 5/5] Add lando config excludes in WordPress Plugin Deploy action --- .github/workflows/create.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create.yml b/.github/workflows/create.yml index b0e3f1d56..c1b1bf2a2 100644 --- a/.github/workflows/create.yml +++ b/.github/workflows/create.yml @@ -14,7 +14,7 @@ jobs: ASSETS_DIR: wpassets EXCLUDE_LIST: .bowerrc .gitattributes .gitignore .jshintrc .travis.yml CONTRIBUTING.md Gruntfile.js README.md bin deploy.sh package-lock.json package.json phpcs.xml phpunit.xml - tests + tests .lando .lando.yml SLUG: buddypress-media WORDPRESS_PASSWORD: ${{ secrets.WORDPRESS_PASSWORD }} WORDPRESS_USERNAME: ${{ secrets.WORDPRESS_USERNAME }}